C H A P T E R 5 Numerical Solution ofInitial-Value Problems 5.1 Introduction Differential equations areused tomodel problems thatinvolve thechange ofsome variable with respect toanother .These problems require thesolution toaninitial -value problem — thatis,thesolution toadifferential equation thatsatisfies agiven initial condition . Inmany real-lifesituations ,thedifferential equation thatmodels theproblem istoo complicated tosolve exactly ,andoneoftwoapproaches istaken toapproximate theso- lution .Thefirstapproach istosimplify thedifferential equation toonethatcanbesolved exactly ,andthen usethesolution ofthesimplified equation toapproximate thesolution totheoriginal equation .Theother approach ,theoneweexamine inthischapter ,involves finding methods fordirectly approximating thesolution oftheoriginal problem .This isthe approach commonly taken because more accurate results andrealistic error information can beobtained . Themethods weconsider inthischapter donotproduce acontinuous approximation tothesolution oftheinitial -value problem .Rather ,approximations arefound atcertain specified ,andoften equally -spaced ,points .Some method ofinterpolation ,commonly cubic Hermite ,isused ifintermediate values areneeded . Thefirst partofthechapter concerns approximating thesolution y(t)toaproblem of theform d y— =f(t,y),fora.--,yn)> dyi dtf2(t*yu yi %-"*yn)% dyn dtfn(t,yuyi yn), forabesuppreved rican theeBook and/oreChaptcnM .Editorial review h*> deemed thatany vupprc'-cdcontent dee *,notouter ILA affect theoverall learning experience .Ceng ageLearn xigroervev theright torerrx'cradditional conceal atanytime ifvubvcvjjcti rights restrictions require it.174 C H A P T E R 5 Numerical Solution ofInitial -Value Problems Wealso examine therelationship ofasystem ofthistype tothegeneral nth-order initial - value problem oftheform yM=f(t,y,y\ y«-») fora deemed Cut artyMpptccscd content dcc>notmaterial'.yafTcct theoverall learnire experience .Ccnitapc [.camon resenci theright Mremove additional conceal atanytime i!vutoeqjrni nghtv mtrictionv require it5.2 Taylor Methods 175 Theuseofelementary difference methods toapproximate the solution todifferential equations wasoneofthenumerous mathematical topics thatwasfirst presented tothemathematical public bythemost prolific of mathematicians .Leonhard Euler (1707-1783 ).Theobjective ofEuler ’smethod istofind,foragiven positive integer N,anapproxi - mation tothesolution ofaproblem oftheform d y „ — =/(f,y),io ta /<*>+--2— /(ft), forsome number inft,f,+i).Letting h=(b-a)/N=f,+i-/j,wehave h2 y(*+i>- +*/onic third pur.ycontent may besuppreved rrom theeBook aml/orcCh deemed Cutany suppic-cdcontent does nottnaxrUXy alTcct theoverall learning experience .Cottage [.cammereserves theright 10remove additional conteatatanytime ifsubsequent rights restrictions require It176 CHAPTER 5-Numerical Solution ofInitial -Value Problems Illustration InExample 1wewilluseEuler ’smethod toapproximate thesolution to /=y-r2+l,0 deemed Cutany suppic-cdcontent does notmaterial yalTcct theoverall learning experience .Ccagngc [.cannon reserves theright 10remose additional conceal atanytimeiisubsequent rights restrictions require It5.2 Taylor Methods 177 fori=0,1,...,9.So w,=1.2(0.5)— 0.008 (0)2+0.2=0.8;w2=1.2(0.8)-0.008 (1)2+0.2=1.152 ; andsoon.Table 5.1shows thecomparison between theapproximate values atr,andthe actual values . u W i y,=y(ti) lyi-w/l 0.0 0.5000000 0.5000000 0.0000000 0.2 0.8000000 0.8292986 0.0292986 0.4 1.1520000 1.2140877 0.0620877 0.6 1.5504000 1.6489406 0.0985406 0.8 1.9884800 2.1272295 0.1387495 1.0 2.4581760 2.6408591 0.1826831 1.2 2.9498112 3.1799415 0.2301303 1.4 3.4517734 3.7324000 0.2806266 1.6 3.9501281 4.2834838 0.3333557 1.8 4.4281538 4.8151763 0.3870225 2.0 4.8657845 5.3054720 0.4396874 Error Bounds forEuler 'sMethod Euler ’smethod isderived from aTaylor polynomial whose error term involves thesquare of thestepsizeh,sothelocal error ateach stepisproportional to/r,soitis0(h2).However , thetotal error ,orglobal error,accumulates these local errors ,soitgenerally grows ata much faster rate. Euler'sMethod Error Bound Lety(t)denote theunique solution totheinitial -value problem y'=f(t,y), f o T a -2L1]. Animportant point tonotice isthat,although thelocal error ofEuler ’smethod ,thatis, theerror atanindividual step,is0(h2),theglobal error,which istheerror over theentire interval ,isonly O(h).Thereduction ofonepower ofhfrom local toglobal error istypical ofinitial-value techniques .Even though wehave areduction inorder from local toglobal errors ,theformula shows thattheerror tends tozero with h. Example 2Thesolution totheinitial -value problem y'=y-t2+1,0 deemed Cutanysuppre-edcontent docs nottnaxrUXy alTcct theioera .1Icamir .itexperience .Ccagagc [.cannon reserves theright 10remove additional eonteat atanytime ifsubsequent rights restrictions require IL178 C H A P T E R 5 Numerical Solution ofInitial-Value Problems wasapproximated inExample 1using Euler ’smethod with h=0.2.Find bounds forthe approximation errors andcompare these totheactual errors . Solution Because fit,y)=y-12+1,wehave 9fit,y)/dy=1forally,soL— 1.For thisproblem ,theexact solution isyit)=it+l)2-0.5e\so/'(0=2— 0.5e'and \y"(t)\<0.5e2-2,forall/6[0,2]. Using theinequality intheerror bound forEuler ’smethod with h=0.2,L=1,and Af=0.5e2-2gives |yi-wf\<0.1(0.5e2-2)(«?"-1). Hence |>(0.2)-wH<0.1(0.5e2-2)(e02-1)=0.03752 ; |y(0.4)-w21<0.1(0.5e2-2)(e04-1)=0.08334 ; andsoon.Table 5.2lists theactual error found inExample 1,together with thiserror bound.Note thateven though thetrue bound forthesecond derivative ofthesolution was used,theerror bound isconsiderably larger than theactual error,especially forincreasing values oft. m Table 5.2 ti 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Actual Error 0.02930 0.06209 0.09854 0.13875 0.18268 0.23013 0.28063 0.33336 0.38702 0.43969 Error Bound 0.03752 0.08334 0.13931 0.20767 0.29117 0.39315 0.51771 0.66985 0.85568 1.08264 Higher Order Taylor Methods Euler ’smethod wasderived using Taylor ’sTheorem with n=1,sothefirstattempt tofind methods forimproving theaccuracy ofdifference methods istoextend thistechnique of derivation tolarger values ofn.Suppose thesolution yit)totheinitial-value problem y'=f it,y),ior a deemed*»aiany Mippic-cdcontent dee>notmaterial yalTcct theiAefa .1Icanvr .itexperience .Ccnitasc[.camonrexrvei therljtlu 10rerrxyve additional conteat*anytime iicutoeqjcni nght »rotrletionc requite It5.2 Taylor Methods 179 Taylor Method ofOrder n W0=Of, Wr+l=w,+hT w (fi,W i) foreachi=0,1,...,N— 1,where W i)=/«,.wi)+JfXh,w,)+   + W i).2 nl The local error is^^-y(n+1)(f,)/i',+1forsome £,in(/,,f,+i). Theformula forT(n)iseasily expressed butdifficult tousebecause itrequires the derivatives of/with respect tot.Since/isdescribed asamultivariable function ofboth tandy,thechain ruleimplies thatthetotal derivative of/with respect tot,which we denoted /'(r,y(f)),isobtained by r o.y(t))=g(r,*0) £+ =ga,y(0)+ or,since y'(r)=/(f,y(0),by /'(f.y(0)=^(',y(0)+/(f,y(0)%(fy(0).3/ 3y Higher derivatives canbeobtained inasimilar manner ,butthey might become increasingly complicated .Forexample ,/"(/,y(f))involves thepartial derivatives ofalltheterms on theright side ofthisequation with respect toboth tand y. Example 3Apply Taylor ’smethod oforders (a)2and(b)4with N=10totheinitial -value problem y'=y-t2+\,0 deemed CutanyMpprcucd content dee>notmaterial yalTcct theioera .1leamir*experience .C'cnitasc[.camonre\«ve»theright loremote additional conteatatanytime iiwtoeqjcoi nght »rotrictionc require IL180 C H A P T E R 5 Numerical Solution ofInitial -Value Problems Table 5.3 tiTaylor Order 2 w,Error lyft)-wi\ 0.0 0.500000 0 0.2 0.830000 0.000701 0.4 1.215800 0.001712 0.6 1.652076 0.003135 0.8 2.132333 0.005103 1.0 2.648646 0.007787 1.2 3.191348 0.011407 1.4 3.748645 0.016245 1.6 4.306146 0.022663 1.8 4.846299 0.031122 2.0 5.347684 0.042212Thefirsttwosteps give theapproximations y(0.2)asvvi=1.22(0.5)-0.0088 (0)2-0.008 (0)+0.22=0.83; y(0.4)a;w2=1.22(0.83 )-0.0088 (0.2)2-0.008 (0.2)+0.22=1.2158 . Alltheapproximations andtheir errors areshown inTable 5.3. (b)ForTaylor ’smethod oforder 4weneed thefirstthree derivatives off(t,y(t))with respect tot.Again using y'=y— t2-f1wehave /'(*,y(0)=y-12+1-2t, f"(t,y(r))=4-(y-t2+1-20=/-2»-2=y-12+1-2r-2at =y-12-2/-1, and /"'(*.y(0)=^(y— *2—2r—1)=/— 2r— 2=y— t2— 2r—1, SO T(4)(tt,w4)=/ft,w,)+ ^/'ft,Wf)+ ^r/"ft,w4)+^/'"ft,w,-) =w,-— tf+1+-(w,-tf+1-2*i)+— (w,— tf— 2ti— l) h h2/i3\f 2\ft h^2\/f..h h2 Hence Taylor ’smethod oforder 4is24* w0=0.5,—^+y(*,- deemed Cutanysuppre-wdcontent docs notmaterial yalTcct theoverall Ieamir .itexperience .Cenit JCC[.CAMOH reserve!thenjht Mremove additional conceal atanytime i!subsequent nuhts restrictions require It.5.2 Taylor Methods 181 Approximating Intermediate Results Hermite interpolation requires both thevalue ofthefunction and itsderivative ateach node.This makes itanatural interpolation method forapproximating differential equations because these dataareallavailable .Theresults from Table 5.4indicate theTaylor ’smethod oforder 4results arequite accurate atthenodes 0.2,0.4,etc.Butsuppose weneed todetermine anapproximation toan intermediate point inthetable,forexample ,at/=1.25.Ifweuselinear interpolation on theTaylor method oforder four approximations att=1.2andt=1.4,wehave /1.25)«= )3'179964 +V M-1^j3'732432 =3.318081 . The true value isy(1.25)=3.317329 ,sothisapproximation hasanerror of0.000752 , which isnearly 30times theaverage oftheapproximation errors at1.2and1.4. Wecansignificantly improve theapproximation byusing cubic Hermite interpolation . Todetermine thisapproximation fory(1.25)requires approximations toy'(1.2)andy'(1.4) aswellasapproximations toy(1.2)andy(1.4).However ,theapproximations fory(1.2)and y(l.4)arcinthetable ,andthederivative approximations areavailable from thedifferential equation because y'(t)=f(t,y(t)).Inourexample y'(t)=y(f)— t2+1,so /(1.2)=/1.2)-(1.2)2+1«=3.179964 -1.44+1=2.739964 and /(1.4)=/1.4)-(1.4)2+1«3.732433 -1.96+1=2.772432 . The divided -difference procedure inSection 3.4gives theinformation inTable 5.5. Theunderlined entries come from thedata,andtheother entries usethedivided -difference formulas . Table 5.512 3.179964 2.739964 1.2 3.179964 0.111880 2.762340 -0.307100 1.4 3.732432 0.050460 2.772432 1.4 3.732432 Thecubic Hermite polynomial is /0«=3.179964 +(t-1.2)2.739964 +(t-1.2)20.111880 +(f-1.2)2(r-1.4)(— 0.307100 ), so y(1.25)«3.179964 -I-0.136998 +0.000280 +0.000115 =3.317357 , aresult thatisaccurate towithin 0.000028 .This isabout theaverage oftheerrors at1.2 andat1.4,andonly 4%oftheerror obtained using linear interpolation .This improvement inaccuracy certainly justifies theadded computation required fortheHermite method . Error estimates fortheTaylor methods aresimilar tothose forEuler ’smethod .If sufficient differentiability conditions aremet,annth-order Taylor method willhave local error0(hn~x)andglobal error0(hn). Copyright 2012 Cc«£»fcLearn in*.AIR.(huReversed Mayr*xbecopied ,canned ,ocduplicated.»whole oempan .Doc 10electronic tlfht».vonte third pony content may besuppressed ftem sheeBook and/orcClupccriM .Editorial review h*> deemed Cut artyMipprcucd content dcc>notmaterial'.yafTcet theoverall learnire experience .Ccnitapc [.cannon roetve*thenjht Mremove additional conceal atanytime i!vutoeqjrni r+htvrotrictions require it182 C H A P T E R 5 Numerical Solution ofInitial -Value Problems E X E R C I S E S E T 5 2 1. UseEuler ’smethod toapproximate thesolutions foreach ofthefollowing initial -value problems . a.y'— teyi-2y,for0 deemed Cutanyvuppicwcd content dee>nottmxtlaly alTect theoverall Icamir .itexperience .Ccri|tapeLearn xiprexxvev therljtlu loremote additional conceal atanytime i ivutoeqjroi nghtv rotrictionv require It5.3 Runge -Kutta Methods 183 f.Usetheanswers generated in(e)andpiecewise cubic Hermite interpolation toapproximate yat thefollowing values andcompare them totheactual values ofy. i. y(1.04) ii.>(1.55) iii.>(1.97) 9. Given theinitial -value problem y'=}i-*-y2'i<»<2.:y(U=-i with theexact solution >(/)=-1/f. a.UseEuler ’smethod with h=0.05 toapproximate thesolution andcompare itwith theactual values of>. b.Usetheanswers generated in(a)andlinear interpolation toapproximate thefollowing values of >andcompare them totheactual values . i.>(1.052 ) ii.>(1.555 ) iii.>(1.978 ) c.UseTaylor ’smethod oforder 2with h=0.05 toapproximate thesolution andcompare itwith theactual values of>. d.Usetheanswers generated in(c)andlinear interpolation toapproximate thefollowing values of >andcompare them totheactual values. i.>(1.052 ) ii.>(1.555 ) iii.>(1.978 ) e.UseTaylor ’smethod oforder 4with h=0.05 toapproximate thesolution andcompare itwith theactual values of>. f.Usetheanswers generated in(e)andpiecewise cubic Hermite interpolation toapproximate the following values of>andcompare them totheactual values . i.>(1.052 ) ii.>(1.555 ) iii.>(1.978 ) 10. Inanelectrical circuit with impressed voltage £,having resistance R,inductance L,andcapacitance Cinparallel ,thecurrent isatisfies thedifferential equation di d2£ 1d£ 1 dt~C~d^+R~ dt+L£' Suppose i(0)=0,C=0.3farads ,R=1.4ohms ,L=1 . 7henries ,andthevoltage isgiven by £(t)=eoab"sin(2f-jr). UseEuler ’smethod tofindthecurrent iforthevalues t=0.1j,j=0,1,...,100. 11. Aprojectile ofmass m=0.11 kgshot vertically upward with initial velocity u(0)=8m/sisslowed duetotheforce ofgravity FK=mgandduetoairresistance Fr=— w h e r e g=— 9.8m/s2 andk=0.002 kg/m.Thedifferential equation forthevelocity t;isgiven by mu'=mg-&v|v|. a.Find thevelocity after 0.1,0.2,...,1.0s. b.Tothenearest tenth ofasecond ,determine when theprojectile reaches itsmaximum height and begins falling. 5.3 Runge -Kutta Methods Inthelastsection wesaw how Taylor methods ofarbitrary high order canbegenerated . However ,theapplication ofthese high-order methods toaspecific problem iscomplicated bytheneed todetermine andevaluate high-order derivatives with respect totontheright side ofthedifferential equation .The widespread useofcomputer algebra systems has simplified thisprocess ,butitstillremains cumbersome . Copyright 2012 Cengagc Learn in*.AIRights Reserved Mayr*xbecopied.scanned .o*implicated ,inwhole orinpar.Doctocjectronie rifhu.*wethird pur.ycontent may besupprc-icdftem theeBook and/orcChaptcnM .Editorial roiew h*> deemed CutanyMpprcucd content does notmaterialy alTcct theoverall Icamir*experience .Ceagage l.cammu reserves theright*>remove additional conceal atanytime ifvutoeqjeni nghtv restrictions require It