Paritian

Mathematics

Numerical Integration Calculator

The area under a curve by the trapezium, midpoint and Simpson rules, with each one's error measured.

Results

The same by Simpson's rule 0.333333333333
T trapezium · M midpoint · S Simpson: value, then how far it is off T 0.3350000000 0.0016666667 M 0.3325000000 -0.0008333333 S 0.3333333333 0
By the trapezium rule 0.335000000000
By the midpoint rule 0.332500000000
Reference, over two thousand strips 0.333333333333
How far Simpson is off -1.11022e-16
How far the trapezium rule is off 0.00166666666667
How far the midpoint rule is off -0.00083333333333
Width of each strip 0.1000000000
How the page read it x^2

What this tool does

When an integral has no closed form — and most do not — the area has to be measured rather than derived. All three classical methods do the same thing: chop the interval into strips and approximate each one with something simple. The trapezium rule uses a straight line between the ends, the midpoint rule a flat line through the centre, and Simpson a parabola through three points. This page runs all three over the same strips and measures how far each lands from a much finer reference, so the difference between them is something you can see rather than be told.

Formula

h = (b − a) ÷ n · T = h(f₀÷2 + f₁ + … + fₙ÷2) · M = h Σ f(xᵢ + h÷2) · S = (h÷3)(f₀ + 4f₁ + 2f₂ + … + fₙ)

Variables

SymbolMeaningUnit
exprThe function f(x)
lowerFrom
upperTo
piecesHow many strips
SPThe same by Simpson's rule
TBT trapezium · M midpoint · S Simpson: value, then how far it is off
TZBy the trapezium rule
MDBy the midpoint rule
RFReference, over two thousand strips
ESHow far Simpson is off
ETHow far the trapezium rule is off
EMHow far the midpoint rule is off
WDWidth of each strip
INHow the page read it

Worked example

  • The function f(x)x^2
  • From0
  • To1
  • How many strips10
  • The same by Simpson's rule0.333333333333
  • T trapezium · M midpoint · S Simpson: value, then how far it is offT 0.3350000000 0.0016666667 M 0.3325000000 -0.0008333333 S 0.3333333333 0
  • By the trapezium rule0.335000000000
  • By the midpoint rule0.332500000000
  • Reference, over two thousand strips0.333333333333
  • How far Simpson is off-1.11022e-16
  • How far the trapezium rule is off0.00166666666667
  • How far the midpoint rule is off-0.00083333333333
  • Width of each strip0.1000000000
  • How the page read itx^2

Limitations

  • The calculation runs entirely in your browser. The values you type are never sent to a server.
  • The result is an estimate based only on the values you type. Real situations often include factors this calculator does not know about.

Frequently asked questions

Why is Simpson so much better?

Because it fits parabolas where the other two fit straight lines. The trapezium rule joins the endpoints of each strip with a chord, the midpoint rule uses a flat line through the middle, and both are wrong by an amount proportional to the width squared. Simpson fits a curve through three points and is wrong by an amount proportional to the width to the fourth power — so halving the strip width cuts its error by sixteen rather than four. Compare the three errors in the table: on a smooth function Simpson is usually thousands of times closer for the same work.

What is the reference value?

The same integral computed by Simpson's rule over two thousand strips, which for any ordinary function is far closer to the truth than the number of strips you chose. It is there so the three errors shown are real measurements rather than guesses. It is not the exact answer — nothing numerical is — but on a smooth function it is typically right to eleven or twelve digits, which is enough to judge the others by.