Approximate Integration: Rectangle, Trapezoidal & Simpson Methods

Approximate Integration: Rectangle, Trapezoidal & Simpson Methods
Loading the math board and drawing, please wait…
2012-07-11 05:15
This applet visualizes numerical approximation of definite integrals using left‑endpoint, right‑endpoint, and midpoint rectangle rules, the trapezoidal rule, and Simpson’s rule. Core concepts include the definite integral, Riemann sums, upper/lower sums, trapezoidal and Simpson formulas, and error estimation. Construction leverages GeoGebra commands such as Point for interval endpoints, LowerSum and TrapezoidalSum to generate rectangles and trapezoids, Sequence to create subinterval partitions, Integral for the exact area, and If to toggle error displays, together with objects like Segment, rectangles, trapezoids, and text labels. It is suitable for high‑school calculus electives, university calculus courses, and self‑study of numerical integration techniques.

GeoGebra Commands & Parameters

  1. Point(xAxis) → B
  2. Point(xAxis) → A
  3. LowerSum(f, a, b, n) → c
  4. LowerSum(g, a, b, n) → d
  5. Segment(A, (a, f(a))) → LA
  6. Segment(B, (b, f(b))) → LB
  7. Sequence(f(a + (i - 1 + p) * (b - a) / n), i, 1, n) → L
  8. Integral(f, a, b) → actualarea
  9. TrapezoidalSum(f, a, b, n) → trapezoidsum
  10. Sequence(a + i * Δx, i, 0, n) → X
  11. Sequence(Determinant[{{Element[X, 2 * i - 1]^(2), Element[X, 2 * i - 1], 1}, {Element[X, 2 * i]^(2), Element[X, 2 * i], 1}, {Element[X, 2 * i + 1]^(2), Element[X, 2 * i + 1], 1}}], i, 1, n / 2, 1) → S
  12. Sequence(Determinant[{{Element[X, 2 * i - 1], f(Element[X, 2 * i - 1]), 1}, {Element[X, 2 * i], f(Element[X, 2 * i]), 1}, {Element[X, 2 * i + 1], f(Element[X, 2 * i + 1]), 1}}], i, 1, n / 2, 1) → P
  13. Sequence(Determinant[{{Element[X, 2 * i - 1]^(2), f(Element[X, 2 * i - 1]), 1}, {Element[X, 2 * i]^(2), f(Element[X, 2 * i]), 1}, {Element[X, 2 * i + 1]^(2), f(Element[X, 2 * i + 1]), 1}}], i, 1, n / 2, 1) → Q
  14. Sequence(Determinant[{{Element[X, 2 * i - 1]^(2), Element[X, 2 * i - 1], f(Element[X, 2 * i - 1])}, {Element[X, 2 * i]^(2), Element[X, 2 * i], f(Element[X, 2 * i])}, {Element[X, 2 * i + 1]^(2), Element[X, 2 * i + 1], f(Element[X, 2 * i + 1])}}], i, 1, n / 2, 1) → R
  15. Sequence(If[Element[X, 2 * i - 1] ≤ x ≤ Element[X, 2 * i + 1], -1 / Element[S, i] * (Element[P, i] * x^(2) - Element[Q, i] * x - Element[R, i])], i, 1, n / 2) → simp
  16. Sequence(Integral[Element[simp, i], Element[X, 2 * i - 1], Element[X, 2 * i + 1]], i, 1, n / 2) → simpsonpieces
  17. If(Mod[n, 2] ≟ 0, Sum[simpsonpieces], "undefined") → simparea
  18. Integral(Element[simp, 1], Element[X, 1], Element[X, 3]) → simpsonpiece1
  19. Integral(Element[simp, 2], Element[X, 3], Element[X, 5]) → simpsonpiece2
  20. Integral(Element[simp, 3], Element[X, 5], Element[X, 7]) → simpsonpiece3
  21. Integral(Element[simp, 4], Element[X, 7], Element[X, 9]) → simpsonpiece4
  22. Integral(Element[simp, 5], Element[X, 9], Element[X, 11]) → simpsonpiece5
  23. Integral(Element[simp, 6], Element[X, 11], Element[X, 13]) → simpsonpiece6
  24. Integral(Element[simp, 7], Element[X, 13], Element[X, 15]) → simpsonpiece7
  25. Integral(Element[simp, 8], Element[X, 15], Element[X, 17]) → simpsonpiece8
  26. Integral(Element[simp, 9], Element[X, 17], Element[X, 19]) → simpsonpiece9
  27. Integral(Element[simp, 10], Element[X, 19], Element[X, 21]) → simpsonpiece10