Docsity

Error Approximations for Trapezoidal Integration: Estimating the Error Term, Exams of Earth Sciences

Toggle sidebar
bg1
Chapter 14
Trapezoidal integration
14.1 Error approximations for trapezoidal inte-
gration
Here we will illustrate how error estimates for the trapezoidal integration rule can
be estimated. Let us concentrate on the interval [xi−1xi] and let us carry out a
first manipulation of an integration by part:
δAi=Zxi
xi−1
f(x) dx(14.1)
=Zxi
xi−1
f(x) d x−xi−1
2
=hx−xi−1
2f(x)ixi
xi−1
−Zxi
xi−1x−xi−1
2f′(x) dx
=hxi−xi−1
2f(xi)−xi−1−xi−1
2f(xi−1)i−Zxi
xi−1x−xi−1
2f′(x) dx
=∆x
2fi−−∆x
2fi−1−Zxi
xi−1x−xi−1
2f′(x) dx
= ∆xfi−1+fi
2
| {z }
δ˜
Ai
−Zxi
xi−1x−xi−1
2f′(x) dx
|{z }
δEi
(14.2)
The first term on the right hand side of 14.2, δ˜
Ai, is clearly the trapezoidal formula
for the interval [xi−1xi], and the second term is nothing but the error term, referred
to as δEiif the trapezoidal formula is used to approximate the error in that interval.
What we need to do know is to find a way to bound this error term in terms of the
numerical parameters and the features of the function to be integrated. We will
illustrate that in two ways.
103
pf3
pf4
pf5

Partial preview of the text

Download Error Approximations for Trapezoidal Integration: Estimating the Error Term and more Exams Earth Sciences in PDF only on Docsity!

Chapter 14

Trapezoidal integration

14.1 Error approximations for trapezoidal inte-

gration

Here we will illustrate how error estimates for the trapezoidal integration rule can be estimated. Let us concentrate on the interval [xi− 1 xi] and let us carry out a first manipulation of an integration by part:

δAi =

∫ (^) xi

xi− 1

f (x) dx (14.1)

∫ (^) xi

xi− 1

f (x) d

( x − xi− (^12)

)

[( x − xi− (^12)

) f (x)

]xi xi− 1 −

∫ (^) xi

xi− 1

( x − xi− (^12)

) f ′(x) dx

[( xi − xi− (^12)

) f (xi) −

( xi− 1 − xi− (^12)

) f (xi− 1 )

] −

∫ (^) xi

xi− 1

( x − xi− (^12)

) f ′(x) dx

[ ∆x 2

fi −

−∆x 2

fi− 1

] −

∫ (^) xi

xi− 1

( x − xi− (^12)

) f ′(x) dx

= ∆x

fi− 1 + fi ︸ ︷︷ 2 ︸ δ A˜i

∫ (^) xi

xi− 1

( x − xi− (^12)

) f ′(x) dx ︸ ︷︷ ︸ δEi

The first term on the right hand side of 14.2, δ A˜i, is clearly the trapezoidal formula for the interval [xi− 1 xi], and the second term is nothing but the error term, referred to as δEi if the trapezoidal formula is used to approximate the error in that interval. What we need to do know is to find a way to bound this error term in terms of the numerical parameters and the features of the function to be integrated. We will illustrate that in two ways.

104 CHAPTER 14. TRAPEZOIDAL INTEGRATION

14.1.1 Integration by parts

The integration by parts stratagem can be used again to get:

δEi = −

∫ (^) xi

xi− 1

( x − xi− (^12)

) f ′(x) dx

∫ (^) xi

xi− 1

f ′(x) d

  

( x − xi− (^12)

) 2

+ B

  

[ ∆x^2 8

+ B

] [f ′(xi) − f ′(xi− 1 )] +

∫ (^) xi

xi− 1

 

( x − xi− (^12)

) 2

+ B

  f ′′(x) dx

where B is an integration constant and f ′′(x) is the second derivative of the function f. Clearly these integration by parts can be done only if the derivatives of f up to second order exist. The optimal choice of B that would knock-off the first term if B = −∆x^2 /8, that term would then vanish and would not contribute to the error estimate. And we are left with the following estimate for the magnitude of the error:

|δEi| =

∣∣ ∣∣ ∣∣ ∣

∫ (^) xi

xi− 1

 

( x − xi− 1 2

) 2

∆x^2 8

  f ′′(x) dx

∣∣ ∣∣ ∣∣ ∣

∫ (^) xi

xi− 1

∣∣ ∣∣ ∣∣ ∣

( x − xi− (^12)

) 2

∆x^2 8

∣∣ ∣∣ ∣∣ ∣

|f ′′(x)| dx

∫ (^) xi

xi− 1

∣∣ ∣∣ ∣∣ ∣

( x − xi− (^12)

) 2

∆x^2 8

∣∣ ∣∣ ∣∣ ∣

max xi− 1 ≤x≤xi |f ′′(x)| dx

∫ (^) xi

xi− 1

∣∣ ∣∣ ∣∣ ∣

( x − xi− (^12)

) 2

∆x^2 8

∣∣ ∣∣ ∣∣ ∣

dx max xi− 1 ≤x≤xi |f ′′(x)| (14.3)

where maxxi− 1 ≤x≤xi |f ′′(x)| is the maximum magnitude of the second derivative over the interval [xi− 1 xi]. What remains to be done is to estimate the quadratic term. It is easy to see that the quadratic polynomial vanishes at xi− 1 and xi and reaches a minimum of −∆x^2 /8 at xi− 12 ; thus it is entirely negative in that region, and we have: ∫ (^) xi

xi− 1

∣∣ ∣∣ ∣∣ ∣

( x − xi− 1 2

) 2

∆x^2 8

∣∣ ∣∣ ∣∣ ∣

dx =

∆x^3 12

The error estimate is thus:

|δEi| ≤

∆x^3 12

max xi− 1 ≤x≤xi |f ′′(x)| (14.5)

106 CHAPTER 14. TRAPEZOIDAL INTEGRATION

of the numerical user. Clearly the larger the interval and/or the curvature of the function, the larger the error grows. The only numerical parameter at our disposal is the number of interval, N. Several aspects of this parameter should be noted. First N appears in the denominator, and hence the error bounds is guaranteed to decay to zero as the number of intervals is increased. Second, the error decays to zero as the second power of N, N−^2 , that is we should expect a decrease of the error by a factor of 4 if the number of interval is doubled to 2N; this is referred to as quadratic or second order convergence. Third, for this estimate to hold (for the analysis to be valid) the maximum curvature on the interval [a b] must be finite.

14.1.2 Taylor Series

A few more facts about the errors behavior can be revealed by following a slightly different tack in estimating the error, namely that all error terms are dependent on negative even powers of N. This has implication with respect to improving on the basic of the trapezoidal rule using Richardson extrapolation. The starting point here is to expand the derivative, f ′(x) in a Taylor series about xi− 12 ,

f ′(x) =

df dx

∣∣ ∣∣ ∣i− 1 2

( x − xi− (^12)

) (^) d^2 f dx^2

∣∣ ∣∣ ∣i− 1 2

( x − xi− (^12)

) 2

d^3 f dx^3

∣∣ ∣∣ ∣i− 1 2

( x − xi− (^12)

)n

n!

dn+1f dxn+

∣∣ ∣∣ ∣i− 1 2

+ · · · + RM +1 (14.10)

RM +1 =

( x − xi− (^12)

)M +

(M + 1)!

dM^ +2f dxM^ +

∣∣ ∣∣ ∣ ξ

where the derivative in the remainder term RM +1 is evaluated at an undetermined point ξ in the interval [xi− 1 xi]. Notice that the remainder has the same form as the other term except that the derivative in it is evaluated at an unknown location ξ. The integral of the function f can now be done via its Taylor approximation. Since the derivatives are evaluated at the fixed mid-point of the interval they can be pulled out of the integrand to get:

δEi =

∫ (^) xi

xi− 1

( x − x 1 2

) f ′(x) dx

∑^ M

n=

  1 n!

∫ (^) xi

xi− 1

( x − xi− (^12)

)n+ dx

dn+1f dxn+

∣∣ ∣∣ ∣i− 1 2

  (^) +

∫ (^) xi

xi− 1

RM +1 dx(14.12)

We are thus simply required to integrate powers of (x − xi− 12 ). It is easy to show

14.1. ERROR APPROXIMATIONS FOR TRAPEZOIDAL INTEGRATION 107

that

∫ (^) xi

xi− 1

(x − xi− 12 )n+1^ dx =

 

(x − xi− 12 )n+ n + 2

 

xi

xi− 1

=

(xi − xi− 12 )n+2^ − (xi− 1 − xi− 12 )n+ n + 2

( ∆x 2

)n+ −

( −∆ 2 x

)n+

n + 2

  

0 if n is even ∆xn+ 2 n+1(n + 2)

if n is odd

Hence all the odd powers drop out of the summation and only the even powers remain.

δEi =

∑^ N

n=1, 3 , 5 ,...

  1 n!

∆xn+ 2 n+1(n + 2)

dn+1f dxn+

∣∣ ∣∣ ∣ i− (^12)

  (^) +

∫ (^) xi

xi− 1

RN +1 dx

∆x^3 12

d^2 f dx^2

∣∣ ∣∣ ∣ i− (^12)

∆x^5 480

d^4 f dx^4

∣∣ ∣∣ ∣ i− (^12)

∆x^7 53760

d^6 f dx^6

∣∣ ∣∣ ∣ i− (^12)

(2M − 1)!

∆x^2 M^ + 22 M^ (2M + 1)

d^2 M^ f dx^2 M

∣∣ ∣∣ ∣ξ^ (14.13)

where we have changed notation slightly to indicate that only even derivatives of f survive. The leading term in the above series is nothing but the error bounds derived previously in equation 14.5. The estimate for the total error can now be obtained by summing over all intervals to get:

EN =

∆x^3 12

∑^ N

i=

d^2 f dx^2

∣∣ ∣∣ ∣ i− (^12)

∆x^5 480

∑^ N

i=

d^4 f dx^4

∣∣ ∣∣ ∣ i− 21

∆x^7 53760

∑^ N

i=

d^6 f dx^6

∣∣ ∣∣ ∣ i− (^12)

Although the series involve odd powers of ∆x, one should not forget the influence of the individual sums which also increase as ∆x decreases (or N increases). If one introduces the average of the derivative at the mid-points of the interval, namely 〈 d^2 mf dx^2 m

〉

N

∑^ N

i=

d^2 mf dx^2 m

∣∣ ∣∣ ∣ i− (^12)

The series in the error term can thus be written as:

EN =

(b − a)^2 12 N^2

〈 d^2 f dx^2

〉

(b − a)^4 480 N^4

〈 d^4 f dx^4

〉

(b − a)^6 53760 N^6

〈 d^6 f dx^6

〉

  • · · · (14.16)

If the calculations are repeated with different number of intervals, say 2N and 4 N the series expansion of the integral takes the form:

E 2 N =

(b − a)^2 12(2N)^2

〈 d^2 f dx^2

〉

(b − a)^4 480(2N)^4

〈 d^4 f dx^4

〉

(b − a)^6 53760(2N)^6

〈 d^6 f dx^6

〉

  • (14.17)· · ·