Docsity

Euler's Method: Numerical Solutions to Ordinary Differential Equations - Prof. P. Blomgren, Study notes of Mathematics

Partial preview of the text

Download Euler's Method: Numerical Solutions to Ordinary Differential Equations - Prof. P. Blomgren and more Study notes Mathematics in PDF only on Docsity!

Euler’s Method

Improving Euler’s Method

Numerical Solutions to Differential Equations

Lecture Notes #3 — Euler’s Method

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/

Spring 2009

Euler’s Method

Improving Euler’s Method

Outline

(^1) Euler’s Method

Example

Quantifiable Properties

Derivation, and Basic Analysis

2 Improving Euler’s Method

Taylor Series Methods

Multi-Point Methods

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Euler’s Method — Example, y

′ = y + 2t − 1; y (0) = 1

Exact Solution: y (t) = 2e

t − 2 t − 1

Euler’s method on the interval [0, 1], with

h ∈ { 1 / 2 , 1 / 4 , 1 / 8 , 1 / 16 }.

0 0.2 0.4 (^) 0.6 0.8 1

1

2

Exact Solution h=1/ h=1/ h=1/ h=1/

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Euler’s Method — Things to Quantify

Accuracy:

We have seen that the quality of the numerical solution

depends on the step size h.

Some of the concepts we need to define in order to analyze

numerical methods for ODEs:

Consistency:

Is the numerical scheme solving the right problem?

Stability:

Is the numerical scheme robust with respect to propagation

of round-off errors?

Convergence:

Do we get the right numerical solution as h → 0???

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Consistency

Euler’s method

y i+ = y i

  • h f (t i

is consistent with the differential equation

y

′ (t) = f (t)

since the Local Truncation Error satisfies

lim

h→ 0

LTE

Euler (h) = lim

h→ 0

h

y

′′ (ξ i

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Accuracy

A method is said to be of order p if

lim

h→ 0

LTE(h)

h

p

≤ C

and

lim

h→ 0

LTE(h)

h

p+ǫ

= ±∞, ǫ > 0.

Since LTE Euler (h) =

h

y

′′ (ξ i ), p Euler

Euler’s Method is a first order method.

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Region of Stability

−2 −

Euler’s method is stable only if |1 + hλ| ≤ 1. That is, hλ must be

inside the disk of radius 1, centered at −1 in the complex plane.

If λ is real hλ must be in the interval [− 2 , 0]

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Stability: Example

Consider the ODE (exact solution y (t) = e

− 20 t )

y

′ (t) = − 20 y (t), y (0) = 1

Since λ = −20, we must have h < 0 .1 for stability...

0 0.2 0.4 0.6 0.8 1

0

Exact Solution h=0.

0 0.2 0.4 0.6 0.8 1

0

Exact Solution h=0.

0 0.2 0.4 0.6 0.8 1

0

Exact Solution h=0.

0 0.2 0.4 0.6 0.8 1

0

2

Exact Solution h=0.

h = 0. 001 h = 0. 05 h = 0. 11 h = 0. 11

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Summary: Key Concepts Introduced

Local Truncation Error, LTE(h)

The local error introduced by the discretization.

Accuracy

The order of accuracy is the largest integer p such that

lim

h→ 0

LTE(h)

h

p

≤ C

Consistency

A method is consistent if

lim

h→ 0

LTE(h) = 0

Euler’s Method

Improving Euler’s Method

Example

Quantifiable Properties Derivation, and Basic Analysis

Summary: Key Concepts Introduced, II

Stability

A scheme is unstable if it produces exponentially growing

solutions for a problem for which the exact solution is bounded.

Usually stability introduces restrictions on the step size h.

Region of Stability

The range of hλ for which the selected method is stable.

Convergence

The numerical solution converges to the exact solution if the

scheme is Consistent and Stable.

Euler’s Method

Improving Euler’s Method

Taylor Series Methods

Multi-Point Methods

Beyond Euler’s Method

Euler’s method is easy to implement, but...

The step-size h must be very small to achieve an acceptable

level of accuracy (locally, the LTE).

If we are solving over a long time period [0, T ] with small

step-size, the method is expensive (requires many iterations)

and slow.

Local errors accumulate. The LTE ∼ O(h) but we need ∼ 1 /h

iterations, in order to compute up to a fixed final time T.

This could mean trouble?

Euler’s Method

Improving Euler’s Method

Taylor Series Methods

Multi-Point Methods

Back to the Drawing Board — More Taylor Series...

Our first improvement of Euler’s method is to keep more terms in

the Taylor expansion

y (t i+

n ∑

k=

h

k

k!

y

(k) (t i

h

n+

(n + 1)!

y

(n+1) (ξ i ), ξ i ∈ [t i , t i+

]

The last term is the remainder term which corresponds to the

local truncation error. Recall that for Euler’s method we set

n = 1, and ignored higher order terms.

From the differential equation

y

′ (t) = f (t, y ), y (t 0 ) = y 0

we can get expressions for higher order derivatives of y with the

help of the chain rule.

Euler’s Method

Improving Euler’s Method

Taylor Series Methods

Multi-Point Methods

Example: Higher Order Taylor Series Methods, I

We consider

y

′ (t) = y (t) + 2t − 1 , y (0) = 1.

We get

f (t, y ) = y + 2t − 1

f

′ (t, y ) = 2 + 1 · (y + 2t − 1) = y + 2t + 1

f

′′ (t, y ) = 2 + 1 · (y + 2t − 1) = y + 2t + 1

f

(n) (t, y ) = y + 2t + 1

Euler’s Method

Improving Euler’s Method

Taylor Series Methods

Multi-Point Methods

Example: Higher Order Taylor Series Methods, II

0 0.2 0.4 0.6 0.8 1

1e-

1e-

1e-

1e-

1st order

2nd order

3rd order 4th order

Figure: The error (on a logarithmic scale) for 1st, 2nd, 3rd and 4th

order Taylor methods applied to y

′ = y + 2t − 1 , y (0) = 1 on the

interval [0, 1] with step size h = 0.1.