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 2005/2006


  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 2005/2006

  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 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 – 1D examples Computing I Michael Bader Direction Fields model of Maltus, ˙ 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 β δ

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

  10. Scientific Discretized Model vs. Discrete Model Computing I Michael Bader simplest example: model of Maltus 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!

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

  12. Scientific Implicit Euler – Examples Computing I Michael Bader example: Model of Maltus 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 τ

  13. 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 )

  14. 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

  15. 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 Numerical e ( τ ) = max [ a , b ] {� y k − y ( t k ) �} Schemes for ODE Local Discretisation Error Global Discretisation Error Order of ( y ( t ) the exact solution; y k the solution of the Consistency/Convergence discretized equation) A numerical scheme is called convergent , if e ( τ ) → 0 for τ → 0

  16. 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 )

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

  18. Scientific Runge-Kutta-Methods Computing I Michael Bader Runge-Kutta- Methods 1st idea: use additional evaluations of f , e.g.: 2nd-order Runge-Kutta 4th-order Runge-Kutta Multistep y n + 1 = g ( y n , f ( t n , y n ) , f ( t n + 1 , y n + 1 )) Methods Adams-Bashforth Adams-Moulton open question: where to obtain y n + 1 ) , how to Problems for Numerical choose g Methods for ODE Ill-Conditioned Problems 2nd idea: numerical approximations for Stability Stiff Equations missing values of y : Summary y n + 1 ≈ y n + τ f ( t n , y n ) � � ⇒ y n + 1 g y n , f ( t n , y n ) , f ( t n + 1 , y n + τ f ( t n , y n )) =

Recommend


More recommend