Simpson's Rule - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Math Apps : Calculus : Integral : MathApps/SimpsonsRule

Simpson's Rule

Main Concept


The integral of a function fx between the points a and b is denoted by


abfx dx


and can be roughly described as the area below the graph of y=fx and above the x-axis, minus any area above the graph and below the x-axis, and all taken between the points a and b.

The integral is important because it is an antiderivative for the original function, that is, if

gt=atfx dx




Riemann sum

A Riemann sum is an approximation to the integral, that is, an approximation using rectangles to the area mentioned above. The line segment from x=a to x=b is split into n subsegments which form the bases of these rectangles, and the corresponding heights are determined by the value of fxi at some point xi between the endpoints of the subsegment. The division of the segment a,b into subsegments is called a partition. For the sake of convenience we will assume here that the subsegments are of equal width, although this is not strictly necessary.


The Riemann Sum is then given by the general formula:


i=1n fxi ban


There are five main types of Riemann Sums, depending on which point xi is chosen to determine the height:



Right Sum: the right endpoint of the subsegment


Left Sum: the left endpoint of the subsegment


Middle Sum: the point half way between the left and right endpoints


Lower Sum: any point xi such that fxi is minimal


Upper Sum: any point xi such that fxi is maximal

Simpson's Rule

Instead of approximating the area under a curve using rectangles or trapezoids, parabolas can be used to approximate each part of a curve.


Let us compute the area under a parabola of the equation  y = ax2 + bx + c  passing through the three points h,y0,0,y1, h,y2:

A  =

 hhax2+ bx+c  dx


ax33 + bx22+cx|x = h ..h


2ah33 + 2ch



As the points h,y0,0,y1, h,y2 are on the parabola, we have:

 y0 =

 ah2 bh + c

y1 =


y2 =

 ah2 + bh +c


y0 +4y1 + y2 =

ah2 bh + c+ 4c + ah2 + bh +c


 2ah2 + 6 c

Therefore, the area under a parabola can be written as:


h3y0 +4y1 + y2 


Δx 3y0 +4y1 + y2 

Hence by adding all the areas under each parabolic arc using three points we can derive:

abfxdx =  Δx 3y0 +4y1 + y2  + Δx 3y2+4y3 + y4  +...+Δx 3yn2+4yn1 + yn 


The above equation can be simplified into Simpson's rule:

abfxdx   Δx3 y0+ 4 y1 +2 y2+4 y3+2 y4+4 y5+..+4 yn1+yn


Adjust the size (n) of the partition used to approximate the area under the curve. Since two subsegments of the partition are used for each parabola, there will be n2 parabolas used.


yx = 

domain =

range =



n =

Example =

More MathApps