ordinary differential equations ii
TRANSCRIPT
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Ordinary Differential Equations II
CS 205A:Mathematical Methods for Robotics, Vision, and Graphics
Justin Solomon
CS 205A: Mathematical Methods Ordinary Differential Equations II 1 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Almost Done!
No class next week!
I Homework 6: 11/18 (2 days late!)
I Homework 7: 12/2
I Homework 8? (optional)
I Section: 11/22, 12/6
I Final exam: 12/12, 12:15pm
Go to office hours!
CS 205A: Mathematical Methods Ordinary Differential Equations II 2 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Initial Value Problems
Find f (t) : R→ Rn
Satisfying F [t, f (t), f ′(t), f ′′(t), . . . , f (k)(t)] = 0
Given f (0), f ′(0), f ′′(0), . . . , f (k−1)(0)
CS 205A: Mathematical Methods Ordinary Differential Equations II 3 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Most Famous Example
F = maNewton’s second law
CS 205A: Mathematical Methods Ordinary Differential Equations II 4 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Reasonable Assumption
Explicit ODEAn ODE is explicit if can be written in the form
f (k)(t) = F [t, f (t), f ′(t), f ′′(t), . . . , f (k−1)(t)].
CS 205A: Mathematical Methods Ordinary Differential Equations II 5 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
After Reduction
d~y
dt= F [~y]
CS 205A: Mathematical Methods Ordinary Differential Equations II 6 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Forward Euler
~yk+1 = ~yk + hF [~yk]
I Explicit method
I O(h2) localized truncation error
I O(h) global truncation error;
“first order accurate”
CS 205A: Mathematical Methods Ordinary Differential Equations II 7 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Backward Euler
~yk+1 = ~yk + hF [~yk+1]
I Implicit method
I O(h2) localized truncation error
I O(h) global truncation error;
“first order accurate”
CS 205A: Mathematical Methods Ordinary Differential Equations II 8 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Trapezoid Method
~yk+1 = ~yk + hF [~yk] + F [~yk+1]
2I Implicit method
I O(h3) localized truncation error
I O(h2) global truncation error;
“second order accurate”
CS 205A: Mathematical Methods Ordinary Differential Equations II 9 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Model Equation
y′ = ay, a < 0 −→ yk+1 =1
2ha(yk+1 + yk)
Unconditionally stable!
But this has nothing to do with accuracy.
CS 205A: Mathematical Methods Ordinary Differential Equations II 10 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Model Equation
y′ = ay, a < 0 −→ yk+1 =1
2ha(yk+1 + yk)
Unconditionally stable!
But this has nothing to do with accuracy.
CS 205A: Mathematical Methods Ordinary Differential Equations II 10 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Model Equation
y′ = ay, a < 0 −→ yk+1 =1
2ha(yk+1 + yk)
Unconditionally stable!
But this has nothing to do with accuracy.
CS 205A: Mathematical Methods Ordinary Differential Equations II 10 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Is Stability Useful Here?
R =yk+1yk
Oscillatory behavior!
CS 205A: Mathematical Methods Ordinary Differential Equations II 11 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Is Stability Useful Here?
R =yk+1yk
Oscillatory behavior!
CS 205A: Mathematical Methods Ordinary Differential Equations II 11 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Pattern
Convergence as h→ 0 is not the whole story nor
is stability. Often should consider behavior for
fixed h > 0.
Qualitative and quantitative analysis needed!
CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Pattern
Convergence as h→ 0 is not the whole story nor
is stability. Often should consider behavior for
fixed h > 0.
Qualitative and quantitative analysis needed!
CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Observation
~yk+1 = ~yk +
∫ tk+1
tk
F [~y(t)] dt
CS 205A: Mathematical Methods Ordinary Differential Equations II 13 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Alternative Derivation ofTrapezoid Method
~yk+1 = ~yk +h
2(F [~yk] + F [~yk+1]) +O(h3)
Implicit method
CS 205A: Mathematical Methods Ordinary Differential Equations II 14 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Heun’s Method
~yk+1 = ~yk +h
2(F [~yk] + F [~yk + hF [~yk]]) +O(h3)
Replace implicit part with lower-order integrator!
CS 205A: Mathematical Methods Ordinary Differential Equations II 15 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Stability of Heun’s Method
y′ = ay, a < 0
yk+1 =
(1 + ha +
1
2h2a
)yk
=⇒ h <
√1− 4
|a|− 1
Forward Euler: h < 2|a|
CS 205A: Mathematical Methods Ordinary Differential Equations II 16 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Stability of Heun’s Method
y′ = ay, a < 0
yk+1 =
(1 + ha +
1
2h2a
)yk
=⇒ h <
√1− 4
|a|− 1
Forward Euler: h < 2|a|
CS 205A: Mathematical Methods Ordinary Differential Equations II 16 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Stability of Heun’s Method
y′ = ay, a < 0
yk+1 =
(1 + ha +
1
2h2a
)yk
=⇒ h <
√1− 4
|a|− 1
Forward Euler: h < 2|a|
CS 205A: Mathematical Methods Ordinary Differential Equations II 16 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Runge-Kutta Methods
Apply quadrature to:
~yk+1 = ~yk +
∫ tk+1
tk
F [~y(t)] dt
Use low-order integrators
CS 205A: Mathematical Methods Ordinary Differential Equations II 17 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Runge-Kutta Methods
Apply quadrature to:
~yk+1 = ~yk +
∫ tk+1
tk
F [~y(t)] dt
Use low-order integrators
CS 205A: Mathematical Methods Ordinary Differential Equations II 17 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
RK4: Simpson’s Rule
~yk+1 = ~yk +h
6(~k1 + 2~k2 + 2~k3 + ~k4)
where ~k1 = F [~yk]
~k2 = F
[~yk +
1
2h~k1
]~k3 = F
[~yk +
1
2h~k2
]~k4 = F
[~yk + h~k3
]CS 205A: Mathematical Methods Ordinary Differential Equations II 18 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Using the Model Equation
~y′ ≈ A~y
=⇒ ~y(t) ≈ eAt~y0
CS 205A: Mathematical Methods Ordinary Differential Equations II 19 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Exponential Integrators
~y′ = A~y +G[~y]
First-order exponential integrator:
~yk+1 = eAh~yk − A−1(1− eAh)G[~yk]
CS 205A: Mathematical Methods Ordinary Differential Equations II 20 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Exponential Integrators
~y′ = A~y +G[~y]
First-order exponential integrator:
~yk+1 = eAh~yk − A−1(1− eAh)G[~yk]
CS 205A: Mathematical Methods Ordinary Differential Equations II 20 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Returning to Our Reduction
~y′(t) = ~v(t)
~v′(t) = ~a(t)
~a(t) = F [t, ~y(t), ~v(t)]
~y(tk + h) = ~y(tk) + h~y′(tk) +h2
2~y′′(tk) +O(h3)
Don’t need high-order estimators for derivatives.
CS 205A: Mathematical Methods Ordinary Differential Equations II 21 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Returning to Our Reduction
~y′(t) = ~v(t)
~v′(t) = ~a(t)
~a(t) = F [t, ~y(t), ~v(t)]
~y(tk + h) = ~y(tk) + h~y′(tk) +h2
2~y′′(tk) +O(h3)
Don’t need high-order estimators for derivatives.
CS 205A: Mathematical Methods Ordinary Differential Equations II 21 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
New Formulae
~vk+1 = ~vk +
∫ tk+1
tk
~a(t) dt
~yk+1 = ~yk + h~vk +
∫ tk+1
tk
(tk+1 − t)~a(t) dt
~a(τ) = (1− γ)~ak + γ~ak+1+~a′(τ)(τ −hγ− tk)+O(h2)
for τ ∈ [a, b]
CS 205A: Mathematical Methods Ordinary Differential Equations II 22 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
New Formulae
~vk+1 = ~vk +
∫ tk+1
tk
~a(t) dt
~yk+1 = ~yk + h~vk +
∫ tk+1
tk
(tk+1 − t)~a(t) dt
~a(τ) = (1− γ)~ak + γ~ak+1+~a′(τ)(τ −hγ− tk)+O(h2)
for τ ∈ [a, b]
CS 205A: Mathematical Methods Ordinary Differential Equations II 22 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
New Formulae
~vk+1 = ~vk +
∫ tk+1
tk
~a(t) dt
~yk+1 = ~yk + h~vk +
∫ tk+1
tk
(tk+1 − t)~a(t) dt
~a(τ) = (1− γ)~ak + γ~ak+1+~a′(τ)(τ −hγ− tk)+O(h2)
for τ ∈ [a, b]
CS 205A: Mathematical Methods Ordinary Differential Equations II 22 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Newmark Class
~yk+1 = ~yk + h~vk +
(1
2− β
)h2~ak + βh2~ak+1
~vk+1 = ~vk + (1− γ)h~ak + γh~ak+1
~ak = F [tk, ~yk, ~vk]
Parameters: β, γ (can be implicit or explicit!)
CS 205A: Mathematical Methods Ordinary Differential Equations II 23 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Newmark Class
~yk+1 = ~yk + h~vk +
(1
2− β
)h2~ak + βh2~ak+1
~vk+1 = ~vk + (1− γ)h~ak + γh~ak+1
~ak = F [tk, ~yk, ~vk]
Parameters: β, γ (can be implicit or explicit!)
CS 205A: Mathematical Methods Ordinary Differential Equations II 23 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Constant Acceleration: β = γ = 0
~yk+1 = ~yk + h~vk +1
2h2~ak
~vk+1 = ~vk + h~ak
Explicit, exact for constant acceleration, linear
accuracy
CS 205A: Mathematical Methods Ordinary Differential Equations II 24 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Constant Implicit Acceleration:β = 1/2, γ = 1
~yk+1 = ~yk + h~vk +1
2h2~ak+1
~vk+1 = ~vk + h~ak+1
Backward Euler for velocity, midpoint for
position; globally first-order accurate
CS 205A: Mathematical Methods Ordinary Differential Equations II 25 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Trapezoid: β = 1/4, γ = 1/2
~xk+1 = ~xk +1
2h(~vk + ~vk+1)
~vk+1 = ~vk +1
2h(~ak + ~ak+1)
Trapezoid for position and velocity; globally
second-order accurate
CS 205A: Mathematical Methods Ordinary Differential Equations II 26 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Central Differencing: β = 0, γ = 1/2
~vk+1 =~yk+2 − ~yk
2h
~ak+1 =~yk+1 − 2~yk+1 + ~yk
h2
Central difference for position and velocity;
globally second-order accurate
CS 205A: Mathematical Methods Ordinary Differential Equations II 27 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Newmark Schemes
I Generalizes large class of integrators
I Second-order accuracy (exactly) when
γ = 1/2
I Unconditional stability when 4β > 2γ > 1
(otherwise radius is function of β, γ)
CS 205A: Mathematical Methods Ordinary Differential Equations II 28 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Staggered Grid
~yk+1 = ~yk + h~vk+1/2
~vk+3/2 = ~vk+1/2 + h~ak+1
~ak+1 = F
[tk+1, ~xk+1,
1
2(~vk+1/2 + ~vk+3/2)
]
Leapfrog: ~a not a function of ~v; explicit
Otherwise: Symmetry in ~v dependence
Next
CS 205A: Mathematical Methods Ordinary Differential Equations II 29 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Staggered Grid
~yk+1 = ~yk + h~vk+1/2
~vk+3/2 = ~vk+1/2 + h~ak+1
~ak+1 = F
[tk+1, ~xk+1,
1
2(~vk+1/2 + ~vk+3/2)
]Leapfrog: ~a not a function of ~v; explicit
Otherwise: Symmetry in ~v dependence
Next
CS 205A: Mathematical Methods Ordinary Differential Equations II 29 / 29
Reminders Review Trapezoid Runge-Kutta Exponential Integrators Multivalue Methods
Staggered Grid
~yk+1 = ~yk + h~vk+1/2
~vk+3/2 = ~vk+1/2 + h~ak+1
~ak+1 = F
[tk+1, ~xk+1,
1
2(~vk+1/2 + ~vk+3/2)
]Leapfrog: ~a not a function of ~v; explicit
Otherwise: Symmetry in ~v dependence
Next
CS 205A: Mathematical Methods Ordinary Differential Equations II 29 / 29