
Numerical Integration in Ordinary Differential Equations
Explore numerical methods for integrating ordinary differential equations (ODEs) with lecture notes covering one-step methods like Forward Euler, Backward Euler, and the Trapezoidal Rule. Understand how these methods are used to solve initial value problems (IVPs) when analytic solutions are not available. Dive into the equivalent circuit models for capacitors and inductors in the context of ODEs.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
CSE291: Numerical Methods Lecture Note 5 Numerical Integration Prof. Chung-Kuan Cheng 1
Numerical Integration: Outline One-step Method for ODE (IVP) Forward Euler Backward Euler Trapezoidal Rule Equivalent Circuit Model Convergence Analysis Linear Multi-Step Method Time Step Control 2
Ordinary Differential Equations Problem Value Initial Solve t dx = (IVP) : ( ) = ( , ) f x t dt ( ) x t x 0 0 in interval an given the initial condition . [t ,T] x 0 0 We have ? equations, ?? variables, ? ??/??. Typically analytic solutions are not available solve it numerically 3
Numerical Integration ( ) dt x t dx t = ( , ) f x t = ( ) x 0 0 Forward Euler Backward Euler Trapezoidal 4
Numerical Integration: State Equation Forward Euler Backward Euler 5
Numerical Integration: State Equation Trapezoidal 6
Equivalent Circuit Model-BE Capacitor ( ) ( ) ( C v t t v t i t + + + ) t t + + ( ) ( ) ( ) v t i t t v t t C C t t + + ( ) i t t + + + ( ) i t t + C ( ) v t t = ( ) v t I C = eq t + G C ( ) v t t - eq t - - 7
Equivalent Circuit Model-BE Inductor ( ) ( ) ( L i t t i t v t + + + ) t t + + ( ) ( ) ( ) i t v t t i t t L L t t + + ( ) i t t + - = ( ) i t V L + ( ) i t t + eq t L + ( ) v t t + ( ) v t t = R L eq t - - 8
Equivalent Circuit Model-TR Capacitor ( ) ( ) ( ( ) C v t t v t i t + + + + ( )) i t t t 2 + + ( ) ( ) ( ) v t ( ) i t i t t v t t 2 2 C t C t + + ( ) i t t + + + ( ) i t t + C ( ) v t t = + G 2C = + ( ) ( ) v t ( ) i t v t t I 2 C t - eq t eq - - 9
Equivalent Circuit Model-TR Inductor ( ) ( ) ( ( ) L i t t i t v t v t + + + + ( )) t t 2 + + ( ) ( ) ( ) i t ( ) v t v t t i t t 2 2 L t L t + + ( ) i t t + - = + ( ) i t ( ) v t V 2 L t + ( ) i t t + eq L + ( ) v t t + ( ) v t t = R 2L eq t - - 10
Summary of Basic Concepts Trap Rule, Forward-Euler, Backward-Euler All are one-step methods ?? is computed using only ??, not ?? 1,?? 2,?? 3... Forward-Euler is the simplest No equation solution explicit method. Backward-Euler is more expensive Equation solution each step implicit method most stable (FE/BE/TR) Trapezoidal Rule might be more accurate Equation solution each step implicit method More accurate but less stable, may cause oscillation 11
Stabilities Froward Euler x x = x + j += + x x hx h unstable 1 k k k -1 0 k k x stable = + h x 1 k k k + = + = + 1 )k (1 ) (1 x h x h x + 1 0 k k 12
FE region of absolute stability Forward Euler ? = (1 + ?) ( ) Im ODE stability region Im(z) Region of Absolute Stability ( ) Difference Eqn Stability region1 Re Re(z) 2 t -1 13
Stabilities Backward Euler j = = = + x x x x x hx h stable + + 1 1 k k k 1- h x 0 1 + + 1 1 k k + 1 h unstable h x + + 1 1 k k k 1 + = = 1 k ( ) x x x + 1 0 k k 1 1 h 14
BE region of absolute stability ( ) 1 = h Backward Euler 1 z ( ) Im Im(z) Difference Eqn Stability region1 Re(z) -1 Region of Absolute Stability 15
Stabilities Trapezoidal = = = j stable h h + + ( ) x x x x + + 1 1 k k k k 2 1+ h/2 1- h/2 x x x k k -1 0 1 x + + 1 1 k k unstable h = + + ( ) x x x x + + 1 1 k k k k 2 h h + + 1 1 2 h 2 h + = = 1 k ( ) x x x + 1 0 k k 1 1 2 2 16
Convergence Consistency: A method of order p (p>1) is consistent if Stability: A method is stable if: Convergence: A method is convergent if: Convergence Consistency + Stability 17
A-Stable Dahlquist Theorem: An A-Stable LMS (Linear Multi-Step) method cannot exceed 2nd order accuracy The most accurate A-Stable method (smallest truncation error) is trapezoidal method. 18
Convergence Analysis: Truncation Error Local Truncation Error (LTE): At time point tk+1 assume xk is exact, the difference between the approximated solution xk+1 and exact solution x*k+1 is called local truncation error. Indicates consistency Used to estimate next time step size in SPICE Global Truncation Error (GTE): At time point tk+1, assume only the initial condition x0 at time t0 is correct, the difference between the approximated solution xk+1 and the exact solution x*k+1 is called global truncation error. Indicates stability 19
LTE Estimation: SPICE Taylor Expansion of xn+1 about the time point tn: ?(??+1) = ?(??) + ??(??)/?? + ?2?(??)/??2 2/2! + ?3?(??)/??3 3/3! + Taylor Expansion of xn about the time point tn+1: ?(??) = ?(??+1) ??(??+1)/?? + ?2?(??+1)/??2 2/2! ?3?(??+1)/??3 3/3! + Forward Euler Exercise ?(??+1) ??+1= ?(??+1) (?? + ???/??) Backward Euler Exercise ?(??+1) ??+1= ?(??+1) (?? + ???+1/??) Trapezoidal Exercise ?(??+1) ??+1= ?(??+1) [?? + (???/?? + ???+1/??) /2] 20 LTE
Formula for pth order method Formula ?(?(?), ) = i=0,????(?? ?) + ????(?? 1)/?? Let ?(?) = [(?? ?)/ ]? E(x(t),h)= i=0,k??[(?? ?? ?)/ ]? ???[(?? ?? ?)/ ]?-1 = i=0,k???? ????? 1 If the formula is a pth order method, we have Case ? = 0: i=0,k??= 0 Case ? = 1: i=0,k??? ?? = 0 Case ?: i=0,k??? ??? ?? 1= 0 21 LTE
Formula for pth order method: Example Forward Euler: We have ?0= 1,?1= 1,?0= 0,?1= 1 Case ? = 0: i=0,k??= 0 Case ? = 1: i=0,k??? ?? = 0 Case ? = 2: i=0,k(??? 2??)? = 1 + 2 = 1 Backward Euler: We have ?0= 1,?1= 1,?0= 1,?1= 0 Case ? = 0: i=0,k??= 0 Case ? = 1: i=0,k??? ?? = 0 Case ? = 2: i=0,k(??? 2??)? = 1 + 2 = 1 Trapezoidal Rule: We have ?0= 1,?1= 1,?0= 1/2,?1= 1/2 Case ? = 0: i=0,k??= 0 Case ? = 1: i=0,k??? ?? = 0 Case ? = 2: i=0,k(??? 2??)? = 0 Case ? = 3: i=0,k(??? 3??)?2= 1 + 3/2 = 22 LTE
Formula for pth order method: Variables There are 2(? + 1) 1 unknowns (?0= 1), and ? + 1 equations. Thus, we need 2(? + 1) 1 ? + 1 In other words, ? ?/2 23 LTE
Formula for pth order method: Local Truncation Error By Taylor s expansion, we have ? ? 1 ? + 1 !??+1??? ?? ?+1+ = ? ??+ ? ?? ? ?? + + Thus, the error of pth order method is ?+1 ?? ?? ? ???[?? ?? ? ]?}/(? + 1)! ??+1?? ?+1+ i=0,k{?? ?( ?+2) Let us set ??+1= { i=0,k ????+1 ?????}/?! Method FE BE TR a0 1 1 1 a1 -1 -1 -1 b0 0 -1 -1/2 b1 -1 0 -1/2 Ep+1 E2=1/2 E2=1/2 E3=1/12 24
Time Step Control: SPICE We have derived the local truncation error the unit is charge for capacitor and flux for inductor Similarly, we can derive the local truncation error in terms of (1) Suppose ED represents the absolute value of error that is allowed per time point. That is together with (1) we can calculate the time step as the unit is current for capacitor and voltage for inductor 25
Time Step Control: SPICE (contd) DD3(tn+1) is called 3rd divided difference, which is given by the recursive formula 26
Multiple Step Integration: Stability For a system ? = ??, let ? = ? . The integration formula is i=0,????? ?+ ??? ? ?= 0. We set ?0+ ??0??+ ?1+ ??1 ?? 1 + (??+ ???) = 0 There are ? roots, ??, of the polynomial eq. The generic solution is ??= ?1?1?+ ?2?2?+ + ????? but for multiplicity root, we have ??= + ??0+ ??1? + + ????? 1???+ If |??| < 1 for all ?, the system is stable Else for |??| = 1 but not multiplicity root, the system remains stable 27
Multiple Step Integration: Stability For a system ? = ??, let ? = ? . The integration formula is i=0,kaixn-i+hbix n-i=0. We set ?0+ ??0 ??+ ?1+ ??1?? 1 + (??+ ???) = 0 Examples using FE, BE, TZ methods Method FE BE TR a0 1 1 1 a1 -1 -1 -1 b0 0 -1 -1/2 b1 -1 0 -1/2 root 1 + ? 1/(1 ?) (1 + ?/2)/(1 ?/2) 28
Multiple Step Integration: Stability For a system ? = ??, let ? = ? . The integration formula is i=0,k???? ?+ ???? 1= 0. A Stability: The system is stable for all ????(?) 0. Dahlquist s barrier: An A-Stable LMS (Linear Multi-Step) method cannot exceed 2 nd order accuracy 29