SimuVeda

Mathematics · Simulator 042

Integral Explorer

Fill the area under a curve with rectangles or trapezoids. Change the number of strips, the bounds and the method, and compare each approximation with the exact integral. Watch how fast each method's error shrinks as the strips get thinner.

How the model works

The definite integral ∫ₐᵇ f(x) dx is the signed area between the curve and the x-axis (area below the axis counts as negative). Splitting [a, b] into n strips of width Δx = (b − a)/n gives Riemann sums:

  • Left / right: rectangle height from the left or right edge of each strip. Error ∝ 1/n.
  • Midpoint: height at the strip centre. Error ∝ 1/n².
  • Trapezoid: straight line across each strip. Error ∝ 1/n², about twice the midpoint error with opposite sign.
  • Simpson: parabolas through pairs of strips. Error ∝ 1/n⁴.

The exact value comes from an antiderivative, by the Fundamental Theorem of Calculus ∫ₐᵇ f dx = F(b) − F(a). The lower chart shows the error against n on log–log axes; the slope of each line is the order of the method.

Simpson's rule needs an even n; odd n is rounded up for that method.

Guided experiments

  1. x² from 0 to 1. Left sum with n = 4. Prediction: the left sum 0.21875 is too small for an increasing function; the exact area is 1/3.
  2. Double the strips. Watch the error chart while n doubles. Prediction: left/right errors halve each doubling; midpoint and trapezoid errors quarter; Simpson's drops 16×.
  3. Signed area. sin x from 0 to 2π. Prediction: the exact integral is 0. The positive and negative lobes cancel.

Challenge

Using the trapezoid rule with n = 4 on ∫₀¹ x² dx, is the estimate too big or too small? Why, without calculating?

Reveal the explanation

Too big. x² curves upward (convex), so each straight trapezoid top lies above the curve. The trapezoid value is 0.34375, against an exact 1/3. The midpoint rule errs the other way for convex functions (0.328125).

References

  • OpenStax, Calculus Volume 1, §5.1 “Approximating Areas” and §3.6 of Volume 2, “Numerical Integration”.