CS57 Numerical Analsis Lecure Numerical Soluion o Ordinar Dierenial Equaions Proessor Jun Zang Deparmen o Compuer Science Universi o enuck Leingon, Y 4006 0046 April 5, 00
Wa is ODE An Ordinar Dierenial Equaion ODE is an equaion a involves one or more derivaives o an unknown uncion A soluion o a dierenial equaion is a speciic uncion a saisies e equaion For e ODE Te soluion is d d were c is a consan. Noe a e soluion is no unique e Also, e uncion as derivaives onl respec o one variable e ce For derivaives wi muliple variables, e equaion is usuall called parial dierenial equaion PDE
An Eample o ODE An ODE soluion as a uncion o e ime
Iniial Value Problem A dierenial equaion does no, in general, deermine a unique soluion uncion. Addiional i condiions i are needed ddo deermine a unique soluion Te iniial value problem as e ollowing sandard orm ', a s Here is a uncion o, a is e given iniial value o e problem. We would like o deermine e value o a an ime beore or aer a Some eamples o iniial value problems and soluions Equaion Iniial Value Soluion ' ' 6 0 0 e 6 4 4
Numerical Soluion Analical soluions in closed orms are onl available or special dierenial equaions Mos dierenial equaions encounered in pracical applicaions do no ave analical soluions Some analical soluions ma be oo complicaed o be useul in pracice A numerical soluion o a dierenial equaion is usuall obained in e orm o a able o discree values Inerpolaion procedures can beused o obain all values oe approimae numerical soluion wiin a given inerval A large amoun o daa ma be displaed as a soluion curve on a color grapical monior 5
ODE and Inergraion Consider e dierenial equaion d r, dr a s We inegrae i rom o We obain d r, r dr r, r dr Replacing e inegral wi one o e numerical inegraion rules we sudied beore, we obain a ormula or solving e dierenial equaion 6
Numerical Rules Using e le recangular approimaion ormula, we ave wic leads o e Euler s meod r, r dr,, On e oer and, e rapezoid rule leads o and e implici ormula, r, r dr [,, ] [,, ] because appears on bo sides 7
Talor Series Meods Te Talor series o a uncion ' ' ' "'!! 4 4 m m L L 4! m! gives e numerical soluion o wen we runcae e series aer e ms erms I is small, and i we know, ', ",, m e Talor series compues ver accurae value o. I we runcae e series aer e ms erm, e meod is called e Talor series meod o order m Te Talor series meod o order is known as e Euler s meod 8
Euler s Meod Te iniial value problem ', a a over e inerval [a,b], we use e irs woerms erms oe Talor series ' Tis gives e ormula o e Euler s meod, Te compuaion sars rom a and sops a b wi n seps o size b a n 9
Euler s meod Using Euler s meod o solve an ODE. Te pical beavior o e compued soluion is a i runs awa rom e eac soluion as more seps are aken, due o e accumulaion o errors a eac sep 0
Talor Series Meod o Higer Order Consider e iniial value problem ' 4 We d diereniae e equaion several imes, as ' " "' 4 ' " ' ' 6 "' 6' " 6 Tese erms can be applied in order in e Talor series meod and e compued soluion will be more accurae. For eample 4.584 rom e Euler s meod. 4.7096 rom e use o e 4 derivaive. Te eac value o ive signiican igures is 4.7
Tpe o Errors Wen we runcae e Talor series, we inroduce e local runcaion error 5 5 ξ 0 Te runcaion error is o order 5, or O 5. Te second pe o error is e accumulaion eecs o all local runcaion errors Te compued value o is in error because is alread in error, due o e previous runcaion error, and e curren sep involves anoer runcaion error Te roundo error can also conribue o e accumulaion o error Tese errors ma be magniied b succeeding seps
Runge ua Meods Te ig order Talor meod or solving e iniial value problem ', a a needs e derivaives o b diereniaing e uncion. Tis is no convenien. We need some igl accurae meods a make use o direcl Te Runge ua meods are a class o meods using muliple evaluaions o, no is derivaives, o enance compuaional accurac We will illusrae e procedure o derive e Runge ua meod o order, and give e ormula or Runge ua meod o order 4, wic is popularl used We assume a, can be compued or an,, so a,,,, can be compued
Talor Series or,, We can epand e Talor series in wo variables i Te irs ew rig and erms are,!, 0 k i k i Te irs ew rig and erms are, 0 k, k k, k k k 4 M
Talor Series or, Te Talor series can be runcaed as n, k k, k i 0 i! n! We now use subscrips o denoe e parial derivaives, k k i k k!! L, L!! k k, k k L!! k k k n, 5
Runge ua Meod o Order Deine wo uncion evaluaions, α, β We add e linear combinaion o ese quaniies o e value o a o obain e value a w w or w, w α, β, We wan o deermine e consans in e above epression so a i will be as accurae as possible In oer words, we wan e above epression o mac e Talor series o as man erms as possible 6
Euler s Meod & Runge ua Meod Te Euler s meod le requires one uncion evaluaion a eac sep Te second order Runge ua meod rig requires wo uncion evaluaions a eac sep 7
Runge ua Meod o Order Compare e inended ormula w, w α, β, wi e Talor series '! " "' L! I we se w and w 0, e wo epressions agree o e erm Te ormula obained is wic is e Euler s meod, since, ', 8
Runge ua Meod o Order Revisi e wo variable Talor series α, β α β a β Using is ormula in We ave, w, w α, β, Noe a w w αw βw O " d' d d, d d d 9
Runge ua Meod o Order Te Talor series equaion becomes '! " Compare e wo epressions o, we ave One soluion is w w αw βw! α β w w "' O L Oer soluions are possible, bu e runcaion i errors will be e same 0
Runge ua Meod o Order So e Runge ua Meod o Order is,,, Or equivalenl were,, Te soluion uncion a is compued a e epenses o wo evaluaions o e uncion Te runcaion i error o e second order d Runge uameod is O
Compare Euler s Meod & Runge ua Meod Te iniial value problem is 4 ' e, 0
Runge ua Meod o Order 4 g Te mos popular Runge ua Meod is a o order 4, as were 4 6,, 4,, Tis ormula requires our uncion evaluaions Te runcaion error o e our order Runge ua meod is O 5 g
Four Order Runge ua Meod Illusraion o Runge ua meod o order 4. Calculaions are made a e iniial ime, wo a al o e sepsize beond e iniial ime and a e inal ime. Tese our calculaions allow e use olarger overall sepsize wi good accurac 4
Four Order Runge ua Meod Te iniial value problem is ', 0 5
Some Amazing Simulaion Resuls 6
Adapive Runge ua Meods In pracical compuaions, we need o know e magniude o errors involved din e compuaion Given a olerance o error, we wan o be assured a e compued numericalsoluionmusnodeviae mus no romeruesoluionbeonde rue olerance Ia meodis seleced, eerrorolerance error olerance dicaes eallowable sep size A uniorm sep size ma no be desirable I e soluion is smoo, a large sep size ma be used o reduce compuaional cos I is preerable a e meod can auomaicall adjus e sep size during e compuaion 7
Compue e Errors To advance e soluion curve rom o, we can ake one sep o size using e our order Runge ua meod We can also ake wo seps o size / o arrive a I ere were no runcaion errors, e values o e numerical soluion compued rom bo procedures would be e same Te dierence in e numerical resuls can be aken as an esimae o e local runcaion error I is error is wiin e prescribed olerance, e curren sep size is saisacor. I e dierence eceeds e olerance, e sep size is alved Tis procedure is easil programmed bu raer waseul o compuing ime 8
Felberg Meod o Order 4 g Te ormula is 97 408 5 were 5 4 5 404 97 565 408 6 5 were,, 9, 8 4, 4 4 845 680 49 97 796 97 700 97 9, 9 4 5 404 845 5 680 8 6 49,
Felberg Meod o Order 4, R45 Te Felberg meod o order 4 requires one more uncion evaluaion an e classical Runge ua meod, i is no ver aracive However, wi one more uncion evaluaion, as 6 8 544 859, 4 5 7 85 404 40 We can obain e i order Runge ua meod, i.e., 6 6656 856 9 4 5 5 85 5640 50 55 6 Te dierence beween e values o compued rom e our and i order procedures is an esimae o e local runcaion error in e our order procedure. So si uncion evaluaions give a ourorder approimaion, ogeer wi an error esimae 0
Adapive Process. Given a sep size and an iniial value, e R45rouine compues e value and an error esimae ε. I εmin ε ε ma, en e sep size is no canged and e ne sep size is aken b replacing sep wi iniial value. I ε, en is replaced db, provided dd ε min ma 4. I ε > ε ma, en is replaced b /, provided / min 5. I min ma, en e sep size is repeaed b reurning o sep wi and e new value Here ε,ε ma min are e maimum and minimum error olerances allowed, ma min are e maimum and minimum sep sizes allowed
Adams Basor Moulon Formulas Le us consider e irs order ordinar dierenial equaion ', I we assume e values o e unknown uncion ave been compued a several poins o e le o, i.e.,,,,, n, we wan o compue. Using e eorem o calculus, l we ave were e abbreviaion j is j n j c ' s ds s, s ds j j, j j
Te las sep needs a rule o e orm Adams Basor Formulas F r dr c F 0 c F L cn F n 0 We need o deermine e n coeiciens c j. We can insis on inegraing n eac uncion, r, r, L, r eacl. Te appropriae equaion is 0 r i d n j c j A linear ssem o e orm Ab o n equaions can be solved or n unknowns. Te coeiciens o e mari A are and e rig and side is b i /i j i A ij j i n i
Adams Moulon Formulas In Adams Moulon ormulas, e quadraure is o e orm Use e cange o variable rom s o p given b sp e new inegral will 0 n j j j G C dr r G Use e cange o variable rom s o p given b sp, e new inegral will be 0 dp p g We now ave [ ] 9 7 59 55 F F F F dr r F [ ] [ ] 49 5 9 9 4 9 7 59 55 4 G G G G dr r G F F F F dr r F 4
Sabili Analsis For some iniial value problems, a small error in e iniial value ma produce errors o large magniude, and e compued soluion is compleel wrong Te runcaion error in eac sep urer deerioraes e compued soluion For oer iniial value problems, e siuaion is no a severe 5
A Case o Diverging gsoluions Te iniial values are close o eac oer. Bu over e ime, e soluions diverge o dieren pas 6
A Case o Converging gsoluions Te iniial values are quie dieren. Bu over e ime, e soluions converge o someing ver close o eac oer 7
For e general dierenial equaion Soluion Sabili ', a s I > δ or some δ > 0 e curves diverge. I < δ or some δ > 0 en e curves converge. 8