Simpson's Rule Calculator screenshot

Simpson's Rule Calculator

Approximate a definite integral with Simpson's rule, requiring an even n and printing the weights, h and the estimate.

Privacy First
0 Runs
Updated 2026-11-22
No upload
Instant
No signup

Simpson's Rule Calculator

Approximate a definite integral with Simpson's rule, requiring an even n and printing the weights, h and the estimate.

How this page computes

The page requires an even number of intervals, applies the 1-4-2-4-...-1 weights and multiplies by h/3. An odd n is refused rather than silently adjusted.

The calculation runs entirely in this browser tab; nothing is uploaded.

The page applies Simpson's rule to a definite integral and prints the estimate, n and h. Worked example: x^2 on [0, 1] with n = 100 gives 0.333333333333.

Simpson's rule fits a parabola through each pair of subintervals, so it integrates a quadratic exactly. The page requires an even n, states that requirement, and refuses an odd n instead of changing it behind your back.

How to use Simpson's Rule Calculator

Enter the integrand in x, set the bounds and an even number of intervals n, then press Run. The first line is the estimate and the second names h and the weight pattern.

If n is odd the page refuses the run and asks for an even n. That is the rule's actual precondition, not a rounding convenience.

The composite Simpson's rule

The composite rule groups the grid into pairs of subintervals and fits a parabola through three consecutive points. The weights are 1 at each endpoint, 4 at each odd index and 2 at each even interior index.

The error is O(h^4) for a smooth integrand, so it improves much faster than the trapezoidal rule as n grows. The page states the weights so the printed number can be reproduced by hand.

What to Expect

Best for

  • A high-accuracy estimate with modest n
  • Checking a Simpson's-rule exercise
  • Seeing why an even n is required

Not ideal for

  • An odd number of intervals
  • An adaptive tolerance guarantee
  • Integrands with a singularity inside the interval

What this tool keeps

  • n, h, the weight pattern and the estimate

What may need cleanup

  • Round to the precision the O(h^4) error supports

Common errors

  • An odd n is refused with the even-number requirement
  • n below 2 is refused

Example use cases

  • Estimate x^2 on [0, 1] with n = 100
  • Compare n = 10 and n = 100

Sample input

x^2

Sample output

Simpson's rule for x^2 on [0, 1] with n = 100: 0.333333333333 h = 0.01; n is even and the weights are 1, 4, 2, 4, …, 1

Who this is for

  • Students learning numerical integration
  • Readers checking a Simpson table

Frequently asked questions

Why must n be even?

Simpson's rule fits a parabola through three consecutive grid points, which covers two subintervals at a time. An odd n would leave one subinterval unpaired, so the page refuses it rather than inventing a weight for the leftover.

Why is a quadratic exact?

On each pair of subintervals the rule replaces the integrand with the parabola through the three sample points. A quadratic already equals that parabola, so the area is exact for any even n.

How is this better than the trapezoidal rule?

For a smooth function the error order is h to the fourth rather than h squared, so halving h cuts the error by about sixteen. That is why the same n usually gives a much closer estimate.

Is anything uploaded?

Nothing is uploaded. The samples and weighted sum are computed in this browser tab with JavaScript, and reloading the page discards the input and the estimate.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.