About this experiment
Approximate a definite integral with rectangles and compare the sum against an exact antiderivative. Choose left, midpoint or right sampling, change the bounds, and increase the number of rectangles. Regions below the horizontal axis contribute negatively when bounds run from left to right. Reversing the bounds reverses the integral sign.
Learning goals
- Construct a uniform Riemann sum with different sample positions
- Compare numerical approximation error with an analytic integral
- Distinguish signed accumulation from total geometric area
How to use it
- 1For x squared on [0, 2], compare left, midpoint and right sums with 8 rectangles.
- 2Double the rectangle count several times and record the absolute error.
- 3Choose y = x and bounds −2 and 2. Explain the cancellation of signed contributions.
- 4Swap the bounds and check the signs of both the exact integral and the Riemann sum. Set equal bounds and check the result.
The model
Assumptions
- The selected functions are continuous. Exact reference values use their analytic antiderivatives.
- All rectangles have equal signed width. Left and right refer to the start and end of each oriented subinterval, so their visual roles reverse when b is less than a.
- The pale fill shows the geometric region, while the readouts include function sign and bound order. Sine uses radians.
Try this in class
- Q1Why does left sampling underestimate the integral of x squared on [0, 2]?
- Q2Can a nonzero shaded region have a zero definite integral? Give an example.
- Q3Does doubling the number of rectangles always halve the error? Compare midpoint and endpoint sampling.
Frequently asked questions
Why can the integral be negative?
For increasing bounds, values below the axis contribute negatively. Reversing the bounds changes the sign of every contribution. A definite integral measures signed accumulation, not necessarily geometric area.
Why does the midpoint sum for y = x have zero error?
A linear function has the same average value on each subinterval as its midpoint value. Midpoint rectangles therefore integrate a straight line exactly, apart from floating-point rounding.
