Ordinary Differential Equations (ODEs) • Differential equations are the ubiquitous, the lingua franca of the sciences; many different fields are linked by having similar differential equations • ODEs have one independent variable; PDEs have more • Examples: electrical circuits Newtonian mechanics chemical reactions population dynamics economics… and so on, ad infinitum Example: RLC circuit di 1 Ri L i dt V dt C 2 d q R dq 1 V q 2 dt L dt LC L To illustrate: Population dynamics • 1798 Malthusian catastrophe • 1838 Verhulst, logistic growth • Predator-prey systems, Volterra-Lotka Population dynamics • Malthus: dN rN dt • Verhulst: Logistic growth dN N r (1 ) N dT K N N N 0e 1 N0 N 0 rt (1 )e K K N0 rt Population dynamics Hudson Bay Company Population dynamics V .Volterra, commercial fishing in the Adriatic x1 biomass of predators x2 biomass of prey x1 b12 x2 a1 x1 x2 a2 b21x1 x2 In the x1-x2 plane dx2 x2 a2 b21x1 ( ) dx1 x1 b12 x2 a1 State space dx2 x2 a2 b21x1 ( ) dx1 x1 b12 x2 a1 Integrate analytically! b12 x2 a1 ln x2 const. b21x1 a2 ln x1 Produces a family of concentric closed curves as shown… How to compute? Population dynamics x1 b12 x2 a1 x1 self-limiting term x2 a2 b21x1 c22 x2 stable focus x2 Delay limit cycle As functions of time Do you believe this? • Do hares eat lynx, Gilpin 1973 Do Hares Eat Lynx? Michael E. Gilpin The American Naturalist, Vol. 107, No. 957 (Sep. - Oct., 1973), pp. 727-730 Published by: The University of Chicago Press for The American Society of Naturalists Stable URL: http://www.jstor.org/stable/2459670 Putting equations in state-space form y y y f (t ) x Ax bf (t ) x1 y; x2 y ; so x1 x2 x2 y f (t ) y y f (t ) x2 x1 Traditional state space: x vs. x plane Example: the (nonlinear) pendulum ( g / ) sin 0 McMaster Linear pendulum: small θ For simplicity, let g/l = 1 0 sin t cos t 2 2 1 Circles! Pendulum in the phase plane Varieties of Behavior • Stable focus • Periodic • Limit cycle Varieties of Behavior • • • • Stable focus Periodic Limit cycle Chaos …Assignment Numerical integration of ODEs • Euler’s Method simple-minded, basis of many others • Predictor-corrector methods can be useful • Runge-Kutta (usually 4th-order) workhorse, good enough for our work, but not state-of-the-art Criteria for evaluating • Accuracy use Taylor series, big-Oh, classical numerical analysis • Efficiency running time may be hard to predict, sometimes step size is adaptive • Stability some methods diverge on some problems Euler • Local error = O(h2) • Global accumulated) error = O(h) (Roughly: multiply by T/h ) Euler • Local error = O(h2) • Global (accumulated) error = O(h) x1 x0 x0 f ( x0 ) h x1 x0 h f ( x0 ) Euler step Euler • Local error = O(h2) • Global (accumulated) error = O(h) 2 h x1 x0 h f ( x0 ) f ( ) 2 Euler step Taylor’s series with remainder Second-order Runge-Kutta (midpoint method) • Local error = O(h3) • Global (accumulated) error = O(h2) Fourth-order Runge-Kutta • Local error = O(h5) • Global (accumulated) error = O(h4) Additional topics • Stability, stiff systems • Implicit methods • Two-point boundary-value problems shooting methods relaxation methods