Connect via MCP →

Enter Calculation

Formula

Formula: Simpson's Rule Integration Calculator

Advertisement

Results

S = ∫ from a to b of f(x) dx
3.141592653589
Simpson's rule estimate at n = 64
Subdivisions n Estimate
2 3.133333333333
4 3.141568627451
8 3.141592502459
16 3.141592651225
32 3.141592653553
64 3.141592653589

What is the Simpson's Rule Integration Calculator?

This tool numerically approximates the definite integral of a function f(x) over an interval [a, b] using the composite Simpson's rule. It is pure mathematics and applies universally. The calculator refines its estimate by doubling the number of subintervals (2, 4, 8, 16, ... up to a chosen maximum N), letting you watch the value converge.

How to use it

Enter your function in terms of x (for example 4/(1+x^2) or sin(x)), set the lower bound a and upper bound b, and choose the maximum number of subdivisions N. You may also pick how many significant digits to display. Both the bounds and the function accept constants like pi and e as well as functions sin, cos, tan, exp, ln, log10, sqrt, abs and more.

The formula explained

For an even number of subintervals \(n\) over [a, b], the step size is \(h = (b - a) / n\). With nodes \(x_i = a + i\cdot h\), Simpson's rule weights the endpoints by 1, interior odd-indexed nodes by 4, and interior even-indexed nodes by 2, then multiplies the total by \(h/3\).

$$\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]$$

The method has error \(O(h^4)\) and is exact for polynomials of degree three or less.

Advertisement
Sample points colored by Simpson weights of 1, 4, 2 in alternating pattern
The 1-4-2-4-...-4-1 weight pattern applied to the function values at each node.
Curve approximated by parabolic arcs over paired subintervals between a and b
Simpson's rule fits parabolas over pairs of subintervals to approximate the area under f(x).

Worked example

Take \(f(x) = 4/(1+x^2)\), \(a = 0\), \(b = 1\), \(n = 4\). Then \(h = 0.25\) and the node values are 4.000000, 3.764706, 3.200000, 2.560000, 2.000000. Applying Simpson's rule:

$$S = \frac{0.25}{3}\cdot\left[4 + 4\cdot(3.764706 + 2.560000) + 2\cdot 3.200000 + 2\right] = 3.141569$$

With \(N = 64\) the estimate converges to \(\pi \approx 3.14159265358979\).

FAQ

Why must n be even? Simpson's rule pairs adjacent subintervals to fit a parabola through three points, so the count must be even. The powers of two used here are always even.

What if b is less than a? The result is simply the negative of the integral over [b, a]; the formula handles a negative step size correctly.

What about singularities? If f(x) is undefined at a node (division by zero, log of a non-positive number, sqrt of a negative), the result becomes unreliable; the calculator reports an error instead of a misleading number.

Last updated: