Numerical Integration Calculator
Compare trapezoidal, Simpson's and midpoint rules side-by-side for a given integral.
Inputs
Integrand using x.
Simpson's rule
0.7853981535
Trapezoidal rule
0.7849814972
Midpoint rule
0.7856064963
Step by step
Values used
f(x) = 1/(1+x^2); Lower bound (a) = 0; Upper bound (b) = 1; Subintervals (n, even) = 10
Error orders
Trapezoid: O(h²), Midpoint: O(h²), Simpson: O(h⁴)
Simpson's rule
= 0.7853981535
Trapezoidal rule
= 0.7849814972
Midpoint rule
= 0.7856064963
How it works
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
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).