/9/007 CHE 374 Computatonal Methods n Engneerng Ordnary Dfferental Equatons Consstency, Convergence, Stablty, Stffness and Adaptve and Implct Methods ODE s n MATLAB, etc Consstency & Convergence Consstency Whether or not the numercal soluton gves the same soluton as the dfferental equaton Convergence Whether the soluton to the dfference equatons becomes closer and closer to the soluton of the de for smaller and smaller step szes
/9/007 STABILITY A DE s sad to be stable f small changes n the problem causes only small changes n the soluton as t Y Stable : comes closer Unstable : soluton separates as t ncreases For numercal methods, small changes n the problem are nevtable Truncaton errors Round-off errors y = -y y =y Stablty of Euler s Method Consder the followng problem y' = λ y, y(0) = β Exact soluton yx ( ) = βe λx Stable f h λ
/9/007 3 System of n equatons For a system of st order ODE's y' = Λy, wth constant matrx Λ The Soluton s: yx ( ) = λ x where λ are egenvalues of Λ and v are correspondng egenvectors Cve Step sze needed for stablty s determned by the largest egevalue h λ max Problem s stff f there s a large dsparty n the magntudes of the Postve egenvalues. Specal methods requred for stff problems Stffness An ntal value problem s sad to be stff f some terms n the soluton vector vary more rapdly wth x (or t) than others dy t = 000y+ 3000 000 e, y(0) = 0 dt Analytcalsol -000t y=3-0.998e.00 e t
/9/007 4 Stffness y 3.5 3.5.5 0.5 0 0 4 6 8 0 t Backward Euler (Implct) Euler s method can be consdered as a result of numercally ntegratng y = f(t,y) at the left of the nterval. We can derve another method by usng f(t,y) at t k+ y + = y + hf(t +, y + ) Implct methods have a much larger regon of stablty!!
/9/007 5 Stablty of Backward Euler y = y + hf( t, y ) + + + Implct because t evaluates the functon f wth argument y before we know t's value + STABILITY: ODE y'=-λy y = y + h( λ y ) + + ( + hλ) y = y + f y0 s the ntal condton, applcaton of ths equaton n tmes gves after n steps HOLDS for any h>0 (uncondtonally stable) yn = y0 + hλ + hλ n Adaptve Methods We have looked at methods whch employ a constant step sze. Ths can present a challenge to problems wth steep changes Algorthms whch automatcally adjust the step sze wll have a great advantage Adapt to soluton accordngly. Most of the RK methods mplemented n MATLAB are adaptve
/9/007 MultStep methods Sngle step methods utlze the nformaton at a sngle pont x, to predct a value of the dependent value y + at a future pont, x + Utlzes the prevous nformaton. Not popular now, complcated. Some MATLAB solvers for ODE 6
/9/007 Ode3 and ode45 (non-stff dfferental eqs.) solver Descrpton ode3 ODE3 Solve non-stff dfferental equatons, low order method. ode45 ODE45 Solve non-stff dfferental equatons, medum order method. Usage [T,Y] = ODE45(ODEFUN,TSPAN,Y0) wth TSPAN = [T0 TFINAL] ntegrates the system of dfferental equatons y' = f(t,y) from tme T0 to TFINAL wth ntal condtons Y0. Functon ODEFUN(T,Y) must return a column vector correspondng to f(t,y). Each row n the soluton array Y corresponds to a tme returned n the column vector T. To obtan solutons at specfc tmes T0,T,...,TFINAL (all ncreasng or all decreasng), use TSPAN = [T0 T... TFINAL]. Example [t,y]=ode45(@vdp,[0 0],[ 0]); plot(t,y(:,)); solves the system y' = vdp(t,y), usng the default relatve error tolerance e-3 and the default absolute tolerance of e-6 for each component, and plots the frst component of the soluton. Stff and moderately stff ODE s solver ode3s ode3t Descrpton ODE3s Solve stff dfferental equatons, low order method. ODE3T Solve moderately stff ODEs and DAEs, trapezodal rule. ode5s ODE5S Solve stff dfferental equatons and DAEs, varable order method. odeset Create/alter ODE OPTIONS structure. OPTIONS = ODESET('NAME',VALUE,'NAME',VALUE,...) RelTol, AbsTol, IntalStep - Suggested ntal step sze See matlab for more nformaton!! 7