Numerical Integration
-
Upload
miranda-buckner -
Category
Documents
-
view
38 -
download
2
description
Transcript of Numerical Integration
Talk Summary
Going to talk about: Euler’s method subject to errors Implicit methods help, but complicated Verlet methods help, but velocity out of step Symplectic methods can be good for both
Our Test Case
Our Test Case
Our Test Case
xt =?
x0
Constant velocity
v
xt =?
x0
Constant velocity
v
xt = x0+vt
x0
Constant accelerationv0
x0
xt = ?
a
Constant accelerationv0
x0
xt = ?
a
Constant accelerationv0
x0
xt = x0 + v0t + 1/2at2
a
Variable acceleration
x0
xt = ?
Euler’s method
x0
v0
Euler’s method
x0
v0
x1
Euler’s method
x0
v0
x1
v0a
Euler’s method
x0
v0
x1
v0a
v1
Euler’s method
x0
v0
x1v1
Euler’s method
x0
v0
x1v1
x2
Euler’s method
x0
v0
x1v1
a
v1
x2
Euler’s method
x0
v0
x1v1
a
v1
v2
x2
Euler’s method
x0
v0
x1v1
v2
x2
Euler’s method
x0
v0
x1v1
v2
x2
€
x i+1 = x i + viΔt
vi+1 = vi +a iΔt
Euler’s method
x0v0
a0
Euler’s method
x1
x0v0
a0
Euler’s method
x0x1a0
v0v0
Euler’s method
v1 x0x1
v0v0
a0
Euler’s method
x0x1
v0
v1
Euler’s method
x2
v2
x0x1
v0
v1
Euler’s method
x0
x1v1
v0
Euler
Okay for non-oscillating systems Explodes with oscillating systems Adds energy! Very bad!
Runge-Kutta methods
x0
v0
Runge-Kutta methods
x0
v0
v0.5
Runge-Kutta methods
x0
v0.5
Runge-Kutta methods
x0
v0.5
x1
Runge-Kutta methods
x0
v0
Runge-Kutta 4
Very stable and accurate Conserves energy well But expensive: four evaluations of derivative
Implicit methods
x0v0
Implicit methods
x0v0
x1
Implicit methods
x0v0
x1v1
Implicit methods
x0v0
v1
Implicit methods
x0v0
x1
v1
Implicit methods
x0v0
€
x i+1 = x i + vi+1Δt
vi+1 = vi +a i+1Δt
x1
v1
Implicit methods
x0v0
€
x i+1 = x i + vi+1Δt
vi+1 = vi +a i+1Δt
x1v1
Implicit methods
x0v0
€
x i+1 = x i + vi+1Δt
vi+1 = vi +a i+1Δt
x1
v1
Backward Euler
Not easy to get implicit values More expensive than Euler
But tends to converge: better but not ideal
Verlet
x0 x-1
Verlet
x0 x-1
Verlet
x0at2 x-1
Verlet
x0
x1
x-1at2
Verlet
€
x i+1 = 2x i − x i−1 +aΔt 2
x0
x1
x-1at2
Verlet
Leapfrog Verlet
Velocity Verlet
€
vi+1/ 2 = vi−1/ 2 +a iΔt
x i+1 = x i + vi+1/ 2Δt
€
vi+1/ 2 = vi +a iΔt /2
x i+1 = x i + vi+1/ 2Δt
vi+1 = vi+1/ 2 +a i+1Δt /2
Verlet
Very stable Cheap
Not too bad, but have estimated velocity
Symplectic Euler
x0v0
a0
Symplectic Euler
x0v0
v1
v0
a0
Symplectic Euler
x0
v1
Symplectic Euler
€
vi+1 = vi +a iΔt
x i+1 = x i + vi+1Δt
x0
v1
Symplectic Euler
€
vi+1 = vi +a iΔt
x i+1 = x i + vi+1Δt
Symplectic Euler
Cheap and stable!
Not as accurate as RK4
Symplectic Euler
Cheap and stable!
Not as accurate as RK4 - but hey, it’s a game
Demo Time
Which To Use? With simple forces, standard Euler might be okay But constraints, springs, etc. require stability Recommendation: Symplectic Euler
Generally stable Simple to compute (just swap velocity and position terms)
More complex integrators available if you need them -- see references
References Burden, Richard L. and J. Douglas Faires, Numerical
Analysis, PWS Publishing Company, Boston, MA, 1993.
Witken, Andrew, David Baraff, Michael Kass, SIGGRAPH Course Notes, Physically Based Modelling, SIGGRAPH 2002.
Eberly, David, Game Physics, Morgan Kaufmann, 2003.
References
Hairer, et al, “Geometric Numerical Integration Illustrated by the Störmer/Verlet method,” Acta Numerica (2003), pp 1-51.
Robert Bridson, Notes from CPSC 533d: Animation Physics, University of BC.