Notes on Numerical Analysis and Computing - Lecture notes 7 | MATH 541, Study notes of Mathematics

Material Type: Notes; Class: INTRO NUM ANALYS & COMPUT; Subject: Mathematics; University: San Diego State University; Term: Fall 2002;

Typology: Study notes

Pre 2010

Uploaded on 03/28/2010

koofers-user-1da
koofers-user-1da 🇺🇸

10 documents

1 / 77

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Numerical Differentiation
Richardson’s Extrapolation
Numerical Integration (Quadrature)
Numerical Analysis and Computing
Lecture Notes #07
Numerical Differentiation and Integration
Differentiation; Richardson’s Extrapolation; Integration
Peter Blomgren,
Department of Mathematics and Statistics
Dynamical Systems Group
Computational Sciences Research Center
San Diego State University
San Diego, CA 92182-7720
http://terminus.sdsu.edu/
Fall 2009
Peter Blomgren, h[email protected]i
x; Richardson’s Extrapolation; Rf(x)dx (1/51)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d

Partial preview of the text

Download Notes on Numerical Analysis and Computing - Lecture notes 7 | MATH 541 and more Study notes Mathematics in PDF only on Docsity!

Richardson’s Extrapolation Numerical Integration (Quadrature)

Numerical Analysis and Computing

Lecture Notes # — Numerical Differentiation and Integration — Differentiation; Richardson’s Extrapolation; Integration

Peter Blomgren, 〈[email protected]

Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center San Diego State University San Diego, CA 92182- http://terminus.sdsu.edu/

Fall 2009

Richardson’s Extrapolation Numerical Integration (Quadrature)

Outline

(^1) Numerical Differentiation Ideas and Fundamental Tools Moving Along...

(^2) Richardson’s Extrapolation A Nice Piece of “Algebra Magic” Homework #6 – Preliminary Version

3 Numerical Integration (Quadrature) The “Why?” and Introduction Trapezoidal & Simpson’s Rules Newton-Cotes Formulas Homework #6 – Final Version

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Numerical Differentiation

Definition (Derivative as a limit) The derivative of f at x 0 is

f ′(x 0 ) = lim h→ 0

f (x 0 + h) − f (x 0 ) h

The obvious approximation is to fix h “small” and compute

f ′(x 0 ) ≈

f (x 0 + h) − f (x 0 ) h

Problems: Cancellation and roundoff errors. — For small values of h, f (x 0 +h) ≈ f (x 0 ) so the difference may have very few significant digits in finite precision arithmetic. ⇒ smaller h not necessarily better numerically.

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Main Tools for Numerical Differentiation 1 of 2

In the discussion on Numerical Differentiation (and later Integration) we will rely on our old friend (nemesis?) — the Taylor expansions...

Theorem (Taylor’s Theorem) Suppose f ∈ C n[a, b], f (n+1)∃ on [a, b], and x 0 ∈ [a, b]. Then ∀x ∈ (a, b), ∃ξ(x) ∈ (min(x 0 , x), max(x 0 , x)) with f (x) = Pn(x) + Rn(x) where

Pn(x) =

X^ n k=

f (k)(x 0 ) k! (x^ −^ x^0 )

k (^) , Rn(x) = f^ (n+1)(ξ(x)) (n + 1)! (x^ −^ x^0 )

(n+1).

Pn(x) is the Taylor polynomial of degree n, and Rn(x) is the remainder term (truncation error).

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Getting an Error Estimate — Taylor Expansion

f (x 0 + h) − f (x 0 ) h

= (^1) h

[

f (x 0 ) + hf ′(x 0 ) + h

2 2 f^

′′(ξ(x)) − f (x 0 )

]

= f ′(x 0 ) + h 2 f′′(ξ(x))

If f ′′(ξ(x)) is bounded, i.e.

|f ′′(ξ(x))| < M, ∀ξ(x) ∈ (x 0 , x 0 + h)

then we have

f ′(x 0 ) ≈

f (x 0 + h) − f (x 0 ) h

, with an error less than

M|h| 2

This is the approximation error. (Roundoff error, ∼ ǫmach ≈ 10 −^16 , not taken into account).

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Using Higher Degree Polynomials to get Better Accuracy

Suppose {x 0 , x 1 ,... , xn} are distinct points in an interval I, and f ∈ C n+1(I), we can write

f (x) =

∑^ n

k=

f (xk )Ln,k (x) ︸ ︷︷ ︸ Lagrange Interp. Poly.

∏n k=0(x^ −^ xk^ ) (n + 1)!

f (n+1)(ξ(x)) ︸ ︷︷ ︸ Error Term

Formal differentiation of this expression gives:

f ′(x) =

∑^ n

k=

f (xk )L′ n,k (x) +

d dx

[ ∏n k=0(x^ −^ xk^ ) (n + 1)!

]

f (n+1)(ξ(x))

∏n k=0(x^ −^ xk^ ) (n + 1)!

d dx

[

f (n+1)(ξ(x))

]

Note: When we evaluate f ′(xj ) at the node points (xj ) the last term gives no contribution. (⇒ we don’t have to worry about it...)

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

The (n + 1) point formula for approximating f ′(xj )

Putting it all together yields what is known as the (n + 1) point formula for approximating f ′(xj ):

f ′(xj ) =

∑^ n

k=

f (xk )L′ n,k (xj ) +

f (n+1)(ξ) (n + 1)!

∏^ n

k = 0 k 6 = j

(xj − xk )

Note: The formula is most useful when the node points are equally spaced (it can be computed once and stored), i.e. xk = x 0 + kh.

Now, we have to compute the derivatives of the Lagrange coefficients, i.e. Ln,k (x)... [We can no longer dodge this task!]

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Example: 3-point Formulas, I/III

Building blocks:

L 2 , 0 (x) =

(x − x 1 )(x − x 2 ) (x 0 − x 1 )(x 0 − x 2 )

, L′ 2 , 0 (x) =

2 x − x 1 − x 2 (x 0 − x 1 )(x 0 − x 2 )

L 2 , 1 (x) =

(x − x 0 )(x − x 2 ) (x 1 − x 0 )(x 1 − x 2 )

, L′ 2 , 1 (x) =

2 x − x 0 − x 2 (x 1 − x 0 )(x 1 − x 2 )

L 2 , 2 (x) =

(x − x 0 )(x − x 1 ) (x 2 − x 0 )(x 2 − x 1 )

, L′ 2 , 2 (x) =

2 x − x 0 − x 1 (x 2 − x 0 )(x 2 − x 1 )

Formulas:

f ′(xj ) = f (x 0 )

[

2 xj − x 1 − x 2 (x 0 − x 1 )(x 0 − x 2 )

]

  • f (x 1 )

[

2 xj − x 0 − x 2 (x 1 − x 0 )(x 1 − x 2 )

]

  • f (x 2 )

[

2 xj − x 0 − x 1 (x 2 − x 0 )(x 2 − x 1 )

]

f (3)(ξj ) 6

∏^2

k = 0 k 6 = j

(xj − xk ).

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Example: 3-point Formulas, II/III

When the points are equally spaced...       

f ′(x 0 ) =

1 2 h

[− 3 f (x 0 ) + 4f (x 1 ) − f (x 2 )] +

h^2 3

f (3)(ξ 0 )

f ′(x 1 ) =

1 2 h

[−f (x 0 ) + f (x 2 )] −

h^2 6

f (3)(ξ 1 )

f ′(x 2 ) =

1 2 h

[f (x 0 ) − 4 f (x 1 ) + 3f (x 2 )] +

h^2 3

f (3)(ξ 2 )

Use x 0 as the reference point — xk = x 0 + kh:       

f ′(x 0 ) = 1 2 h

[− 3 f (x 0 ) + 4f (x 0 + h) − f (x 0 + 2h)] + h

2 3

f (3)(ξ 0 )

f ′(x 0 + h) =

1 2 h

[−f (x 0 ) + f (x 0 + 2h)] −

h^2 6

f (3)(ξ 1 )

f ′(x 0 + 2h) = 1 2 h

[f (x 0 ) − 4 f (x 0 + h) + 3f (x 0 + 2h)] + h

2 3

f (3)(ξ 2 )

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Example: 3-point Formulas, III/III

   

  

f ′(x 0 ) = 1 2 h

[− 3 f (x 0 ) + 4f (x 0 + h) − f (x 0 + 2h)] + h

2 3

f (3)(ξ 0 )

f ′(x 0 + h) =

1 2 h

[−f (x 0 ) + f (x 0 + 2h)] −

h^2 6

f (3)(ξ 1 )

f ′(x 0 + 2h) = 1 2 h

[f (x 0 ) − 4 f (x 0 + h) + 3f (x 0 + 2h)] + h

2 3

f (3)(ξ 2 )

Make the substitution x 0 + h → x 0 ∗ in the second equation.

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Example: 3-point Formulas, III/III

   

  

f ′(x 0 ) =

1 2 h

[− 3 f (x 0 ) + 4f (x 0 + h) − f (x 0 + 2h)] +

h^2 3

f (3)(ξ 0 )

f ′(x 0 ∗ ) = 1 2 h

[−f (x 0 ∗ − h) + f (x 0 ∗ + h)] − h

2 6

f (3)(ξ 1 )

f ′(x 0 + ) =

1 2 h

[ f (x 0 + − 2 h) − 4 f (x 0 + − h) + 3f (x 0 + )

]

h^2 3

f (3)(ξ 2 )

After the substitution x 0 + h → x 0 ∗ in the second equation, and x 0 + 2h → x 0 + in the third equation.

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

Example: 3-point Formulas, III/III

   

  

f ′(x 0 ) =

1 2 h

[− 3 f (x 0 ) + 4f (x 0 + h) − f (x 0 + 2h)] +

h^2 3

f (3)(ξ 0 )

f′(x∗ 0 ) = 1 2h

[−f(x∗ 0 − h) + f(x∗ 0 + h)] − h

2 6

f(^3 )(ξ 1 )

f ′(x 0 + ) =

1 2 h

[ f (x 0 + − 2 h) − 4 f (x 0 + − h) + 3f (x 0 + )

]

h^2 3

f (3)(ξ 2 )

After the substitution x 0 + h → x 0 ∗ in the second equation, and x 0 + 2h → x 0 + in the third equation. Note#1: The third equation can be obtained from the first one by setting h → −h. Note#2: The error is smallest in the second equation. Note#3: The second equation is a two-sided approximation, the first and third one- sided approximations. Note#4: We can drop the superscripts ∗,+...

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

3-point Formulas: Illustration Forward Formula

−7 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2

0

1

f ′(x 0 ) =

2 h

[− 3 f (x 0 ) + 4f (x 0 + h) − f (x 0 + 2h)] +

h^2 3

f (3)(ξ 0 )

Richardson’s Extrapolation Numerical Integration (Quadrature)

Ideas and Fundamental Tools Moving Along...

3-point Formulas: Illustration Backward Formula

−7 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2

0

1

f ′(x 0 ) =

2 h

[f (x 0 − 2 h) − 4 f (x 0 − h) + 3f (x 0 )] +

h^2 3

f (3)(ξ 2 )