You are on page 1of 36

Review Initial Value Problems Euler’s Method Summary

T HE E ULER M ETHOD

P.V. Johnson

School of Mathematics

Semester 1 2008
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

E RRORS

Be careful when interpreting results from a computer


Errors can arise in all sorts of places
Using Taylor Series to approximate a differential
Truncation errors
Review Initial Value Problems Euler’s Method Summary

E RRORS

Be careful when interpreting results from a computer


Errors can arise in all sorts of places
Using Taylor Series to approximate a differential
Truncation errors
Review Initial Value Problems Euler’s Method Summary

E ULER ’ S M ETHOD

Initial value problems for ODEs


Solving ODEs numerically
Euler’s Method
Truncation errors again
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

T HE I NITIAL VALUE P ROBLEM

Here we will look at the solution of ordinary differential


equations of the type, say

dy
= f (x, y ), a≤x ≤b
dx
subject to an initial condition

y (a) = α
Review Initial Value Problems Euler’s Method Summary

T HE I NITIAL VALUE P ROBLEM

Here we will look at the solution of ordinary differential


equations of the type, say

dy
= f (x, y ), a≤x ≤b
dx
subject to an initial condition

y (a) = α
Review Initial Value Problems Euler’s Method Summary

E XAMPLES

C ONSIDER THE PROBLEM :


dy ³ y´
=y 1− , x ≥0
dx 4
with the initial condition
y (0) = 1

What can we say about the solution?


How can we go about solving it?
Review Initial Value Problems Euler’s Method Summary

E XAMPLES

C ONSIDER THE PROBLEM :


dy ³ y´
=y 1− , x ≥0
dx 4
with the initial condition
y (0) = 1

What can we say about the solution?


How can we go about solving it?
Review Initial Value Problems Euler’s Method Summary

E XTENSION TO H IGHER O RDER ODE S

We normally would like to solve higher order ODEs


We can do this by rearranging them as a system of first
order ODEs
E XAMPLE
y ′′ − 2xyy ′ + y 2 = 1, y (1) = 1, y ′ (1) = 2.

The equivalent first order system is:

(y1 (x), y2 (x))T = (y (x), y ′ (x))T ,


f1 (x, y1 , y2 ) = y2 (x),
f2 (x, y1 , y2 ) = 1 + 2xy1 (x)y2 (x) − y12 (x),

and initial condition

(y1 (1), y2 (1))T = (1, 2)T .


Review Initial Value Problems Euler’s Method Summary

E XTENSION TO H IGHER O RDER ODE S

We normally would like to solve higher order ODEs


We can do this by rearranging them as a system of first
order ODEs
E XAMPLE
y ′′ − 2xyy ′ + y 2 = 1, y (1) = 1, y ′ (1) = 2.

The equivalent first order system is:

(y1 (x), y2 (x))T = (y (x), y ′ (x))T ,


f1 (x, y1 , y2 ) = y2 (x),
f2 (x, y1 , y2 ) = 1 + 2xy1 (x)y2 (x) − y12 (x),

and initial condition

(y1 (1), y2 (1))T = (1, 2)T .


Review Initial Value Problems Euler’s Method Summary

E XTENSION TO H IGHER O RDER ODE S

We normally would like to solve higher order ODEs


We can do this by rearranging them as a system of first
order ODEs
E XAMPLE
y ′′ − 2xyy ′ + y 2 = 1, y (1) = 1, y ′ (1) = 2.

The equivalent first order system is:

(y1 (x), y2 (x))T = (y (x), y ′ (x))T ,


f1 (x, y1 , y2 ) = y2 (x),
f2 (x, y1 , y2 ) = 1 + 2xy1 (x)y2 (x) − y12 (x),

and initial condition

(y1 (1), y2 (1))T = (1, 2)T .


Review Initial Value Problems Euler’s Method Summary

G ENERAL S YSTEM OF F IRST O RDER ODE S

The general system can be written

dY
= F (x, Y ), a ≤ x ≤ b,
dx
where

Y = (y1 (x), y2 (x), ..., yn (x))T ,


F = (f1 (x, Y ), f2 (x, Y ), ..., fn (x, Y ))T ,

with initial data


Y (a) = α,
α = (α1 , α2 , ..., αn )T .
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

W ELL -P OSED P ROBLEMS

D EFINITION :
An initial value problem is said to be well-posed if:
A unique solution, y (x), to the problem exists;
The associated perturbed problem has a unique solution
and is sufficiently close to the original solution

How do we go about showing this for a general problem?


What do we mean by a perturbed problem?
With a computer, we are always solving the perturbed
problem
First, we need to know about the Lipschitz condition
Review Initial Value Problems Euler’s Method Summary

W ELL -P OSED P ROBLEMS

D EFINITION :
An initial value problem is said to be well-posed if:
A unique solution, y (x), to the problem exists;
The associated perturbed problem has a unique solution
and is sufficiently close to the original solution

How do we go about showing this for a general problem?


What do we mean by a perturbed problem?
With a computer, we are always solving the perturbed
problem
First, we need to know about the Lipschitz condition
Review Initial Value Problems Euler’s Method Summary

W ELL -P OSED P ROBLEMS

D EFINITION :
An initial value problem is said to be well-posed if:
A unique solution, y (x), to the problem exists;
The associated perturbed problem has a unique solution
and is sufficiently close to the original solution

How do we go about showing this for a general problem?


What do we mean by a perturbed problem?
With a computer, we are always solving the perturbed
problem
First, we need to know about the Lipschitz condition
Review Initial Value Problems Euler’s Method Summary

T HE L IPSCHITZ C ONDITION

D EFINITION :
A function is said to satisfy the Lipschitz condition in the
variable y on a set D ⊂ R2 if a constant L > 0 exists such that:

|f (x, y1 ) − f (x, y2 )| ≤ L|y1 − y2 |

whenever (x, y1 ), (x, y2 ) ∈ D. The constant L is called the


Lipschitz constant for f .
Review Initial Value Problems Euler’s Method Summary

P ERTURBED P ROBLEM

T HE P ERTURBED P ROBLEM
Let δ(x) be a pertubation to the problem so that δ(x) < ǫ for any
ǫ > 0, then
dz
= f (x, z) + δ(x), a ≤ x ≤ b, z(a) = α + ǫ0
dx
and the solution z(x) exists with

|z(x) − y (x)| < k (ǫ)ǫ for all a ≤ x ≤ b,

for some constant k (ǫ).


Review Initial Value Problems Euler’s Method Summary

T HE T HEORY

T HEOREM
Suppose D = {(x, y )|a ≤ x ≤ b and − ∞ < y < ∞}. If f is
continuous and satisfies a Lipschitz condition in the variable y
on the set D, then the initial-value problem

dy
= f (x, y ), a ≤ x ≤ b, y (a) = α
dx
is well-posed.
Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

S OLVING AN I NITIAL VALUE P ROBLEM

The simplest method to solve an ODE is the Euler method


In order to solve, we must discretise the problem – make a
continuous (infinite) problem discrete (finite)
Divide up the interval [a, b] into n equally spaced intervals
h
a b

x0 x1 x2 ... xi ... xn
Review Initial Value Problems Euler’s Method Summary

S OLVING AN I NITIAL VALUE P ROBLEM

Suppose y (x) is the unique solution to the ODE, and is


twice differentiable
Apply a Taylor series approximation around xi then we
have

1
y (xi+1 ) = y (xi ) + y ′ (xi )h + y ′′ (ξ)
2
where xi ≤ ξ ≤ xi+1 .
Review Initial Value Problems Euler’s Method Summary

S OLVING AN I NITIAL VALUE P ROBLEM

Suppose y (x) is the unique solution to the ODE, and is


twice differentiable
Apply a Taylor series approximation around xi then we
have

1
y (xi+1 ) = y (xi ) + f (xi , y (xi ))h + y ′′ (ξ)
2
where xi ≤ ξ ≤ xi+1 .

Since y is a solution to the ODE, we can replace y ′ by the


function f (x, y )
Review Initial Value Problems Euler’s Method Summary

T HE E ULER M ETHOD

Assume wi is our approximation to y at xi , then


w0 = α

Then to find all subsequent values of w,set the remainder


to zero in the previous equation to obtain:

wi+1 = wi + hf (xi , wi ), for each i = 0, 1, . . . , n − 1


Review Initial Value Problems Euler’s Method Summary

O UTLINE

1 R EVIEW

2 I NITIAL VALUE P ROBLEMS


The Problem
Posing a Problem

3 E ULER ’ S M ETHOD
Method
Errors

4 S UMMARY
Review Initial Value Problems Euler’s Method Summary

T RUNCATION E RRORS

We would like to be able to compare the errors for different


methods
We can use the local truncation error – difference between
equation and the approximation
For the Euler method we have:

yi+1 − (yi + hf (xi , yi ))


τi+1 (h) =
h
yi+1 − yi
= − f (xi , yi )
h
Review Initial Value Problems Euler’s Method Summary

T RUNCATION E RRORS

We would like to be able to compare the errors for different


methods
We can use the local truncation error – difference between
equation and the approximation
For the Euler method we have:

yi+1 − (yi + hf (xi , yi ))


τi+1 (h) =
h
yi+1 − yi
= − f (xi , yi )
h
Review Initial Value Problems Euler’s Method Summary

T RUNCATION E RRORS

We can calculate the truncation error as

h ′′
τi+1 (h) = y (ξi ),
2
and if y ′′ is bounded by the constant M on the interval
[a, b] then

h
|τi+1 (h)| ≤ M.
2
Hence the truncation error is O(h).
A method with truncation error O(hp ) is called an order p
method
Review Initial Value Problems Euler’s Method Summary

T RUNCATION E RRORS

We can calculate the truncation error as

h ′′
τi+1 (h) = y (ξi ),
2
and if y ′′ is bounded by the constant M on the interval
[a, b] then

h
|τi+1 (h)| ≤ M.
2
Hence the truncation error is O(h).
A method with truncation error O(hp ) is called an order p
method
Review Initial Value Problems Euler’s Method Summary

T RUNCATION E RRORS

We can calculate the truncation error as

h ′′
τi+1 (h) = y (ξi ),
2
and if y ′′ is bounded by the constant M on the interval
[a, b] then

h
|τi+1 (h)| ≤ M.
2
Hence the truncation error is O(h).
A method with truncation error O(hp ) is called an order p
method
Review Initial Value Problems Euler’s Method Summary

S UMMARY

Need Lipschitz condition to say a problem is well Posed


Problems
Euler’s Method is a first order method
wi+1 = wi + hf (xi , wi ), for each i = 0, 1, . . . , n − 1

Truncation errors give a quick estimate of error bounds on


the problem

You might also like