Professional Documents
Culture Documents
DIFFERENTIAL
EQUATIONS : ORDINARY
DIFFERENTIAL EQUATIONS
Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Ordinary Differential
Equations
Equations which are composed of an
unknown function and its derivatives are
called differential equations.
Play a fundamental role in engineering
because many physical phenomena are
best formulated mathematically in terms of
their rate of change.
dv
c
g v
dt
m
v- dependent variable
t- independent
variable
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
EULERS METHOD
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
Eulers formula
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 1
Use Eulers method to numerically integrate
dy 1 x 1
dx 4 y
from x=0 to x=2 with a step size of 0.5. The
initial condition at x=0 is y=1. Compare
the results with the true value.
ytrue
0.0
1.0000
0.5
1.1456
1.0
1.3229
1.5
1.5207
2.0
1.7321
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.3
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
f ( xi , yi ) 2
Ea
h
2!
Ea O ( h 2 )
Round-off errors
Solution:
the error can be reduced by reducing the step
size
If the solution to the differential equation is linear,
the method will provide error free predictions as for
a straight line the 2nd derivative would be zero.
by Lale Yurttas, Texas
A&M University
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.4
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
IMPROVEMENTS OF
EULERS METHOD
Source of error in Eulers method is the
derivative at the beginning of the interval
is assumed to apply across the entire
interval.
Two simple modifications are available to
avoid this weakness:
Heuns Method
The Midpoint (or Improved Polygon) Method
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10
HEUNS METHOD
Predictor-corrector approach.
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
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11
Example 2
Use Heuns method to numerically integrate
dy 1 x 1
dx 4 y
from x=0 to x=2 with a step size of 0.5. The
initial condition at x=0 is y=1. Compare
the results with the true value.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
12
Figure 25.9
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
13
Figure 25.10
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
14
h
yi f ( xi , yi )
2
yi 1 yi f ( xi 1/ 2 , yi 1/ 2 )h
by Lale Yurttas, Texas
A&M University
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
15
Example 3
Use improved polygon method to
numerically integrate
dy 1 x 1
dx 4 y
from x=0 to x=2 with a step size of 0.5. The
initial condition at x=0 is y=1. Compare
the results with the true value.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
16
Figure 25.12
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
17
RUNGE-KUTTA METHODS
(RK)
19
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Second-order RK Methods
yi 1 yi (a1k1 a2 k 2 )h
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. Three
aevaluate
equationsa1to
four unknowns constants
2 1
A value is assumed for
are derived. 1
a 2 p1
one of the unknowns to
2
solve for the other three.
1
a2 q11
Chapter 25
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
20
(
k
k 2 )h
i
1
2
k1 f ( x i , yi )
k 2 f ( xi h, yi k1h)
yi 1 Midpoint
yi k 2 h
The
Method (a2=1)
k1 f ( x i , yi )
1
1
k 2 f ( xi h, yi k1h)
2
2
1
2
y
(
k
k 2 )h (a =2/3)
i 1
i
1
Raltsons
Method
2
3
3
k1 f ( x i , yi )
3
3
k 2 f ( xi h, yi k1h)
4
4
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
21
Third-order RK Methods
1
yi 1 yi (k1 4k 2 k3 )h
6
k1 f ( x i , yi )
1
1
k 2 f ( xi h, yi k1h)
2
2
k3 f ( xi h, yi k1h 2k 2 h)
Fourth-order RK Methods
1
yi 1 yi (k1 2k 2 2k3 k 4 )h
6
k1 f ( x i , yi )
1
1
k 2 f ( xi h, yi k1h)
2
2
1
1
k3 f ( xi h, yi k 2 h)
2
2
k 4 f ( xi h, yi k3 h)
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
22
Example 4
Use the Ralstons method (2nd-order RK), 3rd-order
RK method and 4th-order RK method to numerically
integrate
dy 1 x 1
dx 4 y
from x=0 to x=2 with a step size of 0.5. The initial
condition at x=0 is y=1. Compare the results with
the true value.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
23
Figure 25.14
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
24
ADAPTIVE
RUNGE-KUTTA METHODS
For an ODE with an
abrupt changing
solution, a constant
step size can
represent a serious
limitation.
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 25.20
25
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:
hnew h present
new
present
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
26
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
27
Example 5
Use the adaptive 4th-order RK method to
numerically integrate
dy 1 x 1
dx 4 y
Chapter 6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
28