Professional Documents
Culture Documents
Week10&11 Differential Equations
Week10&11 Differential Equations
LESSON OUTCOMES
At the end of this topic, the students will be able:
To identify and apply the methods outlined to
solve ordinary differential equations (ODE)
DIFFERENTIAL EQUATION
Equations which are composed of an unknown function
and its derivatives are called differential equations.
When a function involves one independent variable, the
equation is called an ordinary differential equation (or
ODE). A partial differential equation (or PDE) involves two
or more independent variables.
Differential equations are also classified as to their order.
A first order equation includes a first derivative as
its highest derivative.
A second order equation includes a second
derivative.
4
dv
c
g v
dt
m
v ~ dependent variable
t ~ independent variable
dy
f ( x, y )
dx
yi 1 yi h
Eulers Method
The first derivative provides a direct estimate of the
slope at xi
f ( xi , yi )
where f(xi, yi) is the differential equation evaluated at xi and yi.
This estimate can be substituted into the equation:
yi 1 yi f ( xi , yi )h
A new value of y is predicted using the slope (equal to the first
derivative at the original value of x) to extrapolate linearly
over the step size h.
Example
Use Eulers method to numerically integrate ODE:
dy
2 x 3 12 x 2 20 x 8.5
dx
yEuler
ytrue
t (%)
1.000
1.000
0.5
5.250
3.219
-63.1
1.0
5.875
3.000
-95.8
1.5
5.125
2.219
-131
2.0
4.500
2.000
-125
f ( xi , yi ) 2
Ea
h
2!
Ea O ( h 2 )
Propagated truncation error (result from the approximations
produced during previous steps)
10
the
11
12
In conclusion,
the error can be reduced by reducing the step size
If the solution of the differential equation is linear, the
method will provide error free predictions because for a
straight line, the 2nd derivative would be zero.
13
Example
Estimate the true and the approximate local truncation
error associated with the Eulers method in the first step to
solve the following initial-value problem
dy
2 x3 x 2 5x 2
dx
15
16
Heuns method
The Midpoint (or Improved Polygon) method
17
Heuns Method
One method to improve the estimate of the slope
involves the determination of two derivatives for the
interval:
At the initial point
At the end point
Predictor :
0
i 1
yi f ( xi , yi )h
f ( xi , yi ) f ( xi 1 , yi01 )
Corrector : yi 1 yi
h
2
19
20
yi 1 yi f ( xi 1/ 2 , yi 1/ 2 )h
21
22
Runge-Kutta Method
The Runge-Kutta methods have the accuracy of the
Taylor series approach without having to evaluate
the higher derivatives.
yi 1 yi ( xi , yi , h)h
a1k1 a2 k 2 an k n
Increment function
a' s constants
k1 f ( xi , yi )
k 2 f ( xi p1h, yi q11k1h) ps and qs are constants
k3 f ( xi p3h, yi q21k1h q22k 2 h)
yi 1 yi (a1k1 a2 k 2 )h
where
k1 f ( x i , yi )
k 2 f ( xi p1h, yi q11k1h)
Values of a1, a2, p1, and q11 are evaluated by setting the
second order equation to Taylor series expansion to the
second order term.
25
a1 a2 1
1
a 2 p1
2
1
a2 q11
2
28
29
30
31
32
33
Step-Size Control
The strategy is to increase the step size if the error is too small
and decrease it if the error is too large. Press et al. (1992) have
suggested the following criterion to accomplish this:
D new
hnew h present
D present