Module for the Trapezoidal Rule for Numerical Integration

Check out the new Numerical Analysis Projects page.

 

Theorem  (Trapezoidal Rule)  Consider [Graphics:Images/TrapezoidalRuleMod_gr_1.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_2.gif], where [Graphics:Images/TrapezoidalRuleMod_gr_3.gif]. The trapezoidal rule is  

    
[Graphics:Images/TrapezoidalRuleMod_gr_4.gif].  

This is an numerical approximation to the integral of [Graphics:Images/TrapezoidalRuleMod_gr_5.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_6.gif] and we write  

    
[Graphics:Images/TrapezoidalRuleMod_gr_7.gif].  

Proof.

 

Composite Trapezoidal Rule

    An intuitive method of finding the area under a curve y = f(x)  is by approximating that area with a series of trapezoids that lie above the intervals  [Graphics:Images/TrapezoidalRuleMod_gr_38.gif].  When several trapezoids are used, we call it the composite trapezoidal rule.  

Theorem  (Composite Trapezoidal Rule)  Consider [Graphics:Images/TrapezoidalRuleMod_gr_39.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_40.gif].  Suppose that the interval [Graphics:Images/TrapezoidalRuleMod_gr_41.gif] is subdivided into  m  subintervals  [Graphics:Images/TrapezoidalRuleMod_gr_42.gif]  of equal width  [Graphics:Images/TrapezoidalRuleMod_gr_43.gif]  by using the equally spaced nodes  [Graphics:Images/TrapezoidalRuleMod_gr_44.gif]  for  [Graphics:Images/TrapezoidalRuleMod_gr_45.gif].   The composite trapezoidal rule for m subintervals is  

    
[Graphics:Images/TrapezoidalRuleMod_gr_46.gif].  

This is an numerical approximation to the integral of [Graphics:Images/TrapezoidalRuleMod_gr_47.gif] over [Graphics:Images/TrapezoidalRuleMod_gr_48.gif] and we write  

    
[Graphics:Images/TrapezoidalRuleMod_gr_49.gif].  

 

Animations (Trapezoidal Rule  Trapezoidal Rule).  Internet hyperlinks to animations.

 

Algorithm Composite Trapezoidal Rule.  To approximate the integral  

    [Graphics:Images/TrapezoidalRuleMod_gr_50.gif][Graphics:Images/TrapezoidalRuleMod_gr_51.gif][Graphics:Images/TrapezoidalRuleMod_gr_52.gif],  

by sampling [Graphics:Images/TrapezoidalRuleMod_gr_53.gif] at the [Graphics:Images/TrapezoidalRuleMod_gr_54.gif] equally spaced points  [Graphics:Images/TrapezoidalRuleMod_gr_55.gif]  for  [Graphics:Images/TrapezoidalRuleMod_gr_56.gif],  where  [Graphics:Images/TrapezoidalRuleMod_gr_57.gif].  Notice that  [Graphics:Images/TrapezoidalRuleMod_gr_58.gif]  and  [Graphics:Images/TrapezoidalRuleMod_gr_59.gif].  

Mathematica Subroutine (Trapezoidal Rule).

[Graphics:Images/TrapezoidalRuleMod_gr_60.gif]

Or you can use the traditional program.

Mathematica Subroutine (Trapezoidal Rule).

[Graphics:Images/TrapezoidalRuleMod_gr_61.gif]

Example 1.  Numerically approximate the integral [Graphics:Images/TrapezoidalRuleMod_gr_62.gif] by using the trapezoidal rule with  m = 1, 2, 4, 8, and 16  subintervals.

Solution 1.

 

Example 2.  Numerically approximate the integral [Graphics:Images/TrapezoidalRuleMod_gr_79.gif] by using the trapezoidal rule with  m = 50, 100, 200, 400  and 800  subintervals.

Solution 2.

 

Example 3.  Find the analytic value of the integral  [Graphics:Images/TrapezoidalRuleMod_gr_96.gif]  (i.e. find the "true value").   

Solution 3.

 

Example 4.  Use the "true value" in example 3 and find the error for the trapezoidal rule approximations in example 2.  

Solution 4.

 

Remainder term for the Composite Trapezoidal Rule

Corollary  (Trapezoidal Rule: Remainder term)  Suppose that [Graphics:Images/TrapezoidalRuleMod_gr_113.gif] is subdivided into  m  subintervals  [Graphics:Images/TrapezoidalRuleMod_gr_114.gif]  of width  [Graphics:Images/TrapezoidalRuleMod_gr_115.gif].   The composite trapezoidal rule  

    
[Graphics:Images/TrapezoidalRuleMod_gr_116.gif]  

is an numerical approximation to the integral, and  

    
[Graphics:Images/TrapezoidalRuleMod_gr_117.gif].  

Furthermore, if [Graphics:Images/TrapezoidalRuleMod_gr_118.gif],  then there exists a value  c  with  a < c < b  so that the remainder term  [Graphics:Images/TrapezoidalRuleMod_gr_119.gif]  has the form

    [Graphics:Images/TrapezoidalRuleMod_gr_120.gif].  

This is expressed using the "big [Graphics:Images/TrapezoidalRuleMod_gr_121.gif]" notation  [Graphics:Images/TrapezoidalRuleMod_gr_122.gif].  

Recursive Integration Rules

Theorem (Successive Trapezoidal Rules)  Suppose that  [Graphics:Images/TrapezoidalRuleMod_gr_123.gif]  and the points  [Graphics:Images/TrapezoidalRuleMod_gr_124.gif]  subdivide [Graphics:Images/TrapezoidalRuleMod_gr_125.gif] into  [Graphics:Images/TrapezoidalRuleMod_gr_126.gif]  subintervals equal width  [Graphics:Images/TrapezoidalRuleMod_gr_127.gif].  The trapezoidal rules [Graphics:Images/TrapezoidalRuleMod_gr_128.gif] obey the relationship  

    
[Graphics:Images/TrapezoidalRuleMod_gr_129.gif][Graphics:Images/TrapezoidalRuleMod_gr_130.gif].  

Definition (Sequence of Trapezoidal Rules)  Define  [Graphics:Images/TrapezoidalRuleMod_gr_131.gif],  which is the trapezoidal rule with step size  [Graphics:Images/TrapezoidalRuleMod_gr_132.gif].  Then for each  [Graphics:Images/TrapezoidalRuleMod_gr_133.gif]  define  [Graphics:Images/TrapezoidalRuleMod_gr_134.gif]  is the trapezoidal rule with step size  [Graphics:Images/TrapezoidalRuleMod_gr_135.gif].  

Corollary (Recursive Trapezoidal Rule)  Start with  [Graphics:Images/TrapezoidalRuleMod_gr_136.gif].  Then a sequence of trapezoidal rules  [Graphics:Images/TrapezoidalRuleMod_gr_137.gif]  is generated by the recursive formula  

    
[Graphics:Images/TrapezoidalRuleMod_gr_138.gif]  for  [Graphics:Images/TrapezoidalRuleMod_gr_139.gif].  

where  [Graphics:Images/TrapezoidalRuleMod_gr_140.gif].  

The recursive trapezoidal rule is used for the Romberg integration algorithm.

 

Research Experience for Undergraduates

Trapezoidal Rule for Numerical Integration  Trapezoidal Rule for Numerical Integration  Internet hyperlinks to web sites and a bibliography of articles.  

  

Downloads (Trapezoidal Rule Trapezoidal Rule).  Download this Mathematica notebook.  

 

  

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2003