What Is Simpson's Rule?
Simpson's Rule is a numerical integration technique that approximates the area under a curve by fitting parabolas through groups of three points. It is far more accurate than the trapezoidal rule for smooth functions because it captures curvature, not just straight-line segments. This calculator evaluates any single-variable function \(f(x)\) over the interval \([a, b]\) using the composite Simpson's 1/3 rule.
How to Use This Calculator
Enter your function using x as the variable — for example x^2, sin(x), or exp(-x)*cos(x). Supported operators are + − * / ^ and functions sin, cos, tan, exp, ln, log, sqrt, and abs (angles in radians). Set the lower limit \(a\), the upper limit \(b\), and the number of subintervals \(n\). Because the method pairs intervals into parabolas, n must be even; if you enter an odd value it is automatically rounded up.
The Formula Explained
The interval is split into \(n\) equal pieces of width \(\Delta x = (b - a)/n\), giving sample points \(x_0, x_1, \ldots, x_n\). The endpoints \(f_0\) and \(f_n\) are weighted by 1, the odd-indexed interior points by 4, and the even-indexed interior points by 2. The weighted total is multiplied by \(\Delta x/3\) to estimate the integral.
$$\int_{a}^{b} f(x)\,dx \approx \frac{h}{3}\left[ f(x_0) + 4\!\!\sum_{i\,\text{odd}}\!\! f(x_i) + 2\!\!\sum_{i\,\text{even}}\!\! f(x_i) + f(x_n) \right]$$
Worked Example
Integrate \(f(x) = x^2\) from 0 to 2 with \(n = 4\). Then \(\Delta x = 0.5\) and the points are 0, 0.5, 1, 1.5, 2 with values 0, 0.25, 1, 2.25, 4. Odd sum \(= 0.25 + 2.25 = 2.5\); even sum \(= 1\). Result:
$$\left(\frac{0.5}{3}\right)\cdot\left[0 + 4(2.5) + 2(1) + 4\right] = \left(\frac{0.5}{3}\right)\cdot 16 = 2.6667$$matching the exact value of \(8/3\).
FAQ
Why must n be even? Each parabola spans two subintervals, so the count must be divisible by 2.
How accurate is it? The error shrinks with the fourth power of \(\Delta x\), so doubling \(n\) cuts error roughly 16-fold for smooth functions. Simpson's Rule is exact for cubic polynomials.
What about angles? Trigonometric functions use radians, so convert degrees first if needed.