ECE257 Numerical Methods and Scientific Computing Ordinary Differential Equations
Today s s class: Stiffness Multistep Methods
Stiff Equations Stiffness occurs in a problem where two or more independent variables change at very different scales Example: dy dt Analytical Solution: = 1000y + 3000 2000e t y = 3 0.998e 1000t 2.002e t y(0) = 0
Stiff Equations y = 3 0.998e 1000t 2.002e t As t moves away from zero, the solution settles to y = 3 2.002e t You still need to account for the e -1000 even after you move away from zero If you don t t do so, the system will be unstable Adaptive methods will not work term 1000t term
Stiff Equations dy dt = ay + dy i dt h ay i h ( 1 ah) For the system to be stable 1-ah must be less than 1, or h<2/a dy dt = 1000y + 3000 2000e t => h < 2 1000
Stability A numerical method is stable if errors occurring at one stage of the process do not tend to be magnified at later stages. A numerical method is unstable if errors occurring at one stage of the process tend to be magnified at later stages. Numerical methods which may be unstable should be carefully dealt with or avoided. In general, the stability of a numerical scheme depends on the step size. Usually, large step sizes lead to unstable solutions. Implicit methods are in general more stable than explicit methods.
Stiff Equations From Numerical Methods for Engineers, Chapra and Canale, Copyright The McGraw-Hill Companies, Inc.
Stiff Equations y(0.01) y(0.1) h=0.01-289.402 4.346x10 24 h=0.001 1.017863 1.188514
Stiffness Stiffness can also cause problems even when the system is stable Example: d 2 y dx =100y 2 dy 1 dx = y 2 dy 2 dx =100y 1 y(0) =1, y'(0) = 10 Analytical Solution y 1 = e 10x,y 2 = 10e 10x y(0.5) = 0.00674
Stiffness y(0.5) h=0.5 13.7083 h=0.05 0.006765 h=0.005 0.006738 h=0.00005 0.006738
Stiffness y(0.5) y(5) h=0.5 13.7083 2.34 x 10 11 h=0.05 0.006765-158272 h=0.005 0.006738 154838 h=0.00005 0.006738 516826
Stiffness Roundoff or truncation error can cause inaccuracies in initial values and lead us to follow an inaccurate solution d 2 y dx 2 =100y y = Ae 10x + Be 10x y(0) =1, y'(0) = 10 As x gets large, the e 10x dominates and because of accumulated errors as we integrate from the initial values, we will introduce large errors
Stiffness Implicit (backward) differencing (Euler s) + d dt a h = y i 1+ ah ( ) This method is unconditionally stable True for linear ODEs h
Stiffness From Numerical Methods for Engineers, Chapra and Canale, Copyright The McGraw-Hill Companies, Inc.
Stiffness From Numerical Methods for Engineers, Chapra and Canale, Copyright The McGraw-Hill Companies, Inc.
Multi-step Methods R- K methods use only one previous approximation (y i ), known as one-step method. Multi-step methods use several previous points (y i, y i-1, ) - explicit (b 0 = 0) & implicit methods. y = a y + a y +.. + h [ b f ( x, y ) + i+ 1 b 1 1 f i ( x i, y 2 i ) i 1 + b 2 f ( x i 1, y 0 i 1 i+ 1 ) +... ] i+ 1 Open & closed formula, non-self start Huen method Adams-Bashforth Methods (explicit methods b 0 = 0) Adams-Moulton Methods (implicit methods) Predictor-Corrector Methods
Multi-step methods From Numerical Methods for Engineers, Chapra and Canale, Copyright The McGraw-Hill Companies, Inc.
Non-Self-Starting Heun Method Heun Method 0 + f ( x i,y i )h + h f (x i,y i ) + f (x i+1, y 0 i+1 ) 2 Instead of using a O(h 2 ) forward Euler method as the predictor, use an O(h 3 ) predictor 0 1 + f ( x i,y i )2h + h f (x i,y i ) + f (x i+1, 0 ) 2
Non-Self-Starting Heun Method Multiple iterations 0 1 + f ( x i, y i )2h j + h f (x i, y i ) + f (x i+1,y j 1 i+1 ) 2 ε a = y j i+1 j 1 j
Non-Self-Starting Heun Method Derivation dy dx = f x, y ( ) x dy = i+1 f ( x, y)dx y i 1 x i 1 1 + x i+1 x i 1 f ( x,y)dx 1 + f ( x i,y i )2h
Non-Self-Starting Heun Method Predictor Error ( ) E p = 4 5 y m 0 i y i Refine value using predictor modifier 0 0 Corrector Error E c = y 0 m i+1 5 Refine value using corrector modifier y m i+1 y m i+1 + 0 ( ) + 4 5 y m 0 i y i m 5
Non-Self-Starting Heun Method Integrate y = 4e 0.8x - 0.5y and y(0)= )=2, y(-1-1)=-0.393 Analytical solution: y = 4 1.3 e0.8x e 0.5x Heun s s Method (step size of 1): y 0 1 = y 1 + f ( x 0, y 0 )2h = 0.393 + ( 3)2 = 5.607 y 1 1 = y 0 + h f x 0, y 0 y 1 2 = y 0 + h f x 0, y 0 ( ) + f x 1,y 1 0 2 ( ) + f x 1,y 1 1 2 ( ) ( ) ( ) + 2e 0.5x ε t =10.54% = 2 +1 3 + 6.099 = 6.549 2 3+ 5.627 = 2 +1 = 6.314 2 ε t = 5.73% ε t = 1.92%
Non-Self-Starting Heun Method y 1 1 y 1 1 y 1 0 1 y 1 5 y 2 1 y 2 1 y 2 0 1 y 1 5 6.549 5.607 = 6.549 = 6.361 5 ε t = 2.68% 6.314 5.607 = 6.314 = 6.173 5 ε t = 0.356%
Predictor-Corrector Methods Instead of using midpoint method and trapezoidal method, use higher order integration methods as the predictor and corrector Newton-Cotes Adams
Predictor-Corrector Methods
Predictor-Corrector Methods Newton Cotes based Integrate by fitting an nth degree polynomial to n+1 points dy dx = f ( x, y ) x dy = i+1 f ( x, y)dx y i n x i n n + x i+1 x i n f ( x, y)dx
Predictor-Corrector Methods Open Formulas x i+1 n=1 1 + f ( x, y)dx x i 1 1 + 2hf i x n=2 i+1 yi+1 2 + f ( x,y)dx x i 2 2 + 3h 2 ( f i + f i 1 ) n=3 3 + x i+1 x i 3 f ( x,y)dx 3 + 4h ( 3 2 f i f i 1 + 2 f i 2 )
Predictor-Corrector Methods Closed Formulas x n=1 + i+1 f ( x, y)dx x i 1 + h ( 2 f i + f i+1 ) x n=2 i+1 1 + f ( x,y)dx x i 1 1 + h ( 3 f i 1 + 4 f i + f i+1 )
Adams-Bashforth Methods Open Formulas Taylor series expansion + f i h + f i ' h 2 2! + f i" h 3 3! +L + h f i + f i ' h 2! + f " h 2 i 3! +L Backward difference substitution for f + h f i + f i f i 1 h ( ) + f i " h 2! + O h 2 + h 3 2 f 1 i 2 f i 1 + 5h 3 12 f "+O h 4 i ( ) h 2! + f " h 2 i 3! +L
Adams-Bashforth Formulas 2nd order n-th order + h 3 2 f 1 i 2 f i 1 + 5h 3 12 f "+O h 4 i n 1 + h β k f i k + O h n +1 k= 0 ( ) ( )
Adams-Moulton Methods Closed Formulas Taylor series expansion h 2 y i = f i+1 h + f ' i+1 2! f " i+1 3! +L h + h f i+1 f ' i+1 2! + f " h 2 i+1 3! +L Backward difference substitution for f + h f i+1 f f i+1 i h h 3 ( ) + f " i+1 h 2! + O h 2 + h 1 2 f + 1 i+1 2 f i h 3 12 f " O h 4 i ( ) h 2! + f " h 2 i 3! +L
Adams-Moulton Formulas 2nd order + h 1 2 f + 1 i+1 2 f i h 3 12 f " O h 4 i n-th order n 1 + h β k f i+1 k + O h n +1 k= 0 ( ) ( )
Milne s s Method Predictor-Corrector Predictor: 3-point Newton-Cotes open 3 + 4h ( 3 2 f f + 2 f i i 1 i 2) Corrector: 3-point Newton-Cotes closed j ( ) E p = 28 29 y m 0 i y i ( ) 1 + h 3 f j 1 i 1 + 4 f i + f i+1 ( ) E c = 1 29 y m 0 i+1
Milne s s Method Integrate y = 4e 0.8x - 0.5y and y(0)= )=2 Use an RK method to compute previous points y(-3-3)=-4.547, y(-2-2)=-2.306, y(-1-1)=-0.393, y 0 1 = y 3 + 4h ( 3 2 f f + 2 f 0 1 2) = 4.547 + 4 ( 1 ) ( ) 1.994 + 2( 1.961) 3 2 3 = 6.023 ε t = 2.8% y 1 1 = y 1 + h 3 f 0 ( 1 + 4 f 0 + 2 f 1 ) ( ) = 0.393 + 1 ( 3 1.994 + 4 ( 3 ) + 5.891) = 6.235 ε t = 0.66%
Fourth-Order Adams Use fourth-order Adams-Bashforth as predictor + h 55 24 f i 59 24 f i 1 + 37 24 f i 2 9 24 f i 3 Use fourth-order Adams-Moulton as corrector j ( ) E c = 251 270 y m 0 i y i + h 9 24 f j 1 i+1 + 19 24 f i 5 24 f i 1 + 1 24 f i 2 ( ) E c = 19 270 y m 0 i+1
Fourth-Order Adams Integrate y = 4e 0.8x - 0.5y and y(0)= )=2 Use an RK method to compute previous points y(-3-3)=-4.547, y(-2-2)=-2.306, y(-1-1)=-0.393, y 0 1 = y 0 + h 55 24 f 0 59 24 f 1 + 37 24 f 2 9 24 f 3 = 2 +1 55 ( 24 3 ) 59 ( 24 1.994 ) + 37 ( 24 1.961 ) 9 ( 24 2.637 ) = 6.008 ε t = 3.1% y 1 1 = y 0 + h 55 24 f 0 59 24 f 1 + 37 24 f 2 9 24 f 3 = 2 +1 9 ( 24 5.898 ) + 19 ( 24 3 ) 5 ( 24 1.994 ) + 1 24 1.961 ( ) = 6.253 ε t = 0.96%
Multistep Methods Because of the smaller error coefficients, Milne s s Method is slightly more accurate than Fourth-Order Adams methods However, Milne s s can often be unstable Example: y =-y, y(0)= )=1, h=0.5
Multistep Methods
Next Lecture Ordinary Differential Equations Boundary-Value Problems Eigenvalue Problems Read Chapter 27 HW6 due 11/16 Exam 2 11/9