Simpson's Rule Calculator

Simpson's rule approximation—
Exact value—
Absolute error—

How Simpson's Rule Calculator is calculated: ∫f(x) dx ≈ (h/3)[f₀ + 4f₁ + 2f₂ + 4f₃ + ... + fₙ], h = (b − a) ÷ n, n even

What is a Simpson's Rule Calculator?

The Simpson's Rule Calculator is a free online tool that approximates a definite integral using Simpson's rule, with a chosen number of subintervals, and shows how close the approximation is to the exact value. Numerical-methods and calculus students learning to integrate functions that have no elementary antiderivative use it when a numeric value for an integral they cannot do by hand, with a sense of how accurate the answer is. Instead of applying the 4-2-4-2 weighting pattern over many subintervals, where one misplaced coefficient ruins the sum, you type the integrand from the list, the limits a and b, and the number of subintervals n and the calculator returns the Simpson approximation, the exact value of the integral, and the absolute error between them straight away.

The working idea is simple. the calculator divides the interval into n equal subintervals, fits a parabola through each triple of points, and adds up the areas under those parabolas The weights follow the pattern 1, 4, 2, 4, 2, ..., 4, 1, multiplied by h/3, where h is the width of one subinterval. The number of subintervals must be even, because the rule works in pairs of subintervals; if you enter an odd n, the calculator rounds it up to the next even number. There is no sign-up and nothing to install: the page runs entirely in your browser, so your numbers never leave your device.

That matters because many integrals cannot be done in closed form — the error function, the sine integral, and most real-world data — and Simpson's rule gives an accurate number with only a handful of evaluations The approximation is numeric, and its error shrinks with the fourth power of the step size — doubling n cuts the error by roughly a factor of 16 — but a function with a sharp spike or a kink inside the interval needs many more subintervals. The rest of this page walks through the formula, the input people get wrong most often, and a worked example with real numbers you can check by hand.

How a Simpson's Rule Calculator works

At its core, the calculator applies the integral is approximately h over 3 times the weighted sum of the function values, with weights 1, 4, 2, 4, 2 and so on. ∫f(x) dx ≈ (h/3)[f₀ + 4f₁ + 2f₂ + 4f₃ + ... + fₙ], where h = (b − a) ÷ n and n is even. The endpoints carry weight 1, the odd-numbered interior points carry weight 4, and the even-numbered interior points carry weight 2. The formula box at the top of this page shows the same rule in symbols: ∫f(x) dx ≈ (h/3)[f₀ + 4f₁ + 2f₂ + 4f₃ + ... + fₙ], h = (b − a) ÷ n, n even.

The calculator evaluates the function at n + 1 evenly spaced points, applies the 4-2 pattern, and multiplies by h/3. The exact value is the analytic integral of the preset function, so the error shown is the true error of the approximation, not an estimate of it. The upper limit must be greater than the lower limit, and n must be at least 2. An odd n is rounded up to the next even number, which is noted here so the change does not surprise you.

The error of Simpson's rule shrinks like h⁴, so doubling n cuts the error by about a factor of 16 A integral calculator can help you check the numbers that feed into this step, and it is worth doing that check before you trust an answer that looks surprising.

The the number of subintervals explained

The number of subintervals decides the accuracy, and the mistake people make is using too few and trusting the answer. With n = 2, the integral of sin x from 0 to π comes out as 2.09 instead of 2 — an error of 0.09, which is far too big to ignore. With n = 10 the same integral is 2.0001, and the error has almost vanished. The rule is powerful, but only if you give it enough subintervals.

Start with n = 10 and look at the error, then double n and watch the error fall. If doubling n barely changes the answer, you have enough subintervals; if it changes a lot, keep doubling. For smooth functions n = 10 to 100 is usually plenty. Remember that n must be even. If you enter 11, the calculator uses 12, so the answer corresponds to 12 subintervals, not 11 — check the error, not the count you typed.

For x² from 0 to 1, Simpson's rule is exact even with n = 2, because the rule integrates cubics exactly. If your answer for a cubic is not exact, a weight is wrong. A derivative calculator is a good cross-check when the input comes from a measurement or a table rather than from a textbook problem.

A worked example

Take the default settings on this page: f(x) = x² from 0 to 1, with n = 10 subintervals.

The Simpson approximation is 0.3333, the exact value is 0.3333, and the error is 0. The exact integral is (1³ − 0³) ÷ 3 = 1/3, about 0.3333.

The error is zero to the decimals shown, because Simpson's rule is exact for polynomials up to degree 3, and x² is a quadratic. The approximation is not just close here — it is exact, which is the best advertisement for the rule. Try sin x from 0 to π with n = 2: the approximation is 2.09 against an exact value of 2, an error of about 0.09. Raise n to 10 and the error drops below 0.001, which shows how fast the rule improves.

Where the Simpson's Rule Calculator is used

In engineering, Simpson's rule integrates measured data — a table of values with no formula at all — by treating the measurements as the function values at evenly spaced points.

In physics, it evaluates integrals that have no closed form, such as the period of a large-amplitude pendulum, where the exact answer needs an elliptic integral. A trigonometry calculator often sits next to it in the same workflow, because the two answers answer different halves of the same question.

In statistics, it computes probabilities from density functions that cannot be integrated by hand, such as the normal distribution's tail areas.

It also helps to keep the units consistent from the first number to the last. Mixing units — metres with centimetres, degrees with radians, seconds with minutes — is the quietest way to get an answer that looks plausible and is wrong by a large factor. Write the unit next to every number you enter, and check the result's unit against the unit you expect before you use the answer anywhere else.

Simpson's Rule Calculator vs Integral Calculator

An integral calculator gives the exact value of a definite integral when one exists in closed form. This calculator approximates the integral numerically, which is the only option when no closed form exists — and it shows the exact value beside the approximation so you can see how good the method is.

Use the integral calculator when the antiderivative is known and you want the exact answer. Use Simpson's rule when the function has no elementary antiderivative, or when the function is a table of measurements with no formula at all. The scientific calculator covers the other side of the same problem, so the two tools complement each other rather than compete.

The two agree where they overlap: for the preset functions here, the exact value shown is what the integral calculator would give, and the Simpson approximation converges to it as n grows.

Common mistakes with the Simpson's Rule Calculator

The first mistake is using an odd number of subintervals. Simpson's rule works in pairs, so n must be even; an odd n either breaks the pattern or silently drops a subinterval, and the answer is wrong either way.

The second mistake is getting the 4-2 pattern backwards — putting 2 on the odd points and 4 on the even ones. The endpoints are 1, the first interior point is 4, the next is 2, and so on; swapping them gives a different, wrong sum.

The third mistake is forgetting the h/3 factor, or using h instead of h/3. The weights add up to 3n, not n, so the h/3 is what scales the sum back to the size of the integral — without it the answer is three times too big.

A last mistake is trusting the first answer without a rough check. Before you accept a result, estimate it by hand to one significant figure: if the calculator says 400 and your rough estimate says 40, something is off — usually a misplaced decimal point or a wrong unit. The calculator does the arithmetic; the judgement about whether the answer makes sense still belongs to you.

How to use this Simpson's Rule Calculator

Open the page and enter the integrand from the list, the limits a and b, and the number of subintervals n. Pick the integrand, set the limits, and choose n — start with 10 and double it if the error is too big. The exact value and the error are shown beside the approximation.

Read the approximation as the numerical answer, the exact value as the truth for these preset functions, and the error as the gap between them. If the error is 0.00, the rule was exact for your function — which happens for polynomials up to degree 3 — not a sign that the error display is broken.

Everything runs in your browser. No account, no upload, no data sent anywhere — your numbers never leave your device. If a result looks wrong, re-check the inputs first: a single mistyped number is the usual cause, and a integral calculator will confirm the arithmetic.

Frequently Asked Questions

The approximation is 0.3333, the exact value is 0.3333, and the error is 0. Simpson's rule is exact for polynomials up to degree 3, so the error is zero here.

the integral is approximately h over 3 times the weighted sum of the function values, with weights 1, 4, 2, 4, 2 and so on ∫f(x) dx ≈ (h/3)[f₀ + 4f₁ + 2f₂ + 4f₃ + ... + fₙ], where h = (b − a) ÷ n and n is even. The endpoints carry weight 1, the odd-numbered interior points carry weight 4, and the even-numbered interior points carry weight 2.

Because the rule fits a parabola through three points at a time, covering two subintervals per parabola. With an odd number of subintervals, the last one would have no partner, and the pattern would break. If you enter an odd n, this calculator rounds it up to the next even number.

The error shrinks like the fourth power of the step size, so doubling n cuts the error by roughly a factor of 16. That is why going from n = 2 to n = 10 can take the error on sin x from 0.09 down to almost nothing, and why Simpson's rule beats the trapezoidal rule, whose error only falls like the square of the step.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.