Trapezoidal Rule - Maple Programming Help

Online Help

All Products    Maple    MapleSim

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

Trapezoidal 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

Trapezoidal Rule


Instead of using rectangles to approximate the area under the curve, trapezoids give a better approximation to the area.


The area of a trapezoid with base b and heights p and q is given by:

Area = b2p+q


To approximate the area under the curve, add up the area of all the trapezoids.


Area =12y0 + y1Δx  + 12y1 + y2Δx  + 12y2 + y3Δx ...


which can be simplified to become the trapezoidal rule:

Area  Δxy02 + y1+ y2 + y3+..+yn2 

Adjust the number of trapezoids used to approximate the  area under the curve.


yx = 

domain =

range =



n =

Example =

More MathApps