Numerical Differentiation and Integration: Lecture Notes #07, Study notes of Mathematics

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

Typology: Study notes

Pre 2010

Uploaded on 03/28/2010

koofers-user-4sj
koofers-user-4sj 🇺🇸

10 documents

1 / 13

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)
Numerical Differentiation
Richardson’s Extrapolation
Numerical Integration (Quadrature)
Outline
1Numerical Differentiation
Ideas and Fundamental Tools
Moving Along...
2Richardson’s Extrapolation
A Nice Piece of “Algebra Magic”
Homework #6 Preliminary Version
3Numerical Integration (Quadrature)
The “Why?” and Introduction
Trapezoidal & Simpson’s Rules
Newton-Cotes Formulas
Homework #6 Final Version
Peter Blomgren, h[email protected]i
x; Richardson’s Extrapolation; Rf(x)dx (2/51)
Numerical Differentiation
Richardson’s Extrapolation
Numerical Integration (Quadrature)
Ideas and Fundamental Tools
Moving Along...
Numerical Differentiation: The Big Picture
The goal of numerical differentiation is to compute an accurate
approximation to the derivative(s) of a function.
Given measurements {fi}n
i=0 of the underlying function f(x) at the
node values {xi}n
i=0, our task is to estimate f(x) (and, later,
higher derivatives) in the same nodes.
The strategy: Fit a polynomial to a cleverly selected subset of the
nodes, and use the derivative of that polynomial as
the approximation of the derivative.
Peter Blomgren, h[email protected]i
x; Richardson’s Extrapolation; Rf(x)dx (3/51)
Numerical Differentiation
Richardson’s Extrapolation
Numerical Integration (Quadrature)
Ideas and Fundamental Tools
Moving Along...
Numerical Differentiation
Definition (Derivative as a limit)
The derivative of fat x0is
f(x0) = lim
h0
f(x0+h)f(x0)
h.
The obvious approximation is to fix h“small” and compute
f(x0)f(x0+h)f(x0)
h.
Problems: Cancellation and roundoff errors. For small values
of h,f(x0+h)f(x0) so the difference may have very
few significant digits in finite precision arithmetic.
smaller hnot necessarily better numerically.
Peter Blomgren, h[email protected]i
x; Richardson’s Extrapolation; Rf(x)dx (4/51)
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Numerical Differentiation and Integration: Lecture Notes #07 and more Study notes Mathematics in PDF only on Docsity!

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature) Numerical Analysis and Computing^ Lecture Notes #07— Numerical Differentiation and Integration —

Differentiation; Richardson’s Extrapolation; Integration

Peter Blomgren, 〈[email protected]

Department of Mathematics and Statistics

Dynamical Systems GroupComputational Sciences Research Center San Diego State UniversitySan Diego, CA 92182-7720 http://terminus.sdsu.edu/^ Fall 2009 Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (1/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical 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 Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (2/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Numerical Differentiation: The Big Picture^ The goal of numerical differentiation is to compute an accurateapproximation to the derivative(s) of a function.^ Given

measurements

n {f}i i=^ of the underlying function

f^ (x) at the

node values

n {x}i i= , our task is to estimate

′ f(x) (and, later,

higher derivatives) in the same nodes. The strategy:

Fit a polynomial to a cleverly selected subset of thenodes, and use the derivative of that polynomial asthe approximation of the derivative. Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (3/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Numerical Differentiation^ Definition (Derivative as a limit)^ The derivative of

f^ at^ x^0

is ′ f (x) = lim^0

f^ (x^0 h→ 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 valuesof^ h,^ f

(x+h)^0 ≈^ f^ (x) so the difference may have very^0 few^ significant digits

in finite precision arithmetic. ⇒^ smaller

h^ not necessarily better numerically. Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (4/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Main Tools for Numerical Differentiation

1 of 2

In the discussion on Numerical Differentiation (and laterIntegration) we will rely on our old friend (nemesis?) — the Taylorexpansions... Theorem (Taylor’s Theorem) Suppose f

n ∈ C [a

(n+1), b], f ∃^ on^ [a,^ b], and x

∈^ [a,^ b 0 ]. Then

∀x^ ∈^ (a,

b),^ ∃ξ(x

)^ ∈^ (min(

x,^ x),^ max(^0

x,^ x))^ with^0

f^ (x) =^ P

(x) +^ Rn

(x)^ wheren nX P(x) =n k= (k) f (x)^0 (x^ k!^

k^ − x),^ R 0

(nf (^) (x) = (^) n +1)(ξ(x))( (n^ + 1)!^

(n+1)x − x) 0 .

P(x)^ is then

Taylor polynomial of degree

n, and

R(x)^ is then

remainder term

(truncation error).

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (5/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Main Tools for Numerical Differentiation

2 of 2

Our second tool for building Differentiation and Integrationschemes are the

Lagrange Coefficients^ Ln,

(x) =k

n∏^ x^ − j=0,j^6 =k

xj x−^ xk j

Recall:^

L(x) is then,k^

nth degree polynomial which is 1 in

xandk^

0 in the other nodes (

x,^ j^6 =^ kj^

Previously we have used the family

L(x),n,^0

L(x),n,^1

...^ ,^ Ln,

(x) ton

build the

Lagrange interpolating polynomial.

— A good tool for

discussing polynomial behavior, but not necessarily for computingpolynomial values (

c.f.^ Newton’s divided differences). Now, lets combine our tools and look at differentiation.^ Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (6/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Getting an Error Estimate — Taylor Expansion^ f^ (x

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

[ (^1) = f^ h (x) +^ hf^0

′ (x) +^0

(^2) h′′f^ (ξ(x 2 ))^ −^ f^ (x

] ) 0

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

′′If f (ξ(x )) is bounded,

i.e. ′′ |f (ξ(x))

|^ <^ M,^

∀ξ(x)^ ∈^

(x,^ x+^00

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^

−^16 ≈ 10

, not taken into account).

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (7/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Using Higher Degree Polynomials to get Better Accuracy^ Suppose

{x,^ x,... ,^01

x}^ are distinct points in an intervaln

I, and

n+1 f ∈ C (I), we can write^ n∑ f (x) =^ k=

f^ (x)Lk^ n,

(x)k ︸^ ︷︷

Lagrange Interp. Poly.

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

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

︷︷^

Error Term

Formal differentiation of this expression gives:′^ f^ (x)^

n∑=^ f k=

′ (x)Lk n,k

d(x) + dx [ ∏n(k=

]x − x)k (^) (n + 1)! (n+1) f (ξ (x))

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

[ d(n+1)^ f^ dx

] (ξ(x))^.

Note:^ When we evaluate

′ f (x)^ at the node pointsj^

(x) the last termj^

gives no contribution. (

⇒^ we don’t have to worry about it...)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (8/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Example: 3-point Formulas, III/III^  

′ f (x) =^0 1 [−^3 f^ (x 2 h^

) + 4f^ (x 0

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

(^2) h(3))] + f^3 (ξ)^0

′∗ f(x) =^0

1 ∗[−f(x^0 2h^

−^ h) +^ f

∗(x+^ h)] 0

(^2) h(^3 ) − f 6 (ξ)^1

′+ f (x) =^0

[ 1 + f^ (x^02 h −^2 h)^ −

  • 4 f (x− 0 h) + 3f^ (

]^ h+x)+^0 2 (3)f^ (ξ)^23

After the substitution

x+^ h^ →^0

∗ xin the second equation, and 0

x+ 2h^ →^0

  • xin the third equation. 0 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

∗+ ,...

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (13/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

3-point Formulas: Illustration

Centered Formula

−2^ −1.^

−1^ −0.^

0 0.^

1 1.^

2

(^10) −1 −2 −3 −4 −5 −6 −7^1 ′ f (x) =^02 h [−f^ (x^0 −^ h) +^ f (x+^ h)]^0

(^2) h(3) − f^6 (ξ)^1

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (14/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

3-point Formulas: Illustration

Forward Formula

−2^ −1.^

−1^ −0.^

0 0.^

1 1.^

2

(^10) −1 −2 −3 −4 −5 −6 − ′ f (x) =^0

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

f^ (x+^ h^0

)^ −^ f^ (x^0

  • 2h)] +

(^2) h(3) f^ (ξ 3

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (15/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

3-point Formulas: Illustration

Backward Formula

−2^ −1.^

−1^ −0.^

0 0.^

1 1.^

2

(^10) −1 −2 −3 −4 −5 −6 − ′ f (x) =^0

1 [f^ (x^02 h^ −^2 h)^ −

4 f^ (x−^0

h) + 3f^

h(x)] + (^0) 2 (3)f^ (ξ^23

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (16/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

5-point Formulas^ If we want even better approximations we can go to 4-point,5-point, 6-point, etc

...^ formulas. The most accurate (smallest error term) 5-point formula is:′^ f^ (

f^ (x) = (^0) x−^2 h)−^80 f^ (x−h)+8^0

f^ (x+h)−f^0

(x+2h)^0 12 h^

(^4) h(5)+ f^30 (ξ)

Sometimes (

e.g^ for end-point approximations like the clamped splines), we need one-sided formulas′ f^ (x) =^0

−^25 f^ (x)+48^0

f^ (x+h)−^0 36 f^ (x+2h^0

)+16f^ (x+3^0

h)−^3 f^ (x+4^0

h) 12 h^

(^4) h(5)+ f^ ( 5 ξ).

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (17/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

5-point Formulas: Illustration

Centered Formula

−2^ −1.^

−1^ −0.^

0 0.^

1 1.^

2

(^10) −1 −2 −3 −4 −5 −6 −7 f^ (x−′^0 f (x) =^0 2 h)−^8 f^ (x^0

−h)+8f^ (x

+h)−f^ (x 00 +2h) 12 h^

(^4) h(5)+ f^30 (ξ)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (18/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Higher Order Derivatives^ We can derive approximations for higher order derivatives in thesame way. — Fit a

kth degree polynomial to a cluster of points {x,^ f^ (xi^ i^

n+k+1)} i=n^ , and compute the appropriate derivative of the polynomial in the point of interest.The standard centered approximation of the second derivative isgiven by

′′ f (x) =^0

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

x) +^ f^ (^0

x−^ h)^0 (^2) h

(^2) + O(h)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (19/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

Ideas and Fundamental ToolsMoving Along...

Wrapping Up Numerical Differentiation^ We now have the tools to build high-order accurate approximationsto the derivative.We will use these tools and similar techniques in buildingintegration schemes in the following lectures.Also, these approximations are the backbone of finite differencemethods for numerical solution of differential equations (

see

Math 542

, and^ Math 693b

Next, we develop a general tool for combining low-order accurateapproximations (to derivatives, integrals, anything! (almost))... inorder to hierarchically constructing higher order approximations.^ Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (20/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

A Nice Piece of “Algebra Magic”Homework #6 – Preliminary Version

Building High Accuracy Approximations

IV/V

Now,^ M

−^ N(j+

h) =^ Ehj^

[ j^ α+ (1j^

(^1) − α) j j 2 ](^ +^ O^ h

)j+

We want to select

αso that the expression in the bracket is zero.j^ This gives^ α=^ j^

−^1 ,^ j^2 −^1

1 −^ α=j^

j (^2) j 2 −^1

j^ (2−^ =

    • 1=j 2 −^1

(^1 1) + j 2 −

Therefore,

N(h) =j+

N(h/2) +j^

N(h/2)j^ −^ N(h)j^ j 2 −^1

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (25/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

A Nice Piece of “Algebra Magic”Homework #6 – Preliminary Version

Building High Accuracy Approximations

V/V

The following table illustrates how we can use Richardson’sextrapolation to build a 5th order approximation, using five 1storder approximations:^ O^ (

h)^

()^2 O h

()^3 O h

()^4 O h

()^5 O h

N(h)^1 N(h/2)^1

N(h)^2 N(h/4)^1

N(h/2)^2

N(h)^3

N(h/8)^1

N(h/4)^2

N(h/^3

2)^ N(^4

h)

N(h/16)^1

N

(h/8)^2 N(h/4)^3

N(h/^4

2)^ N(^5

h)

↑^ Measurements

↑^

Extrapolations

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (26/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

A Nice Piece of “Algebra Magic”Homework #6 – Preliminary Version

Example (

c.f.^ slide#13, and slide#17) The centered difference formula approximating

′ f (x) can be expressed:^0

′ f (x) =^0 f^ (x^ +^ h)^

−^ f^ (x^ −^ h) 2 h ︸^

︷︷^

︸ N(h)^2

(^2) h′′′ − f^ ( 6 ξ) +^ O(h

4 ) ︸^ ︷︷

︸ error term

In order to eliminate the

(^2) hpart of the error, we let our new approximation be

N(h) =^3 N(h/2) +^2

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

N(2h)^3

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

f^ (x+h)−f^ + (x−h)f^ (x+2−^2 h

h)−f^ (x−^2 h)^4 h 3

8 f^ (x+ = h)−^8 f^ (x−h

)f^ (x+2−^6 h h)−f^ (x−^2 h

) 6 h

(^1) = [f 12h^ (x^ −^ 2h)^

−^ 8f(x^ −

h) +^ 8f(

x^ +^ h)^ −^

f(x^ +^ 2h)]

.

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (27/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

A Nice Piece of “Algebra Magic”Homework #6 – Preliminary Version

Example,

f^ (x) =^

2 x^ xe. x^ f(x) 1.70^ 15.8197 1.80^ 19.6009 1.90^ 24.1361 2.00^ 29.5562 2.10^ 36.0128 2.20^ 43.6811 2.30^ 52.

′ f (x) = (

(^2) x + x)e x^ , ′ f (2) = 8

(^2) e= 59.

f^ (2.1)−f^ (

.566. (Fwd Difference, 2pt) f^ (2.1)−f^ (

.384. (Ctr Difference, 3pt) f^ (2.2)−f^ (

.201. (Ctr Difference) (4∗^59.^384

−^60 .201)

  1. (Richardson)

f^ (1.8)−^8 f^ (1.9)+8f^ (

.1)−f^ (2.2) 1. 2

= 59.111. (5pt)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (28/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

A Nice Piece of “Algebra Magic”Homework #6 – Preliminary Version

Wrap-up / Homework #6 — Due Friday 11/6/2009, 12-noon^ We are going to use Richardson extrapolation in combination withsome of the simpler integration schemes we will develop in order togenerate general schemes for numerically computing integrals up tohigh order.^ Note:

In^ order

to^ use

Richardson

extrapolation,

we^ must

know the form of the error — hence finding error termsin our approximations turns out to have a very practical use. (Part-1) BF-4.1.5BF-4.1.27BF-4.2.9^ Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (29/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Integration: Introduction — The

“Why?”

After taking calculus, I thought I could differentiate and/orintegrate every function...Then came physics, mechanical engineering, etc...The need for numerical integration was painfully obvious!Sometimes (most of the time?), the anti-derivative is not availablein closed form.

∫^ f^ (x)^ dx

=^ F^

(x)^ + ︸ ︷︷^ ︸ Anti-Derivative

C

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (30/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Numerical Quadrature^ The basic idea is to replace integration by clever summation:

∫^ b^ f^ (x)a

dx^ →

n∑^ af,i^ i^ i=

where^ a^

≤^ x<^ x^0

<^ · · ·^ < 1

x≤^ b,^ n^

f=^ f^ (xi^

).i

The coefficients

aand the nodesi^

xare to be selected.i^

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (31/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Building Integration Schemes with Lagrange Polynomials^ Given the nodes

{x,^ x,... ,^01

x}^ we can use then

Lagrange

interpolating polynomial P(x) =n

n∑^ fL(i^ n,i^ i=

x),^ with error

E(x) =n

(n+1)f (

n∏ξ(x)) (n + 1)! i= (x−x)i^

to obtain

∫^ b^ f^ (x)a

∫ dx = b^ P(x)na

dx ︸^ ︷︷^

The Approximation

∫^ b +^ Ea (x)^ dxn ︸ ︷︷^ ︸ The Error Estimate

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (32/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Example #2a: Simpson’s Rule (sub-optimal error bound)^ Let^ x

=^ a,^ x 0 1

a+b= ,^2 x=^ b, let^2

b−a h = 2 and use the

quadratic

interpolating polynomial^ ∫^ b^ f^ (xa

∫^ )dx = [x 2 f^ (x)^0 x 0 (x^ −^ x)(^1

x^ −^ x)^2 (x−^ x^0 )(x−^ x^0

+^ f^ (x^1 )

(x^ −^ x) )(x^ −^ x 0

(x−^ x^1 )(x−^ x^1

+^ f^ (x)^2

(x^ −^ x)(^0

x^ −^ x)^1 (x−^ x^2 )(x−^ x^2

]^ dx) ∫^ x^2 ( +^ x^0 x^ −^ x)(^0 x^ −^ x)(^1

x^ −^ x)^2 f 6

(3) (ξ(x))

dx^ ...

∫^ b^ f(x)^ a

[ dx = h f(x) +^0

4f(x) +^1

] f(x) 2 + 3

4 (^3 O(hf )(ξ)).

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (37/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Example #2b: Simpson’s Rule (optimal error bound)^ The optimal error bound for Simpson’s rule can be obtained byTaylor expanding

f^ (x) about the mid-point

x:^1

f^ (x) =^ f^ (x) +^1

′ f (x)(x^ −^ x^11

′′f (x)^1 ) + (x^2

′′′f (^2) − x)+ (^1) (x)^13 (x^ −^ x)^16

(4)f (ξ(x)) + 24

(^4) (x − x) 1

Then formally integrating this expression^ "^ Z^ b^ f^ (x^1 a

′) + f (x)(x^ −^1

′′f (x)^1 x) + 12

(^2) (x − x)+^1 ′′′f (x)^1 (x^ −^6

(4)f (ξ (^3) x)+ (^1) (x))^4 (x^ −^ x)^124

#^ dx

After use of the weighted mean value theorem, and the theapproximation

′′ f (x) =^1

1 [f^ (x^2 0 h )^ −^2 f^ (x

) +^ f^ (x 1

(^2) h)] − f 212 (4) (ξ),

and a whole lot of algebra (see BF pp 189–190) we end up with^ ∫^ x^2 f^ (x)^ dx x 0

[^ f( = h x) +^ 4f^0

(x) +^ f^1

](x) 2 −^3 (^5) h(^4 )f(ξ 90

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (38/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Example #2: Simpson’s Rule^ ∫

b^ f(x)^ dxa

[^ f( = h x) +^ 4f^0

(x) +^ f(^1

x)^2 3

]^ +^ O(h

5 (^4 )f(ξ))

f(x) p(x) − Simpson’s Rule Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (39/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Integration Examples^ f^ (x)

[a,^ b]^

R^ bf^ (x)dx^ a^

Trapezoidal

Error

Simpson

Error

x^ [0,^ 1]^

1/^

0.^

0 0.

0

(^2) x[0,^ 1] 1/

0.5^ 0.

0

(^3) x[0,^ 1] 1/

0.5^ 0.

0

(^4) x[0,^ 1] 1/

0.5^ 0.

x^ e[0,^ 1] e^ −

1 1.

The Trapezoidal rule gives exact solutions for linear functions. —The error terms contains a second derivative.Simpson’s rule gives exact solutions for polynomials of degree lessthan 4. — The error term contains a fourth derivative.^ Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (40/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Degree of Accuracy (Precision)^ Definition (Degree of Accuracy)^ The^ Degree of Accuracy

, or^ precision

, of a quadrature formula is

the largest positive integer

n^ such that the formula is exact for

k x

∀k^ = 0,^ 1 ,... ,^ n. With this definition:

Scheme^

Degree of Accuracy Trapezoidal

Simpson’s

Trapezoidal and Simpson’s are examples of a class of methodsknown as

Newton-Cotes formulas

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (41/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Newton-Cotes Formulas — Two Types

Closed

Closed^

The (n^ + 1) point closed NCF uses nodes

x=^ xi^0

+^ ih,

i^ = 0,^1 ,... ,

n, where

x=^ a,^0

x=^ b^ andn^

h^ = (b−

a)/n. It

is called closed since the endpoints are included as nodes. Peter Blomgren,^ 〈[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (42/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Newton-Cotes Formulas — Two Types

Open

Open^

The (n^ + 1) point open NCF uses nodes

x=^ x^0 i^

+^ ih,

i^ = 0,^1 ,... ,

n^ where h^ = (b^ −

a)/(n^ + 2) and

x=^ a^ +^0

h,

x=^ b^ −n^

h. (We label

x=^ a−^1

,^ x=n+^

b.)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (43/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Closed Newton-Cotes Formulas^ The approximation is

∫^ b^ f^ (x) a

n∑ dx ≈ i= af^ (x),i^ i^

where

∫^ x a=i n^ L(x)n,i^ x 0

∫^ dx = nxn∏^ ( x 0 j = 0 j 6 =^ i x^ −^ x)j^ (x−^ x)^ i^ j^ dx.

Note:^

The Lagrange polynomial

L(x) models a function whichn,i^

takes the value 0 at all

x(j^6 =^ j^

i), and 1 at

x. Hence, thei^

coefficient

acaptures the integral of a function which is 1i^ in^ xand zero in the other node points.i^ Peter Blomgren,^ 〈[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (44/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Open Newton-Cotes Formulas — Examples^ n^ =

0 :^

2 hf^ (x) +^0

(^3) h′′ f^ (ξ) 3

n^ =^1 :^

[ 3 h^ f^ (x^02 ) +^ f^ (x^1

]^33 h)^ +^4

′′f (ξ)

n^ =^2 :^

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

) + 2f^ ( 1

]^14 x)^ + 2 (^5) h(4)f^ (ξ 45

n^ =^3 :^

[ 5 h^11 f^ ( 24 x) +^ f^ (^0

x) +^ f^ (^1 x) + 11^2

] f (x)^ + 3

(^595) h(4)f^144 (ξ)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (49/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Divide and Conquer!^ Say you want to compute:

∫^100 f^ (x^0

)^ dx.

Is it a Good Idea

TM^ to directly apply your favorite Newton-Cotes formula to this integral?!? No! With the closed 5-point NCF, we have

h^ = 25 and

(^5) h/^90 ∼

5 10 so

even with a bound on

(6) f (ξ) the error will be large. Better: Apply the closed 5-point NCF to the integrals

∫^ 4(i+1)^4 i

f^ (x)^ dx,^

i^ = 0,^1 ,... ,

then sum.

“Composite Numerical Integration.”

(next time)

Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (50/51)

Numerical DifferentiationRichardson’s ExtrapolationNumerical Integration (Quadrature)

The “Why?” and IntroductionTrapezoidal & Simpson’s RulesNewton-Cotes FormulasHomework #6 – Final Version

Homework #6 — Due Friday 11/6/2009, 12-noon^ (Part-1)^ BF-4.1.5BF-4.1.27BF-4.2.9^ (Part-2)^ BF-4.3.1-a,b.BF-4.3.5-a,b.^ Peter Blomgren,

[email protected]

∂〉 ; Richardson’s Extrapolation; ∂x^

R^ f^ (x)^ dx^

— (51/51)