Professional Documents
Culture Documents
Differential
Equations
Ordinary Differential Equations
• Example:
x – independent variable
dy
kx y – dependent variable
dx
First order ODE, dependent variable
y ' kx function of one independent variable
• Other examples:
Pendulum: Vibrating mass on spring:
l ' ' g sin 0 my ' 'ky 0
• ODEs can be used to “model” behavior
• Higher order ODEs can always be expressed as 1st order
y ' f( x, y )
Numerical Solution of ODE
Initial Value Problems
Basic Concepts
– Explicit - Implicit (iterative)
– One-step (self starting) - Multi-step (non self-starting)
– Order
– Stability
f( x, y ) h( x)
y x
g( y ) So:
y0
g( y )dy h( x)dx
x0
Solutions
• Closed form solutions:y f(x)
e.g. y ' y where: y (0) 1
Not a closed form
gives: y e 1 x ...
x
solution
• What should we do when no suitable closed form solution exists?
Answer: form a numerical model of the ODE to give approximate
y values at a number of x points.
• Advantages of a numerical model:
Can handle any ODE, quickly generate solutions without
extensive math, good for solving on computers.
• Disadvantages of a numerical model:
Stability (solution can be badly behaved – thus, inaccurate),
accuracy (can be well-behaved but inaccurate).
Numerical Solutions
• Initial value problems: y ( x0 ) y0
• Step by step methods:
Use information from
current position, not future
• General solution stepping from x0 to x1 x0 h is:
x1
y ( x1 ) y ( x0 ) f( x, y )dx
x0
don’t know know ?
• Modelling challenge:
x1
Represent or approximate: x0
f( x, y )dx
Euler’s Method
• Assume that from x0 to x1
f( x, y ) f( x0 , y0 )
• Integration becomes:
x1 x1
x0
f( x, y )dx f( x0 , y0 )dx
x0
x1
f( x0 , y0 ) dx h f( x0 , y0 )
x0
so that:
y ( x1 ) y ( x0 ) h f( x0 , y0 )
Euler’s Method
• Geometric interpretation:
f(x,y)
y
Explicit x
One-step
First Order
Stability (depends very much on f and the step size)
Heun (without iteration)
xi 1 xi h
h
yi 1 yi [ f ( xi , yi ) f ( xi h, y 0i1 )]
2
where
y 0i1 yi hf ( xi , yi )
Predictor - Corrector (but still explicit)
One-step
Second order