Docsity

Richardson's Extrapolation: Approximating Second Derivatives, Summaries of Mathematics

Partial preview of the text

Download Richardson's Extrapolation: Approximating Second Derivatives and more Summaries Mathematics in PDF only on Docsity!

Richardson’s Extrapolation

Tim Chartier and Anne Greenbaum

Department of Mathematics @

Winter 2008

Approximating the Second Derivative

From last time, we derived that:

f ′′( x ) ≈ f ( x + h ) − 2 f ( x ) + f ( x − h ) h^2 the truncation error is O ( h^2 ). Further, rounding error analysis predicts rounding errors of size about ǫ/ h^2. Therefore, the smallest total error occurs when h is about ǫ^1 /^4 and then the truncation error and the rounding error are each about

ǫ. With machine precision ǫ ≈ 10 −^16 , this means that h should not be taken to be less than about 10−^4.

Rounding errors in action

This MATLAB code produces the following table:

h Abs. Error

1.0e-001 7.2e- 1.0e-002 7.2e- 1.0e-003 7.2e- 1.0e-004 3.2e- 1.0e-005 3.7e- 1.0e-006 5.1e-

Your Turn

Download the code secondDeriv.m from the course web page. Edit the code such that it approximates the second derivative of f ( x ) = x^3 − 2 ∗ x^2 + x at the point x = 1. Again, let your initial h = 0 .1. After running the code change x from x = 1 to x = 1000. What do you notice?

Recognizing Error Behavior

Last time we also saw that Taylor Series of f about the point x and evaluated at x + h and x − h leads to the central difference formula:

f ′( x ) = f ( x + h ) − f ( x − h ) 2 h

h^2 6

f ′′′( x 0 ) − h^4 120

f (^5 )( x 0 ) − · · ·.

This formula describes precisely how the error behaves. This information can be exploited to improve the quality of the numerical solution without ever knowing f ′′′, f (^5 ),.. .. Recall that we have a O ( h^2 ) approximation.

Exploiting Knowledge of Higher Order Terms

Let us rewrite this in the following form:

f ′( x 0 ) = N ( h ) −

h^2 6 f ′′′( x 0 ) −

h^4 120 f (^5 )( x 0 ) − · · · ,

where N ( h ) = f^ ( x + h ) 2 − hf^ ( x − h ). The key of the process is to now replace h by h /2 in this formula.

Complete this step:

A Higher Order Method

Thus,

f ′( x 0 ) = N

h 2

N ( h / 2 ) − N ( h ) 3

h^4 160 f (^5 )( x 0 ) + · · ·

is a O ( h^4 ) formula. Notice what we have done. We took two O ( h^2 ) approximations and created a O ( h^4 ) approximation. We did require, however, that we have functional evaluations at h and h /2.

Further observations

Again, we have the O ( h^4 ) approximation:

f ′( x 0 ) = N

h 2

N ( h / 2 ) − N ( h ) 3

h^4 160

f (^5 )( x 0 ) + · · ·.

This approximation requires roughly twice as much work as the second order centered difference formula. However, but the truncation error now decreases much faster with h. Moreover, the rounding error can be expected to be on the order of ǫ/ h , as it was for the centered difference formula, so the greatest accuracy will be achieved for h^4 ≈ ǫ/ h , or, h ≈ ǫ^1 /^5 , and then the error will be about ǫ^4 /^5.

Example

Consider f ( x ) = x exp( x ) with x 0 = 2 .0 and h = 0 .2. Use the central difference formula to the first derivative and Richardson’s Extrapolation to give an approximation of order O ( h^4 ).

Recall N ( h ) = f ( x + h ) − f ( x − h ) 2 h

Therefore, N ( 0. 2 ) = 22 .414160. What do we evaluate next?

N ( ) =

We find N ( h / 2 ) = N ( 0. 1 ) = 22. 228786.

Example cont.

Therefore, our higher order approximation is

Richardson’s Extrapolation

This process is known as Richardson’s Extrapolation. More generally, assume we have a formula N ( h ) that approximates an unknown value M and that M − N ( h ) = K 1 h + K 2 h^2 + K 3 h^3 + · · · , for some unknown constants K 1 , K 2 , K 3 ,.. .. Note that in this example, the truncation error is O ( h ). Without knowing K 1 , K 2 , K 3 ,... it is possible to produce a higher order approximation as seen in our previous example. Note, we could use our result from the previous example to produce an approximation of order O ( h^6 ). To understand this statement more, let us look at an example.

Example from numerical integration

The following data gives approximations to the integral

M =

∫ (^) π

0

sin xdx.

N 1 ( h ) = 1. 570796 , N 1

h 2

= 1. 896119 , N 1

h 4

Assuming M = N 1 ( h ) + K 1 h^2 + K 2 h^4 + K 3 h^6 + K 4 h^8 + O ( h^10 ) construct an extrapolation table to determine an order six approximation. Solution As before, we evaluate our series at h and h /2 and get:

M = N 1 ( h ) + K 1 h^2 + K 2 h^4 + K 3 h^6 + K 4 h^8 + O ( h^10 ), and

M = N 1 ( h / 2 ) + K 1

h^2 4

+ K 2

h^4 16

+ K 3

h^6 64

+ K 4

h^8 256

  • O ( h^10 )

Example Continued^2

Again, M = N 2 ( h ) + K h ˆ^4 + K ˆ 3 h^6. Therefore, M = N 2

h 2

K ˆ 2 h^4 + 1 64 K 3 h^6 , which leads to:

16 M = 16 N 2

h 2

  • K ˆ 2 h^4 + 14 K ˆ 3 h^6 + · · · − M = − N 2 ( h ) − K ˆ 2 h^4 − K ˆ 3 h^6 + · · · 15 M = 16 N 2

h 2

− N 2 ( h ) + O ( h^6 )

Hence, M = N 2

h 2

N 2 ( h 2 )− N 2 ( h ) 15 +^ O ( h

Example Continued^3

In terms of a table, we find:

Given N 1

h 2

+ N^1 (^

h 2 )− N^1 ( h ) 3 N^2

h 2

+ N^2 (^

h 2 )− N^2 ( h ) 15 N 1 ( h ) = 1. 570796 N 1

h 2

= 1. 896119 N 2 ( h ) = 2. 004560 N 1

h 4

= 1. 974242 N 2

h 2

In the chapter on numerical integration, we see that this is the basis of a Romberg integration.