Professional Documents
Culture Documents
Ode PDF
Ode PDF
Part 1
Ananda Dasgupta
β1 pn + β2 qn
β1 pn + β2 qn
α2 h 2
fyy pn2 + 2fyt pn + ftt (yn ,tn )
qn = pn + αh (fy ẏn + ft )(yn ,tn ) +
2
Generalization : the Runge-Kutta method
I Instead of the derivative at midpoint, we could use
pn + qn 1 1
= f (yn , tn ) + f (yn + hpn , tn + h)
2 2 2
- aka the modified Euler method.
I A more general approximation
β1 pn + β2 qn
α2 h 2
fyy pn2 + 2fyt pn + ftt (yn ,tn )
qn = pn + αh (fy ẏn + ft )(yn ,tn ) +
2
α2 h2 ...
[ y n − fy ÿn ](yn ,tn ) + O h3
= ẏn + αhÿn +
2
Generalization : the Runge-Kutta method
Generalization : the Runge-Kutta method
I The approximation
y (tn + h) = yn + h (β1 pn + β2 qn )
Generalization : the Runge-Kutta method
I The approximation
y (tn + h) = yn + h (β1 pn + β2 qn )
h2
+ (1 − β1 − β2 ) hẏn + (1 − 2αβ2 ) ÿn
2
h3 h ... ... i
y − 3α2 β2 ( y n − fy ÿn )(y ,t ) + O h4
+
6 n n
Generalization : the Runge-Kutta method
I The approximation
y (tn + h) = yn + h (β1 pn + β2 qn )
h2
+ (1 − β1 − β2 ) hẏn + (1 − 2αβ2 ) ÿn
2
h3 h ... ... i
y − 3α2 β2 ( y n − fy ÿn )(y ,t ) + O h4
+
6 n n
I Possibilities :
Generalization : the Runge-Kutta method
I The approximation
y (tn + h) = yn + h (β1 pn + β2 qn )
h2
+ (1 − β1 − β2 ) hẏn + (1 − 2αβ2 ) ÿn
2
h3 h ... ... i
y − 3α2 β2 ( y n − fy ÿn )(y ,t ) + O h4
+
6 n n
I Possibilities :
I α = 21 , β1 = 0, β2 = 1 - the midpoint formula.
Generalization : the Runge-Kutta method
I The approximation
y (tn + h) = yn + h (β1 pn + β2 qn )
h2
+ (1 − β1 − β2 ) hẏn + (1 − 2αβ2 ) ÿn
2
h3 h ... ... i
y − 3α2 β2 ( y n − fy ÿn )(y ,t ) + O h4
+
6 n n
I Possibilities :
I α = 21 , β1 = 0, β2 = 1 - the midpoint formula.
I α = 1, β1 = β2 = 12 - the corrected Euler method, aka Heun’s
method.
Generalization : the Runge-Kutta method
I The approximation
y (tn + h) = yn + h (β1 pn + β2 qn )
h2
+ (1 − β1 − β2 ) hẏn + (1 − 2αβ2 ) ÿn
2
h3 h ... ... i
y − 3α2 β2 ( y n − fy ÿn )(y ,t ) + O h4
+
6 n n
I Possibilities :
I α = 21 , β1 = 0, β2 = 1 - the midpoint formula.
I α = 1, β1 = β2 = 12 - the corrected Euler method, aka Heun’s
method.
I α = 32 , β1 = 14 , β2 = 34 - Ralstone’s method.
The 4th order Runge-Kutta algorithm
The 4th order Runge-Kutta algorithm
I Approximate the derivative in the interval (tn , tn + h) by the
weighted average
1
(pn + 2qn + 2rn + sn )
6
The 4th order Runge-Kutta algorithm
I Approximate the derivative in the interval (tn , tn + h) by the
weighted average
1
(pn + 2qn + 2rn + sn )
6
I The approximants are
pn = f (yn , tn )
h h
qn = f yn + pn , tn +
2 2
h h
rn = f yn + qn , tn +
2 2
sn = f (yn + hr , tn + h)
The 4th order Runge-Kutta algorithm
I Approximate the derivative in the interval (tn , tn + h) by the
weighted average
1
(pn + 2qn + 2rn + sn )
6
I The approximants are
pn = f (yn , tn )
h h
qn = f yn + pn , tn +
2 2
h h
rn = f yn + qn , tn +
2 2
sn = f (yn + hr , tn + h)
I Thus
h
yn+1 ≈ yn + (pn + 2qn + 2rn + sn )
6
The 4th order Runge-Kutta algorithm
I Approximate the derivative in the interval (tn , tn + h) by the
weighted average
1
(pn + 2qn + 2rn + sn )
6
I The approximants are
pn = f (yn , tn )
h h
qn = f yn + pn , tn +
2 2
h h
rn = f yn + qn , tn +
2 2
sn = f (yn + hr , tn + h)
I Thus
h
yn+1 ≈ yn + (pn + 2qn + 2rn + sn )
6
This has a local error of O h5 and global error of O h4 .
I
The 4th order Runge-Kutta algorithm
I Approximate the derivative in the interval (tn , tn + h) by the
weighted average
1
(pn + 2qn + 2rn + sn )
6
I The approximants are
pn = f (yn , tn )
h h
qn = f yn + pn , tn +
2 2
h h
rn = f yn + qn , tn +
2 2
sn = f (yn + hr , tn + h)
I Thus
h
yn+1 ≈ yn + (pn + 2qn + 2rn + sn )
6
This has a local error of O h5 and global error of O h4 .
I
I Both simple and accurate - arguably the most widely used
method.
How big should the step size be?
How big should the step size be?