scientific computing i
play

Scientific Computing I Methods Module 4: Numerical Methods for ODE - PowerPoint PPT Presentation

Scientific Computing I Michael Bader Outlines Part I: Basic Numerical Methods Part II: Advanced Numerical Scientific Computing I Methods Module 4: Numerical Methods for ODE Michael Bader Lehrstuhl Informatik V Winter 2007/2008


  1. Scientific Computing I Michael Bader Outlines Part I: Basic Numerical Methods Part II: Advanced Numerical Scientific Computing I Methods Module 4: Numerical Methods for ODE Michael Bader Lehrstuhl Informatik V Winter 2007/2008

  2. Scientific Part I: Basic Numerical Methods Computing I Michael Bader Outlines Direction Fields 1 Part I: Basic Numerical Methods Part II: Advanced Numerical Methods Euler’s Method 2 Discretized Model vs. Discrete Model 3 Implicit Euler 4 Analysis of Numerical Schemes for ODE 5 Local Discretisation Error Global Discretisation Error Order of Consistency/Convergence

  3. Scientific Part II: Advanced Numerical Methods Computing I Michael Bader Outlines Runge-Kutta-Methods 6 Part I: Basic Numerical Methods 2nd-order Runge-Kutta Part II: Advanced Numerical Methods 4th-order Runge-Kutta Multistep Methods 7 Adams-Bashforth Adams-Moulton Problems for Numerical Methods for ODE 8 Ill-Conditioned Problems Stability Stiff Equations Summary

  4. Scientific Computing I Michael Bader Direction Fields Euler’s Method Discretized Model vs. Discrete Model Part I Implicit Euler Analysis of Numerical Basic Numerical Methods for ODE Schemes for ODE Local Discretisation Error Global Discretisation Error Order of Consistency/Convergence

  5. Scientific Motivation: Direction Fields Computing I Michael Bader given: initial value problem: Direction Fields Euler’s Method ˙ y ( t ) = f ( t , y ( t )) , y ( t 0 ) = y 0 Discretized Model vs. Discrete Model Implicit Euler easily computable: direction field Analysis of Numerical Schemes for ODE 5 Local Discretisation Error Global Discretisation Error 4 p(t) Order of Consistency/Convergence 3 2 1 0 0 2 4 6 8 10 t idea: “follow the arrows”

  6. Scientific “Following the Arrows” Computing I Michael Bader direction field illustrates slope for given time t n Direction Fields and value y n : Euler’s Method Discretized Model vs. Discrete Model ˙ y n = f ( t n , y n ) Implicit Euler Analysis of “follow arrows” = make a small step in the Numerical Schemes for ODE given direction: Local Discretisation Error Global Discretisation Error Order of Consistency/Convergence y n + 1 := y n + τ ˙ y n = y n + τ f ( t n , y n ) motivates numerical scheme: y 0 := y 0 y n + 1 := y n + τ f ( t n , y n ) for n = 0 , 1 , 2 ,...

  7. Scientific Euler’s Method Computing I Michael Bader Direction Fields numerical scheme is called Euler’s method : Euler’s Method Discretized Model vs. Discrete Model y n + 1 := y n + τ f ( t n , y n ) Implicit Euler results from finite difference approximation: Analysis of Numerical Schemes for ODE y n + 1 − y n Local Discretisation Error ≈ ˙ y n = f ( t n , y n ) Global Discretisation Error τ Order of Consistency/Convergence (difference quotient instead of derivative) or from truncation of Taylor expansion: y ( t n )+ O ( τ 2 ) y ( t n + 1 ) = y ( t n )+ τ ˙

  8. Scientific Euler’s Method and Direction Fields Computing I Michael Bader Direction Fields Euler’s Method 60 Discretized Model vs. Discrete Model 50 Implicit Euler p(t) Analysis of 40 Numerical Schemes for ODE 30 Local Discretisation Error Global Discretisation Error Order of 20 Consistency/Convergence 10 0 0 50 100 150 200 250 t use direction at begin of the timestep

  9. Scientific Euler’s Method – 1D examples Computing I Michael Bader Direction Fields model of Malthus, ˙ p ( t ) = α p ( t ) : Euler’s Method Discretized Model vs. Discrete Model p n + 1 := p n + τα p n Implicit Euler Logistic Growth, ˙ p ( t ) = α ( 1 − p ( t ) / β ) p ( t ) : Analysis of Numerical Schemes for ODE � � Local Discretisation Error 1 − p n Global Discretisation Error p n + 1 := p n + τα p n Order of β Consistency/Convergence Logistic growth with threshold: � 1 − p n �� 1 − p n � p n + 1 := p n + τα p n β δ

  10. Scientific Euler’s Method in 2D Computing I Michael Bader Euler’s method is easily extended to systems of Direction Fields ODE → use vector notation: Euler’s Method Discretized Model y n + 1 := y n + τ f ( t n , y n ) vs. Discrete Model Implicit Euler example: nonlinear extinction model Analysis of Numerical Schemes for ODE � � 71 8 − 23 12 p ( t ) − 25 ˙ p ( t ) = 12 q ( t ) p ( t ) Local Discretisation Error Global Discretisation Error Order of � � 73 8 − 25 12 p ( t ) − 23 Consistency/Convergence q ( t ) ˙ = 12 q ( t ) q ( t ) Euler’s method: � � 71 8 − 23 12 p n − 25 p n + 1 = p n + τ 12 q n p n � � 73 8 − 25 12 p n − 23 q n + 1 = q n + τ 12 q n q n

  11. Scientific Discretized Model vs. Discrete Model Computing I Michael Bader simplest example: model of Malthus Direction Fields Euler’s Method p n + 1 := p n − τα p n , α > 0 Discretized Model vs. Discrete Model compare to discrete model: Implicit Euler Analysis of p n + 1 := p n − δ p n , δ > 0 Numerical Schemes for ODE Local Discretisation Error Global Discretisation Error with decay rate δ (“percentage”) Order of Consistency/Convergence obvious restriction in the discrete model: δ < 1 obvious restriction for τ in the discretized model? τα < 1 ⇒ τ < α − 1 not that simple in non-linear models or systems of ODE!

  12. Scientific Implicit Euler Computing I Michael Bader Euler’s method (“explicit Euler”): Direction Fields Euler’s Method y n + 1 := y n + τ f ( t n , y n ) Discretized Model vs. Discrete Model implicit Euler: Implicit Euler Analysis of Numerical y n + 1 := y n + τ f ( t n + 1 , y n + 1 ) Schemes for ODE Local Discretisation Error Global Discretisation Error results from finite difference approximation: Order of Consistency/Convergence y n + 1 − y n ≈ ˙ y n = f ( t n + 1 , y n + 1 ) τ explicit formula for y n + 1 not immediately available to do: solve equation for y n + 1

  13. Scientific Implicit Euler and Direction Fields Computing I Michael Bader Direction Fields Euler’s Method 60 Discretized Model vs. Discrete Model 50 Implicit Euler p(t) Analysis of 40 Numerical Schemes for ODE 30 Local Discretisation Error Global Discretisation Error Order of 20 Consistency/Convergence 10 0 0 50 100 150 200 250 t use direction at end of the timestep

  14. Scientific Implicit Euler – Examples Computing I Michael Bader example: Model of Malthus Direction Fields Euler’s Method 1 Discretized Model p n + 1 := p n + τα p n + 1 ⇒ p n + 1 = 1 − τα p n vs. Discrete Model Implicit Euler correct (discrete) model? Analysis of Numerical Schemes for ODE 0 < ( 1 − τα ) − 1 < 1 for any τ Local Discretisation Error α < 0 : then Global Discretisation Error Order of τ < α − 1 required! α > 0 : then Consistency/Convergence in physics α < 0 is more frequent! (damped systems, friction, . . . ) implicit schemes preferred when explicit schemes require very small τ

  15. Scientific Implicit Euler – 2D Example Computing I Michael Bader Direction Fields Euler’s Method example: arms race Discretized Model vs. Discrete Model p n + 1 = b 1 + a 11 p n + 1 + a 12 q n + 1 Implicit Euler q n + 1 = b 2 + a 21 p n + 1 + a 22 q n + 1 Analysis of Numerical Schemes for ODE Local Discretisation Error solve linear system of equations: Global Discretisation Error Order of Consistency/Convergence ( 1 − a 11 ) p n + 1 − a 12 q n + 1 b 1 = − a 21 p n + 1 +( 1 − a 22 ) q n + 1 = b 2 (for each time step n → n + 1)

  16. Scientific Local Discretisation Error Computing I Michael Bader local influence of using differences instead of Direction Fields derivatives Euler’s Method Discretized Model example: Euler’s method vs. Discrete Model Implicit Euler �� y ( t + τ ) − y ( t ) � � � � Analysis of l ( τ ) = max − f ( t , y ( t )) � � Numerical τ [ a , b ] � � Schemes for ODE Local Discretisation Error Global Discretisation Error memory hook: insert exact solution y ( t ) into Order of Consistency/Convergence y n + 1 − y n − ˙ y n τ A numerical scheme is called consistent , if l ( τ ) → 0 for τ → 0

  17. Scientific Global Discretisation Error Computing I Michael Bader Direction Fields compare numerical solution with exact Euler’s Method solution Discretized Model vs. Discrete Model example: Euler’s method Implicit Euler Analysis of e ( τ ) = max [ a , b ] {� y k − y ( t k ) �} Numerical Schemes for ODE Local Discretisation Error Global Discretisation Error y ( t ) the exact solution; Order of Consistency/Convergence y k the solution of the discretized equation (depends on τ ) A numerical scheme is called convergent , if e ( τ ) → 0 for τ → 0

  18. Scientific Order of Consistency/Convergence Computing I Michael Bader Direction Fields Euler’s Method A numerical scheme is called consistent of order p Discretized Model vs. Discrete Model ( p -th order consistent), if Implicit Euler Analysis of l ( τ ) = O ( τ p ) Numerical Schemes for ODE Local Discretisation Error A numerical scheme is called convergent of order Global Discretisation Error Order of Consistency/Convergence p ( p -th order convergent), if e ( τ ) = O ( τ p )

  19. Scientific Computing I Michael Bader Runge-Kutta- Methods 2nd-order Runge-Kutta 4th-order Runge-Kutta Part II Multistep Methods Adams-Bashforth Advanced Numerical Methods for Adams-Moulton Problems for Numerical ODE Methods for ODE Ill-Conditioned Problems Stability Stiff Equations Summary

Recommend


More recommend