Docsity

Numerical Integration and Richardson Extrapolation: Problem Set 8 for Math 128A, Study notes of Calculus

Toggle sidebar
bg1
Math 128A Problem Set 8
Numerical Integration and Richardson Extrapolation
Adrian Down
March 25, 2006
Problem 1
Part a
Using Euler’s identity,
1
0
dx eıπx =
1
0
dx cos πx +ısin πx (1.a.1)
To find the integral of sin πx from 0 to 1, I take the imaginary part of (1.a.1).
Let ˜
Tbe the trapezoidal approximation of (1.a.1). Using the algorithm
for trapezoidal approximation with n+ 1 interior mesh points,
˜
T(h) = h
n+1
X
j=0
eıπjh −h
2e0+eıπh(n+1)
=h
n+1
X
j=0
eıπjh −h
2
: 0
(1 −1) (1.a.2)
The summation in (1.a.2) can be recast as a geometric series,
˜
T(h) = h
n+1
X
j=0 eıπhj
=h1−eıπh(n+2)
1−eıπ (1.a.3)
1
pf3
pf4
pf5
pf8

Partial preview of the text

Download Numerical Integration and Richardson Extrapolation: Problem Set 8 for Math 128A and more Study notes Calculus in PDF only on Docsity!

Math 128A Problem Set 8

Numerical Integration and Richardson Extrapolation

Adrian Down

March 25, 2006

Problem 1

Part a

Using Euler’s identity,  (^1)

0

dx eıπx^ =

0

dx cos πx + ı sin πx (1.a.1)

To find the integral of sin πx from 0 to 1, I take the imaginary part of (1.a.1). Let T˜ be the trapezoidal approximation of (1.a.1). Using the algorithm for trapezoidal approximation with n + 1 interior mesh points,

T˜ (h) = h

∑^ n+

j=

eıπjh^ − h 2

e^0 + eıπh(n+1)

= h

∑^ n+

j=

eıπjh^ − h 2  (1 − 1): 0 (1.a.2)

The summation in (1.a.2) can be recast as a geometric series,

T˜ (h) = h

n∑+

j=

eıπh

)j

= h

1 − eıπh(n+2) 1 − eıπ

(1.a.3)

I simplify the numerator of (1.a.3),

eıπh(n+2)^ = eıπ^ n n+2+

= eıπ^ · eıπh^ = −eıπh^ (1.a.4)

I substitute (1.a.4) into (1.a.3) and factor out a negative,

T˜ (h) = −h

eıπh^ + 1 eıπh^ − 1

= −h

eıπ^ h^2 + e−ıπ^ h^2 eıπ^ h 2 − e−ıπ^ h 2

h tanh ıπ h 2

(1.a.5)

The complex hyperbolic tangent is simply related to the trigonometric tangent,

tanh ıx = ı tan x (1.a.6)

I use (1.a.6) to simplify (1.a.5),

T˜ (h) = − h ı tan π h 2

ıh tan π h 2 = ıh cot π h 2 (1.a.7)

The desired trapezoidal approximation is found by taking the imaginary part of T˜ ,

T (h) = h cot π h 2 (1.a.8)

Part b

The Laurent series for cot x is,

cot x =

x

x 3

x^3 45 − O(x^5 ) (1.b.1)

I compute the difference in (2.b.1) using (1.b.2),

T (2h) =

π

π 6 h^2 − 16 π^3 360 h^4 + O(h^6 )

22 T (h) − T (2h) = 4

π

π 6 h^2 − π^3 360 h^4 + O(h^6 )

π

π 6 h^2 − 16 π^3 360 h^4 + O(h^6 )

π

π^3 360 h^4 + O(h^6 )

S(h) =

π

π^3 360 h^4 + O(h^6 ) (2.b.2)

The coefficient of h^4 in (2.b.2) is π 903.

Problem 3

Part a

I recast the given definition of a in terms of h = (^) n^1 ,

a =

2 h sin 2πh (3.a.1)

For small h, the sine function in (3.a.1) can be Taylor expanded about x = 0,

a =

2 h

(2πh) −

(2πh)^3 3!

(2πh)^5 5!

(2πh)^7 7!

  • O(h^9 )

= π −

π^3 h^2 +

π^5 h^4 −

π^7 h^6 + O(h^8 ) (3.a.2)

Part b

The series for a (3.a.2) shows that a approximates π with error terms that contain only even powers of h. Because the error terms contain only even powers of h, Richardson linear combinations of a(h) with differing step sizes

T (h) − 1 ↘ T

(h 2

−→ T 1 (h) = (^221) − 1

22 T

(h 2

− T (h)

− 1 ↘

− 1 ↘ T

(h 4

−→ T 1

(h 2

22 T

(h 2

− T (h)

−→ T 2 (h) = (^241) − 1

24 T 1

(h 2

− T 1 (h)

 = O(h^2 )  = O(h^4 )  = O(h^6 )

Table 1: Linear combinations used to form the Richardson approximation.  denotes the error of the approximation.

can be formed to eliminate error terms in (3.a.2) and obtain a better ap- proximation to π. To construct the Richardson linear combinations, I form a table of the form of table 1. I use the given formulation of n = 3 · 2 k. Note the correlation between k, n, and h,

k = 0 ⇒ n = 3 · 1 ⇒ h =

k = 1 ⇒ n = 3 · 2 ⇒ h =

k = 2 ⇒ n = 3 · 22 ⇒ h =

Thus I form the Richardson approximation table in table 2.

a

3

− 1 ↘ a

6

2 −→ a^1

3

− 1 ↘

− 1 ↘ a

12

2 −→ a^1

6

4 −→ a^2

3

Table 2: Richardson approximation to π using the area a of a regular polygon with n = (^) h^1 sides inscribed in a unit circle.

T (1) = 0. 75000000000000

− 1 ↘ T

2

2 −→ T 1 (1) = 0. 78333333333333 − 1 ↘

− 1 ↘ T

4

2 −→ T 1

2

4 −→ T 2 (1) = 0. 78552941176471

Table 3: Richardson approximation to π 4 using the integral of inverse tangent on x ∈ (0, 1), with n = (^) h^1 − 1 interior mesh points.

Problem 5

Part a

I form Dhf (x) using the given definition by Taylor expanding f (x ± h) about f (x),

f (x ± h) = f (x) ± f ′(x)h + f (2)(x) 2 h^2 ± f (3)(x) 3! h^3 + f (4)(x) 4! h^4 + O(h^5 ) (5.a.1)

Taking the difference f (x + h) − f (x − h), all of the terms that are even in h are of the same sign and are canceled, whereas the terms that are odd in h remain,

f (x + h) − f (x − h) = f ′(x) · 2 h + f (3)(x) 3!

· 2 h^3 + O(h^5 ) (5.a.2)

Dividing (5.a.2) by 2h,

Dhf (x) = f (x + h) − f (x − h) 2 h = f ′(x) + f (3)(x) 3! h^2 + O(h^4 ) (5.a.3)

D 2 hf (x) can be formed in the same way as (5.a.1), making Taylor ex- pansions about f (x). The result is that D 2 hf (x) is equal to (5.a.3) with h replaced by 2h,

D 2 hf (x) = f (x + 2h) − f (x − 2 h) 4 h = f ′(x) + f (3)(x) 3! 4 h^2 + O(h^4 ) (5.a.4)

The linear combination of Dhf (x) and D 2 hf (x) required to remove the O(h^4 ) term in the approximation to f ′(x) is the same as that used in Richard- son extrapolation,

1 22 − 1

22 Dhf (x) − D 2 hf (x)

[ (

4 f ′(x) + 



 4 f (3)(x) 3 h^2 + O(h^4 )

f ′(x) + 

 f (3)(x) 3 4 h^2 + O(h^4 )

) ]

3 f ′(x) + O(h^4 )

= f ′(x) + O(h^4 )

Part b

I form a Richardson approximation table, as in table 1.

d (1) = 0. 75000000000000 − 1 ↘ d

2

2 −→ d^1 (1) = 0. 69280904158206 − 1 ↘

− 1 ↘ d

4

2 −→ d^1

2

4 −→ d^2 (1) = 0. 69314742098093

Table 4: Richardson approximation to ln 2 using the derivative of 2x^ evalu- ated at x = 0.

The approximation to ln 2 obtained with the Richardson method and the discrepancy with the numerical value from MatLab is,

ln 2 − T 2 (1) = − 2. 404209848982930 × 10 −^7