Numerical Integration Calculator
Compare trapezoidal, Simpson's and midpoint rules side-by-side for a given integral.
About Numerical Integration Calculator
Compares three numerical integration methods on the same integral: • Trapezoidal rule: O(h²) error, linear interpolation between points • Midpoint rule: O(h²) error, uses center of each subinterval • Simpson's rule: O(h⁴) error, quadratic interpolation through triplets Simpson's is generally the most accurate for the same n, but all converge to the true integral as n increases.
Formula
Error orders
Trapezoid: O(h²), Midpoint: O(h²), Simpson: O(h⁴)
- h
- (b-a)/n
- n
- Number of subintervals
Worked example
With the default values below, Numerical Integration Calculator returns Simpson's rule of 0.7853981535. Change any input above and every figure here is recalculated in your browser.
Inputs used
- f(x)
- 1/(1+x^2)
- Lower bound (a)
- 0
- Upper bound (b)
- 1
- Subintervals (n, even)accepts 2–100,000
- 10
Results
- Simpson's rule
- 0.7853981535
- Trapezoidal rule
- 0.7849814972
- Midpoint rule
- 0.7856064963
Step by step
- 1Values used
- 2Error orders
- 3Simpson's rule= 0.7853981535
- 4Trapezoidal rule= 0.7849814972
- 5Midpoint rule= 0.7856064963
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 10 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Which method should I use?
Simpson's rule gives the best accuracy for smooth functions. The trapezoidal rule excels for periodic functions over a full period. Midpoint is simple and robust.
How do I estimate the error?
Compare results at n and 2n. For Simpson's rule, the difference divided by 15 approximates the error (Richardson extrapolation).
