Numerical Methods for ODEs Lectures for PSU Summer Programs Xiantao Li
Outline Introduction Some Challenges Numerical methods for ODEs Stiff ODEs Accuracy Constrained dynamics Stability Coarse-graining Applications Preserving invariants Preserving symmetry Multiple time scales Statistical mechanics Preserving geometric structures
Ordinary Differential Equations General form x 0 = f(x, t) Applications Mechanics Molecular models Chemical reactions Discretization of PDEs Examples from 251 Mass-spring model, population model, motion in space For most ODEs, the solutions can be obtained from analytical methods.
Numerical Solutions Exact solution x(t) = (t, x(0)) Numerical solution x(t) = (t, x(0); t) Numerical methods Time discretization = {t 0,t 1,,t N } [0,T] Example: uniform step size: Euler s method: t j = j t, j 0 x(t j+1 ) x(t j ) t = f(x(t j ),t j )
A Two-Stage Runge-Kutta Method First stage: k 1 = f(x(t j ),t j ),x(t j+1 ) = x(t j )+ tk 1 Second stage: k 2 = f(x(t j+1 ),t j+1 ), x(t j+1 )=x(t j )+ t k1 + k 2 2 Numerical error k (t) (t)k apple t 2 e Lt. Higher order RK methods are available (try rk45 in Matlab)
Inheritance of Asymptotic Stability For a linear system, x 0 = Ax, x =0 eigenvalues of A are negative. is stable if all For a nonlinear system, x 0 = f(x), an equilibrium x 0 is stable if the eigenvalues of rf(x 0 ) are negative. A numerical method is stable if the stability of the linear system is inherited. Typically, the step size has to be sufficiently small (inverse proportional to the eigenvalues) in order for the method to be stable. The problem becomes stiff when some eigenvalues are large.
Many-Particle Models Coordinate and Momentum The equations: Linear momentum: Angular momentum: Total energy: Conservation:
First Integrals (Invariants) In general, for is a first integral if Most numerical methods preserve linear invariant Only some methods preserve quadratic invariants In general, it is not possible to exactly preserve invariants of higher order.
Symmetry If the function is symmetric wrt The solutions of the ODEs will be called ρ- reversible For example, A numerical method is ρ- reversible if the solution satisfies the same properties. Explicit RK methods are not symmetric.
Symplectic Structure A linear mapping A is symplectic if A nonlinear mapping g is symplectic if
Hamiltonian systems Hamilton s principle Examples: mass spring model, many-body problems, pendulum model, Lotka-Volterra model etc. The mapping is symplectic A numerical method is symplectic if it defines a symplectic mapping
Symmetric and symplectic methods Symmetric methods Order of accuracy is always even Very convenient for an extrapolation procedure Symplectic methods Very good energy conservation properties Promising accuracy over long time integration Provide good statistics.
Dimension Reduction: I A Hamiltonian system Imposing constraints y 0 = JrH(y) c(y) =0,c: R N! R N n Effectively, there are only n free variables Example: flexible pendulum H = K + U = 1 2 (mv2 1 + mv 2 2)+mgx 2 + 1 2ɛ 2 ( x 2 1 + x2 2 l)2,
Dimension Reduction: II A large system x 0 = Ax, x 2 R N,A2 R N N,N 1. Some quantities of interest y = Bx,y 2 R n,b 2 R n N Remaining degrees of freedom: z = Cx, z 2 R N n,b 2 R (N n) N Effective equation: My 0 = Ky + S(t): memory function Z t 0 S(t s)y(s)ds + R(t) R(t): random noise
Summer Project I Minimum energy path (MEP) The most efficient path from one stable state to another The most probable path Represents rare but important events ODEs with boundary conditions
Summer Project II ODEs with multiple time scales An example, x 0 = f(x, y) y 0 = 1 " (y '(x)) A multiscale method targeting the slow variables only Large time step size