Type analytic expressions such as sin(x), exp(-x^2), x^3 - 2x, or combinations that call ln, abs, sgn, and constants like pi.
Need a quick class demo? Toggle the fill option to emphasise signed area, compare how each rule converges as n grows, and use the CSV or LaTeX buttons to build worksheets instantly.
Inputs & options
Visualisation
Result
How it's calculated
Interpretation & worked example
A Riemann sum approximates the definite integral by adding up small “area” pieces: Sₙ = Σ f(xᵢ*)·Δx, where Δx = (b−a)/n. With more subintervals (larger n), the approximation usually improves.
Quick intuition (when it over/under-shoots)
- If f(x) is increasing on [a,b], the left sum tends to underestimate and the right sum tends to overestimate.
- Midpoint and trapezoid are often much closer for smooth functions.
- Simpson can be very accurate on smooth curves, but it requires an even n.
Mini example: f(x)=x² on [0,1] with n=4
Here Δx = 0.25 and the true value is ∫₀¹ x² dx = 1/3 ≈ 0.3333.
- Left: 0.21875 (undershoots)
- Right: 0.46875 (overshoots)
- Midpoint: 0.328125 (close)
- Trapezoid: 0.34375 (close)
- Simpson (n=4): 0.33333… (exact for this polynomial)
Tip: use the Rule dropdown to compare methods at the same n, then increase n to see convergence.
References
FAQ
Which Riemann sum rule should I pick?
Left/right sums follow the orientation of rectangles, which is great for quick estimates but can over- or undershoot when f is monotone. The trapezoid rule is second-order accurate and balances speed with precision. Simpson's rule reaches fourth-order accuracy on smooth functions, while midpoint splits the difference with a symmetric single-rectangle view.
Why must Simpson's rule use an even n?
Simpson's rule joins point triplets with quadratics, so the interval must break into an even number of subintervals. The explorer automatically increases n by 1 when needed and highlights the adjustment in the steps.
How many subintervals n should I use?
For smooth functions start with n = 50–100 and increase n to reduce error. Simpson converges faster but requires even n; the tool adjusts n automatically when needed.
Can I enter piecewise or non‑analytic functions?
Yes. You can use abs, sgn, and constants like pi. Non‑finite evaluations are skipped and treated as zero; the step log notes any skipped points.