Mah 2280 Wednesda March 3, 200 4., 4.3: Firs order ssems of Differenial Equaions Wh ou should epec eisence and uniqueness for he IVP Eample: Consider he iniial value problem relaed o page 4 of his eserda s class noes. d d = 0 0.0 0.2 = 0 Remember, his was a firs order ssem we go b convering a second order DE for a cerain damped spring oscillaion problem, () +.2 () +.0 () = 0 (0)= (0)=0 so we alread know he soluion. I is (fill in here!)
Bu le s preend we don know he soluion, and r o undersand wh we would epec one, and wh we would epec i o be unique, jus based on he geomeric meaning of his IVP: If we plo he soluion curve [((),()] in he plane, i passes hrough [,0] a =0, and hen moves so ha is angen vecor [ (), ()] agrees wih he DE vecor field a he poin [(),()], namel wih [,.0.2]. So if we creae a picure of he vecor field we can visualize where he soluion rajecor mus sar and hen go: resar:wih(deools):wih(plos):wih(linearalgebra): fieldplo([,.0*.2*],=..,=...); 0 We can use Euler s mehod o ge an approimae numerical soluion! In oher words, approimae using he angen line approimaion, and for he angen vecor use wha he differenial equaion sas i is (hose equals signs are reall approimae equals signs): = d d =.0 0.2.
Wih he specified iniial condiions we sar a he poin [,0], and hen follow he angen field around a curve which looks a lo like a spiral. If we wan o ge a numerical approimaion, we can jus ranspose Euler (or improved Euler or Runge Kua) for firs order equaions o firs order ssems... all he original jusificaions make jus as much sense in vecor form!!! (Or we can use one of Maple s numerical packages.) f:=(,,) >: f2:=(,,) >.0*.2*: #our righ hand side F(X,)=[f(X,),f2(X,)] #in our firs order ssem of DE s dx/ = F(,X). n:=00: #number of ime seps 0:=0: #iniial ime n:=evalf(2*pi): #final ime choice h:=(n 0)/n: #ime sep s:=vecor(n+): s:=vecor(n+): #vecors o hold Euler approimaes s[]:=: s[]:=0: #iniial condiions Euler loop #Euler loop: for i from o n do X:=s[i]: Y:=s[i]: :=0+(i )*h: k:=f(x,y,): k2:=f2(x,y,): #k and k2 are veloci componens s[i+]:=x+h*k: s[i+]:=y+h*k2: #updae s and s wih Euler! od:
angefield:=fieldplo([,.0*.2*],=...0,=...): alpha:=arcan(.): C:=/cos(alpha): Eulerappro:=poinplo({seq([s[i],s[i]],i=..n+)}): eacsol:=plo([c*ep(.*s)*cos(s alpha), C*ep(.*s)*(.*cos(s alpha) sin(s alpha)), s=0..2*pi],color=black): #This is he acual #soluion o he IVP displa({angefield,eulerappro,eacsol},ile="go wih he flow"); go wih he flow 0 An firs order ssem is analogous o he above eample, and ha s wh we epec eisence and uniqueness in general. As wih firs order DE s, we ll ge beer approimae soluions using more sophisicaed algorihms, like improved Euler and Runge Kua. For eample, here s some improved Euler code, firs for he firs order scalar ODE, hen convered o he ssem above. Original improved Euler loop, solen from he file numerical.mw, in our class lecures direcor. for i from o n do k:=f(,): #lef hand slope k2:=f(+h,+h*k): #approimaion o righ hand slope k:= (k+k2)/2: #approimaion o average slope := +h*k: #improved Euler updae := +h: #updae prin(,,ep()); od: We now vecorize everhing, and sore he [,] values in a vecor so we can make a picure like we did for unimproved Euler. (Before eecuing he code one he ne page I re enered all he iniializaion definiions from he previous page.)
Improved Euler loop for firs order ssem of wo differenial equaions: #Improved Euler loop: for i from o n do X:=s[i]: Y:=s[i]: :=0+(i )*h: k:=f(x,y,): k2:=f2(x,y,): #k and k2 are lef hand angen esimaes k2:=f(x+h*k,y+h*k2,): k22:=f2(x+h*k,y+h*k2,): #k2 and k22 are righ hand angen esimaes s[i+]:=x+h*(k+k2)/2: s[i+]:=y+h*(k2+k22)/2: #updae s and s wih improved Euler! od: angefield:=fieldplo([,.0*.2*],=...0,=...): alpha:=arcan(.): C:=/cos(alpha): Eulerappro:=poinplo({seq([s[i],s[i]],i=..n+)}): eacsol:=plo([c*ep(.*s)*cos(s alpha), C*ep(.*s)*(.*cos(s alpha) sin(s alpha)), s=0..2*pi],color=black): #This is he acual #soluion o he IVP, more complicaed han #he formula in eserda s noes, bu correc #for his IVP, I hope. displa({angefield,eulerappro,eacsol},ile="go wih he flow beer wih Improved Euler"); go wih he flow beer wih Improved Euler 0
Remarks: () An single nh order differenial equaion is equivalen o a relaed firs order ssem of n firs order differenial equaions, as we ve been discussing. You ge his ssem in he same wa as we did in he worked ou eample. Then he eisence and uniqueness heorem for firs order ssems, which makes clear geomeric sense, implies he eisence and uniqueness heorem ha we quoed a monh ago for nh order (linear) differenial equaions (which wasn as inuiivel believable). (2) If ou wan o solve an nh order differenial equaion numericall ou firs conver i o a firs order ssem, and hen use Euler or Runge Kua, o solve i! (Or ou use a package ha does somehing like ha while ou aren looking.) Oher nea eamples: The picures we drew above are called "phase porrais", like he d phase diagrams we drew for auonomous single firs order equaions in chaper 2. (To ge picures analgous o he 2 d (,) slope field picures ou would need o inroduce a "" ais, so ou d be drawing a 3 d (,,) skech.) If ou remember ha for he mechanical eamples he verical direcion corresponds o veloci and he horizonal direcion corresponds o posiion, hen he phase porrai is a beauiful wa o ehibi posiion and veloci simulaneousl (alhough ime is no eplicil shown). Here are some oher mechanical ssems convered ino firs order ssems: Undamped harmonic oscillaor: Le m=k= and c=0 in he mass spring differenial equaion. Thus, for displacemen (), d 2 2 = 0. Convering his o a firs order ssem as before, i.e. inroducing he funcion () as a pro for (), ields d d Can ou eplain he picure on he ne page? Can ou eplain wh he soluions curves [(),()] raverse circles, direcl from he DE? How is his relaed o he oal energ (KE+PE) of he oscillaor being consan? =
resar: wih(plos): plo:=fieldplo([, ],=.5...5,=.5...5): plo2:=plo({[cos(), sin(),=0..2*pi], [.5*cos(),.5*sin(),=0..2*Pi]},color=black): displa({plo,plo2},ile= undamped harmonic oscillaor ); undamped harmonic oscillaor.5.5 0.5 Nonlinear pendulum: Recall ha (for g=l) he non linear pendulum equaion was d 2.5 L 2 g sin = 0 and ha we derived his equaion b seing he derivaive of he oal energ equal o zero, where his sum of kineic and poenial energ was given b m L 2 2 d E = m g L cos. 2 If we ake L=g, and wrie = = d we ge he equivalen firs order ssem d d = sin.
Wha are he equilibrium soluions of his auonomous ssem? Which ones do ou hink are "sable"? Inerpre his picure: velocfield:=fieldplo([, sin()],= 7..7,= 4..4): pendeqn:={diff((),)=(),diff((),)= sin(()), (0)=0,(0)=}: raj:=odeplo(dsolve(pendeqn,[(),()], pe=numeric),[(),()],0..3, numpoins=25,color=black): pendeqn2:={diff((),)=(),diff((),)= sin(()), (0)= 3.,(0)=0}: raj2:=odeplo(dsolve(pendeqn2,[(),()],pe=numeric), [(),()],0..3,numpoins=25,color=black): pendeqn3:={diff((),)=(),diff((),)= sin(()), (0)= 3.,(0)=}: raj3:=odeplo(dsolve(pendeqn3,[(),()], pe=numeric),[(),()], 0..3,numpoins=25,color=black): displa({velocfield,raj,raj2,raj3}, ile="nonlinear pendulum moion"); nonlinear pendulum moion 4 3 2 6 4 2 0 2 4 6 2 3 4 Noice ha if ou magnif he picure near he origin, i sars looking like he undamped harmonic oscillaor of he previous eample. If we added appropriae damping o our pendulum model, hen he magnified picure near he origin could conceivabl look like our original eample of he damped harmonic oscillaor. These are geomeric illusraions of he idea of linearizaion! (You could also linearize near he unsable equilibria.)