Skip to content
Popular Calculators
Browse Math calculators

Simpson's Rule Calculator

Approximate a definite integral with Simpson's 1/3 or 3/8 rule, showing each point, its weight, the step size and an estimated error.

Use x, ^ for powers and functions such as sin(x), ln(x), sqrt(x), e^x.

A number or expression such as pi/2.

Even for the 1/3 rule, a multiple of 3 for the 3/8 rule.

Rule (optional)

Result

Integral≈ 0.785392
Set-upSimpson's 1/3 rule, n = 4, h = (1 − 0) ÷ 4 = 0.25
Accuracy checkwith n = 8: 0.785398; estimated error of the n = 4 result about 6.3667e−6
Worth knowingexact for polynomials up to degree 3; rough or rapidly changing functions need a larger n

How this was calculated

  1. Step sizeh = 0.25
  2. Weights1, 4, 2, 4, 2, …, 4, 1
  3. x0 = 0f = 1 × 1
  4. x1 = 0.25f = 0.941176 × 4
  5. x2 = 0.5f = 0.8 × 2
  6. x3 = 0.75f = 0.64 × 4
  7. x4 = 1f = 0.5 × 1
  8. Resulth/3 × 9.42471 = 0.785392

About the Simpson's Rule Calculator

Many definite integrals cannot be worked out with antiderivatives. The integral of e^(−x²), of sin(x)/x or of a function known only by a formula in a computer model has no simple closed form, yet engineers and scientists need its value. Numerical integration estimates the area under the curve from function values at evenly spaced points, and Simpson's rule is one of the most accurate simple methods.

This Simpson's rule calculator approximates the integral of f(x) from a to b using the composite Simpson's 1/3 rule or 3/8 rule. It shows the step size, the value and weight at each point, the weighted sum and the result. It also repeats the calculation with twice as many subintervals so you can see how accurate the first answer is.

How to Use the Simpson's Rule Calculator

Enter the function f(x) using x as the variable, ^ for powers and functions such as sin(x), ln(x), sqrt(x) or e^x.

Enter the lower limit a and upper limit b. They can be numbers or expressions such as pi or pi/2.

Enter the number of subintervals n. For the 1/3 rule it must be even; for the 3/8 rule it must be a multiple of 3.

Choose the rule: 1/3 or 3/8.

The Formulas

  h = (b − a) / n,  x_i = a + i·h,  f_i = f(x_i)
  1/3 rule:  ∫ ≈ h/3 × [f0 + 4f1 + 2f2 + 4f3 + … + 2f(n−2) + 4f(n−1) + fn]
  3/8 rule:  ∫ ≈ 3h/8 × [f0 + 3f1 + 3f2 + 2f3 + 3f4 + 3f5 + 2f6 + … + fn]
  error estimate of S_n ≈ (S_2n − S_n) × 16/15

Step-by-Step Example

Estimate the integral of 1/(1 + x²) from 0 to 1 with the 1/3 rule and n = 4. The exact value is π/4 ≈ 0.785398.

  h = (1 − 0) / 4 = 0.25
  x:  0      0.25      0.5    0.75    1
  f:  1      0.941176  0.8    0.64    0.5
  w:  1      4         2      4       1
  sum = 1 + 3.764706 + 1.6 + 2.56 + 0.5 = 9.424706
  S4  = 0.25 / 3 × 9.424706 ≈ 0.785392

The error is about 0.000006 with only five function values. Doubling to n = 8 gives 0.785398, and (0.785398 − 0.785392) × 16/15 estimates the error of the first answer at about 0.000006, which matches the true error closely.

Why Simpson's Rule Is So Accurate

The trapezoidal rule joins neighbouring points with straight lines. Simpson's 1/3 rule instead passes a parabola through each group of three points and integrates it exactly. Because parabolas bend with the curve, much less area is missed. A pleasant surprise is that the rule is exact not only for quadratics but for cubics too, because the error terms for the cubic part cancel by symmetry.

The practical result is that the error is proportional to h⁴. Halve the step size and the error falls by a factor of about 16, compared with a factor of 4 for the trapezoidal rule. That is why a modest number of points often gives six or more correct digits for smooth functions.

The 1/3 Rule and the 3/8 Rule

The 3/8 rule fits a cubic through each group of four points, covering three subintervals at a time. Despite using a higher degree polynomial, it has the same h⁴ order of accuracy as the 1/3 rule, and its error constant is slightly larger. Its main use is practical: when data come in a number of intervals that is a multiple of 3, or when an odd number of intervals can be split into a 1/3 part and a 3/8 part.

For the same example with the 3/8 rule and n = 6, the calculator gives 0.785396, also within a few millionths of π/4. In everyday work either rule is fine; pick the one your course or textbook asks for.

Choosing the Number of Subintervals

Start with a modest even number such as 4, 8 or 10, then look at the accuracy check. If the doubled-n result agrees with the first to the number of digits you need, the first answer is good enough. If not, increase n. Functions that change quickly, oscillate, or have a steep section need more points, and a function with a sharp corner loses the h⁴ advantage near that corner.

If the function is undefined at a point the rule uses, such as 1/x at x = 0 or ln(x) at 0, Simpson's rule cannot be applied directly. Such improper integrals need a substitution or a method designed for singularities.

Uses of Simpson's Rule

Simpson's rule is used to integrate measured data at evenly spaced intervals, such as river cross sections for flow, ship hull offsets for displacement, or velocity readings to find distance travelled. It is a standard topic in AP Calculus, A-level mathematics and first-year numerical methods courses, and it underlies adaptive integration routines used in software.

Understanding Your Result

The headline gives the approximate value of the integral.

The set-up line shows the rule, n and the step size h.

The accuracy check shows the result with twice as many subintervals and the estimated error of your answer.

The steps list each point, its function value and its weight when n is 12 or fewer.

When Should You Use This Calculator?

Use it to approximate definite integrals that have no simple antiderivative.

Use it to check Simpson's rule homework, including the table of weights.

Use it to compare the 1/3 and 3/8 rules on the same function.

Common Mistakes

Using an odd n with the 1/3 rule. The parabolas need subintervals in pairs.

Mixing up the weights. Odd points get 4 and even interior points get 2 in the 1/3 rule.

Forgetting the h/3 factor. The weighted sum must be multiplied by h/3, or 3h/8 for the 3/8 rule.

Using degrees. Trigonometric functions take radians.

Frequently Asked Questions

How does Simpson's rule work?

It fits parabolas through each pair of subintervals and adds up the areas under them. With step h, the 1/3 rule multiplies h/3 by the first and last values plus 4 times the odd points and 2 times the even interior points.

Why must n be even for Simpson's rule?

Each parabola spans two subintervals, so the 1/3 rule needs them in pairs. The 3/8 rule fits cubics across three subintervals at a time, so it needs n to be a multiple of 3 instead.

How accurate is Simpson's rule?

Very accurate for smooth functions. Its error shrinks with h to the fourth power, so doubling n cuts the error about sixteenfold. For 1/(1 + x²) from 0 to 1 with n = 4 the result 0.785392 is within 0.000006 of π/4.

Is the 3/8 rule better than the 1/3 rule?

Both are fourth order and give similar accuracy for the same number of points. The 3/8 rule's error constant is a little larger, but it is handy when the number of intervals is a multiple of 3 rather than even.

How is the error estimated?

The calculator also runs the rule with twice as many subintervals. Because the error falls by about 16 times, the gap between the two results multiplied by 16/15 estimates the error of your original answer.

When is Simpson's rule exact?

It gives the exact integral for any polynomial of degree three or less, however few subintervals you use. Functions with sharp corners, singularities or fast oscillation need many more points to be accurate.

Formula and article last checked September 28, 2026. How we test these calculators.