{VERSION 3 0 "SUN SPARC SOLARIS" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 2 0 1 0 0 0 0 0 0 } {CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "N ormal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 } {PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }{PSTYLE "Author" 0 19 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 8 8 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 18 "" 0 "" {TEXT -1 34 "Systems of Differential Equation s." }}{PARA 19 "" 0 "" {TEXT -1 20 "Math 374 Fall 1999" }}{PARA 19 " " 0 "" {TEXT -1 11 "Jay Treiman" }}{PARA 0 "" 0 "" {TEXT -1 41 "This w orksheet will help you use Maple to" }}{PARA 0 "" 0 "" {TEXT -1 58 "ex plore the solution of systems of differential equations." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Restart Map le and load the linalg, plots, and DEtools packages." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "restart;\nwith(DEtools):\nwith(plots):\nwith(lin alg):" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 43 "Solving a system of dif ferential equations." }}{PARA 0 "" 0 "" {TEXT -1 58 "The basic format \+ for a systme of differential equations is" }}{PARA 0 "" 0 "" {TEXT -1 61 "the same as for a single differential equation. Here is how " }} {PARA 0 "" 0 "" {TEXT -1 32 "one inputs the system, as a set." }} {PARA 0 "" 0 "" {TEXT -1 2 " " }{XPPEDIT 18 0 "diff(x,t) = x+y;" "6#/ -%%diffG6$%\"xG%\"tG,&F'\"\"\"%\"yGF*" }{TEXT -1 10 " and " } {XPPEDIT 18 0 "diff(y,t) = -x+y;" "6#/-%%diffG6$%\"yG%\"tG,&%\"xG!\"\" F'\"\"\"" }{TEXT -1 1 "." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 81 " deq_system_1 := \{diff(x(t),t) = x(t)+y(t),\n diff(y(t),t)= -x(t)+y(t)\};" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 14 "One then uses " }{HYPERLNK 17 "dsolve" 2 "dsolve" "" } {TEXT -1 22 " to find the solution." }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "dsolve(deq_system_1,\{x(t), y(t)\});" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 61 "One can add initial conditions to the differential equations." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "ic_s_1 := \{D(x)(0)=1,D(y)(0)=2\};\ndsolve(deq_system_1 union ic_s _1,\{x(t),y(t)\});" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 56 "Notice the form of the initial conditions. The routine " }{HYPERLNK 17 "dsolve" 2 "dsolve" "" }{TEXT -1 15 " requires a set " }}{PARA 0 "" 0 "" {TEXT -1 81 "the contains the differetial equation s and the initial conditions. Here this was" }}{PARA 0 "" 0 "" {TEXT -1 37 "accomplished through a union of sets." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "Plotting solutions." }}{PARA 0 "" 0 "" {TEXT -1 22 "Fo r this one uses the " }{HYPERLNK 17 "DEplot" 2 "DEplot" "" }{TEXT -1 39 " command. The format is different from" }}{PARA 0 "" 0 "" {TEXT -1 63 "the dsolve command. Here the initial conditions come later and " }}{PARA 0 "" 0 "" {TEXT -1 41 "should be in the form of a list of li sts." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 69 "I f one does not include any initial conditions one gets a field plot." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "DEplot(deq_system_1,[x(t),y(t)],\n t=-2..5,x=-5..5,y=-5 ..5);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 57 "By adding initial conditions one puts in solution curves." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 111 "DEp lot(deq_system_1,[x(t),y(t)],\n t=-2..2,[[x(0)=1,y(0)=2]],\n \+ x=-10..10,y=-10..10,linecolor=black);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 67 "One can also plot different combin ations of the dependent variables" }}{PARA 0 "" 0 "" {TEXT -1 29 "and \+ the independant variable." }}{PARA 0 "" 0 "" {TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 134 "DEp lot(deq_system_1,[x(t),y(t)],\n t=-2..2,[[x(0)=1,y(0)=2]],\n \+ x=-10..10,y=-10..10,linecolor=black,\n scene=[t,x(t)]);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 134 "DEplot(deq_system_1,[x(t),y (t)],\n t=-2..2,[[x(0)=1,y(0)=2]],\n x=-10..10,y=-10..10,l inecolor=black,\n scene=[t,y(t)]);" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 42 "When a closed form solution doesn't exist." }}{PARA 0 "" 0 "" {TEXT -1 58 "In class we considered projectile motion when resis tance " }}{PARA 0 "" 0 "" {TEXT -1 61 "is proportional to velocity squ ared. We got the differenital" }}{PARA 0 "" 0 "" {TEXT -1 9 "equation s" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 2 " " } {XPPEDIT 18 0 "diff(x,`$`(t,2)) = -rho*diff(x(t),t)*sqrt(diff(x(t),t)^ 2+diff(y(t),t)^2);" "6#/-%%diffG6$%\"xG-%\"$G6$%\"tG\"\"#,$*(%$rhoG\" \"\"-F%6$-F'6#F+F+F0-%%sqrtG6#,&*$-F%6$-F'6#F+F+\"\"#F0*$-F%6$-%\"yG6# F+F+\"\"#F0F0!\"\"" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 3 "and" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }{XPPEDIT 18 0 "diff(y,`$`(t,2)) = -g-rh o*diff(y(t),t)*sqrt(diff(x(t),t)^2+diff(y(t),t)^2);" "6#/-%%diffG6$%\" yG-%\"$G6$%\"tG\"\"#,&%\"gG!\"\"*(%$rhoG\"\"\"-F%6$-F'6#F+F+F2-%%sqrtG 6#,&*$-F%6$-%\"xG6#F+F+\"\"#F2*$-F%6$-F'6#F+F+\"\"#F2F2F/" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 51 "W e should translate this into a first order system." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 2 " " }{XPPEDIT 18 0 "diff(x (t),t) = z(t);" "6#/-%%diffG6$-%\"xG6#%\"tGF*-%\"zG6#F*" }{TEXT -1 3 " , " }{XPPEDIT 18 0 "diff(z(t),t) = -rho*z(t)*sqrt(z(t)^2+w(t)^2);" "6 #/-%%diffG6$-%\"zG6#%\"tGF*,$*(%$rhoG\"\"\"-F(6#F*F.-%%sqrtG6#,&*$-F(6 #F*\"\"#F.*$-%\"wG6#F*\"\"#F.F.!\"\"" }{TEXT -1 1 "," }}{PARA 0 "" 0 " " {TEXT -1 2 " " }{XPPEDIT 18 0 "diff(y(t),t) = w(t);" "6#/-%%diffG6$ -%\"yG6#%\"tGF*-%\"wG6#F*" }{TEXT -1 8 ", and " }{XPPEDIT 18 0 "diff (w(t),t) = -g-rho*w(t)*sqrt(z(t)^2+w(t)^2);" "6#/-%%diffG6$-%\"wG6#%\" tGF*,&%\"gG!\"\"*(%$rhoG\"\"\"-F(6#F*F0-%%sqrtG6#,&*$-%\"zG6#F*\"\"#F0 *$-F(6#F*\"\"#F0F0F-" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 41 "Here are the differential equations wit h " }{XPPEDIT 18 0 "rho = .3;" "6#/%$rhoG$\"\"$!\"\"" }{TEXT -1 5 " an d " }{XPPEDIT 18 0 "g = 9.8;" "6#/%\"gG$\"#)*!\"\"" }{TEXT -1 1 "." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 211 "deq_system_2 := \{diff(z(t),t) = \+ -0.3*z(t)*sqrt(z(t)^2+w(t)^2),\n diff(w(t),t) = -9.8-0.3*w(t)* \n sqrt(w(t)^2+z(t)^2),\n diff(y(t),t)=w(t),\n diff(x( t),t)=z(t)\};" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 57 "Now check to see if Maple can solve the system. You will " }}{PARA 0 "" 0 "" {TEXT -1 54 "probably want to interupt this evalua tion, it can take" }}{PARA 0 "" 0 "" {TEXT -1 16 "several minutes." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "dsolve(deq_system_2,[x(t),z(t),y(t),w(t)]);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 56 "Maple did not get a nice \+ solution. Now one can look at " }}{PARA 0 "" 0 "" {TEXT -1 25 "the so lution graphically." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1019 "DEplot(deq_system_2,\{z(t),w(t),y(t),x(t) \},t=0..2,\n [[w(0)=30*sqrt(2),z(0)=30*sqrt(2),y(0)=0,x(0)=0]],\n \+ z=-10..10,w=-10..10,x=0..10,y=0..10,\n scene=[x,y],linecolor =black,title=\"Trajectory\");\nDEplot(deq_system_2,\{z(t),w(t),y(t),x( t)\},t=0..2,\n [[w(0)=30*sqrt(2),z(0)=30*sqrt(2),y(0)=0,x(0)=0]], \n z=-10..10,w=-10..10,x=0..10,y=0..10,\n scene=[t,x],lineco lor=black,title=\"X position\");\nDEplot(deq_system_2,\{z(t),w(t),y(t) ,x(t)\},t=0..2,\n [[w(0)=30*sqrt(2),z(0)=30*sqrt(2),y(0)=0,x(0)=0] ],\n z=-10..10,w=-10..10,x=0..10,y=0..10,\n scene=[t,y],line color=black,title=\"Y position\");\nDEplot(deq_system_2,\{z(t),w(t),y( t),x(t)\},t=0..2,\n [[w(0)=30*sqrt(2),z(0)=30*sqrt(2),y(0)=0,x(0)= 0]],\n z=-50..50,w=-50..50,x=0..10,y=0..10,\n scene=[t,z],li necolor=black,title=\"X velocity\");\nDEplot(deq_system_2,\{z(t),w(t), y(t),x(t)\},t=0..2,\n [[w(0)=30*sqrt(2),z(0)=30*sqrt(2),y(0)=0,x(0 )=0]],\n z=-50..50,w=-50..50,x=0..10,y=0..10,\n scene=[t,w], linecolor=black,title=\"Y velocity\");" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 25 "Getting numerical output." }}{PARA 0 "" 0 "" {TEXT -1 49 "One can also get Maple to use a numerical method " }}{PARA 0 "" 0 "" {TEXT -1 58 "for solving a first order system of differential equation ." }}{PARA 0 "" 0 "" {TEXT -1 59 "As with first order ordinary differe ntial equations one use" }}{PARA 0 "" 0 "" {HYPERLNK 17 "dsolve,numeri c" 2 "dsolve,numeric" "" }{TEXT -1 40 ". This command can generate a \+ procedure" }}{PARA 0 "" 0 "" {TEXT -1 60 "to generate numerical values or a table of numerical values." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 57 "Here is Euler's method applied to our tra jectory problem." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 253 "inits := \{w(0)=30*sqrt(2),z(0)=30*sqrt(2),\n y(0)=0,x(0)=0\};\nEuler_soln := dsolve(deq_system_2 union inits,\n [x(t),y(t),z(t),w(t)], type=numeric,\n method=classi cal[foreuler],\n value=array([seq(i*.1,i=0..20)]), \n stepsize =0.1);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 52 "It is easy to do the same with a Runge-Kutta method." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 174 "RK4_ soln := dsolve(deq_system_2 union inits,\n [x(t),y(t),z(t),w(t)], \+ type=numeric,\n method=classical[rk4],\n value=array([seq(i*.1 ,i=0..20)]), \n stepsize=0.1);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 53 "One can also use adaptaive methods. The is the RKF45" }}{PARA 0 "" 0 "" {TEXT -1 7 "method." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 147 "RKF45_sol n := dsolve(deq_system_2 union inits,\n [x(t),y(t),z(t),w(t)], typ e=numeric,\n method=rkf45,\n value=array([seq(i*.1,i=0..20)])) ;" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 9 "Exercises" }}{PARA 0 "" 0 " " {TEXT -1 2 "1." }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "Use the method s above to compare the trajectories" }}{PARA 0 "" 0 "" {TEXT -1 55 "fo r a projectile with no friction, drag proportional to" }}{PARA 0 "" 0 "" {XPPEDIT 18 0 "v;" "6#%\"vG" }{TEXT -1 26 " and drag proportional t o " }{XPPEDIT 18 0 "v^(3/2);" "6#)%\"vG*&\"\"$\"\"\"\"\"#!\"\"" } {TEXT -1 20 " with the trajectory" }}{PARA 0 "" 0 "" {TEXT -1 53 "abov e. Which do you think is the best approximation?" }}{PARA 0 "" 0 "" {TEXT -1 4 "Why?" }}}{PARA 0 "" 0 "" {TEXT -1 2 "2." }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Plot the vector field for the system of different ial" }}{PARA 0 "" 0 "" {TEXT -1 9 "equations" }}{PARA 0 "" 0 "" {TEXT -1 2 " " }{XPPEDIT 18 0 "diff(x(t),t) = x+2*y;" "6#/-%%diffG6$-%\"xG6 #%\"tGF*,&F(\"\"\"*&\"\"#F,%\"yGF,F," }{TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 3 "and" }}{PARA 0 "" 0 "" {TEXT -1 2 " " }{XPPEDIT 18 0 "d iff(y(t),t) = -2*x-2*y;" "6#/-%%diffG6$-%\"yG6#%\"tGF*,&*&\"\"#\"\"\"% \"xGF.!\"\"*&\"\"#F.F(F.F0" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 44 "along with several solution curves. What do" }}{PARA 0 "" 0 "" {TEXT -1 35 "you think happens to all solutions?" }}}}}{MARK "1 0" 15 }{VIEWOPTS 1 1 0 1 1 1803 }