You are on page 1of 2

MAT 461/561: 12.

2 One-Step Methods, cont’d

James V. Lambers

April 1, 2020

Announcements

One-Step Methods
For initial value problem y 0 = f (t, y):
Euler’s method: error is O(h), where h is the time step size–convergence is slow. Can we obtain
higher-order accurate methods, error O(hp ), p > 1?
Can use more terms in Taylor expansion, except must approximate derivatives of f (t, y)

Solving IVPs in MATLAB


MATLAB has a suite of ODE solvers, using mostly high-order methods. See MATLAB diary.

Runge-Kutta Methods
Runge-Kutta methods are high-order time-stepping methods that use several evaluations of f (t, y)
at various points, for tn ≤ t ≤ tn+1 .
Sample derivation: assume a method of the form

yn+1 = yn + ahf (tn , yn ) + bhf (tn + α, yn + β)

To obtain a, b, α, β, match Taylor expansion of exact solution:


hd
f (t, y(t)) + [f (t, y(t))] + · · ·
2 dt
with
af (t, y(t)) + bf (t + α, y(t) + β)
Chain Rule:
h
f (t, y(t)) + [ft (t, y(t)) + f (t, y(t))fy (t, y(t))] + · · ·
2
Multivariable Taylor expansion:

(a + b)f (t, y(t)) + b [ft (t, y(t))α + fy (t, y(t))β] + · · ·

Matching:
h h
a + b = 1, bα = , bβ = f (t, y(t)).
2 2

1
Option 1: a = 0, b = 1, α = h/2, β = hf (t, y(t))/2 yields
 
h h
yn+1 = yn + hf tn + , yn + f (tn , yn )
2 2

which is the Midpoint Method. Note the second argument to f is an approximation of y(tn +h/2)
by Euler’s Method!
Option 2: a = b = 1/2, α = h,

h
yn+1 = yn + [f (tn , yn ) + f (tn+1 , yn + hf (tn , yn ))]
2
This is the Explicit Trapezoidal Method. Note 2nd argument to f in second term is the Euler’s
approximation of y(tn+1 ). Note integral viewpoint:
Z tn+1
y 0 = f (t, y) =⇒ y(tn+1 ) = y(tn ) + f (s, y(s)) ds
tn

Both methods are second-order accurate because first non-matched term in Taylor expansion of
y(t) is O(h3 ).

Implicit Methods
Backward Euler:
yn+1 = yn + hf (tn+1 , yn+1 )
This is the simplest implicit method. Because yn+1 appears on both sides, we must solve for it. If
f is nonlinear in y, must use an iterative method like Newton’s Method, unlike explicit methods
like the ones we have seen, that use “plug-and-chug” to get yn+1
Implicit methods require more computational effort per time step, but can often take fewer steps.
Backward Euler is also first-order accurate. Second-order implicit method: Trapezoidal Method
h
yn+1 = yn + [f (tn , yn ) + f (tn+1 , yn+1 )]
2
When using iterative methods, for initial guess can use yn , or yn + hf (tn , yn ) ≈ yn+1 by Euler’s
Method
Systems of linear ODEs: y0 = Ay, A is n × n matrix. Backward Euler:

yn+1 = yn + hAyn+1

Rearrange:
(I − hA)yn+1 = yn
So we have the same system solved many times, different right-hand sides

You might also like