{VERSION 2 3 "SUN SPARC SOLARIS" "2.3" } {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 "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -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 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 205 "Solutions to the first ex am, mostly using Maple. The exams were essentially the same except fo r numbers and the order. I used symbolic numbers in two of the proble ms so you can use the ones on your test." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 33 "1. Euler and Stefan's radiation. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 147 "K:=40^(-4); M:=50; T:= 150; h:=0.1; # 10 steps to get to 1, 20 to 2.\nfor i from 1 to 20 do\n T:=T+h*K*(M^4-T^4):\n if i=10 then T1:=T: fi:\nod:\nT1,T;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "2. First solve the equation!" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "s1:=dsolve(\{diff(y(x),x)=2* y(x)-2*x*y(x), y(0)=1\}, y(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot(rhs(s1),x=0..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 " Note that " }{XPPEDIT 18 0 "y(x)" "-%\"yG6#%\"xG" }{TEXT -1 32 " is ne ver zero, so the only way " }{XPPEDIT 18 0 "diff(y(x),x)" "-%%diffG6$- %\"yG6#%\"xGF(" }{TEXT -1 12 " is 0 is at " }{XPPEDIT 18 0 "x=1" "/%\" xG\"\"\"" }{TEXT -1 28 ", which also fits the graph." }}{PARA 0 "" 0 " " {TEXT -1 2 "3." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "dsolve( x*diff(y(x),x)+2*y(x)=1/x^3,y(x));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 40 "4. This is exact, and the potential is " }{XPPEDIT 18 0 "F(x,t )=x*exp(t)+t-x" "/-%\"FG6$%\"xG%\"tG,(*&F&\"\"\"-%$expG6#F'F*F*F'F*F&! \"\"" }{TEXT -1 21 ", so the solution is " }{XPPEDIT 18 0 "x*exp(t)+t- x=C" "/,(*&%\"xG\"\"\"-%$expG6#%\"tGF&F&F*F&F%!\"\"%\"CG" }{TEXT -1 36 ". Use the initial condition to get " }{XPPEDIT 18 0 "C=exp(1)" "/ %\"CG-%$expG6#\"\"\"" }{TEXT -1 33 ". Or just use Maple all the way: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "dsolve(\{diff(x(t),t)=- (x(t)*exp(t)+1)/(exp(t)-1),x(1)=1\},x(t));" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 61 "solve(x*exp(t)+t-x=exp(1),x); # so this checks with the other" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "5. Use Maple:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "restart; dsolve(diff(P(t),t) =P(t)*(a-b*ln(P(t))),P(t));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "solve(\",P(t));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "assu me(a>0,b>0); # need this for the limit\nlimit(\",t=infinity);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "The wiggles ~ after " }{XPPEDIT 18 0 "a" "I\"aG6\"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "b" "I\"bG6\"" }{TEXT -1 38 " indicate an assumption has been made." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "6. Use Maple: \+ The variable T is defined, so restart first." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 113 "restart; T0:=96; atime:=6; Tatit:=76; M:=21; Ta rget:=56;\ns6:=rhs(dsolve(\{diff(T(t),t)=k*(M-T(t)),T(0)=T0\},T(t))); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "e6:=subs(t=atime,s6); s olve(e6=Tatit,k);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "subs(k =\",s6); solve(\"=Target,t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(\");" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "Total time: 12 minutes. Your mile age may vary." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 34 "This week: pp. 128-137, 150-169." }}{PARA 0 "" 0 "" {TEXT -1 81 "First let's finish the improved Euler's method. The equa tion we are solving is " }{XPPEDIT 18 0 "diff(y(x),x)=f(x,y)" "/-%%di ffG6$-%\"yG6#%\"xGF)-%\"fG6$F)F'" }{TEXT -1 158 ". The only change is you use a better approximation to the derivative than the forward dif ference. First you use the normal Euler method to predict the new " } {XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 2 " :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "predicted_y:=y+h*f(x,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "Now evaluate f at (" }{XPPEDIT 18 0 "(x+h,predicted _y)" "6$,&%\"xG\"\"\"%\"hGF%%,predicted_yG" }{TEXT -1 2 "):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "G:=f(x+h,predicted_y);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Now use the average of " } {XPPEDIT 18 0 "f(x,y)" "-%\"fG6$%\"xG%\"yG" }{TEXT -1 5 " and " } {XPPEDIT 18 0 "G" "I\"GG6\"" }{TEXT -1 20 " for the derivative:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "y:=y+h*(f(x,y)+G)/2;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "You can do this with only one func tion evaluation. All the evalf's are a necessary evil." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 147 "restart; # need this because of th e recursion-try it without!\nF:=evalf(f(x,y));\nxn:=evalf(x+h);\ny:=y+ h*(F+evalf(f(xn,y+evalf(h*f(x,y)))))/2;\nx:=xn;" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 17 "int(1/y/(y+1),y);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 19 "solve(\"=ln(x)+C,y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "dsolve(\{diff(y(x),x)=(y(x)^2+y(x))/x,y(1)=1\},y(x)); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "restart:plot(x/(2-x) ,x=0..1.9);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "restart:h:=. 2:f:=(x,y)->(y^2+y)/x:erk:=1:ee:=1:eei:=1:Digits:=16:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "for k to 8 do\n eok:=erk: eoe:=ee: eoi:=eei:\n h:=h/2:y:=1:x:=1:ye:=1:yrk:=1:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 " steps:=floor(.9/h+.0001);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 365 " for n to steps do\n F:=f(x,y):\n G:=f(x+h,y+ h*F):\n y:=y+h*(F+G)/2;\n ye:=ye+h*f(x,ye);\n k1:=h*f(x,yrk): \n k2:=h*f(x+h/2,yrk+k1/2):\n k3:=h*f(x+h/2,yrk+k2/2):\n k4:= h*f(x+h,yrk+k3):\n yrk:=yrk+(k1+2*k2+2*k3+k4)/6:\n x:=x+h:\n od :\n ee:=abs(19.-ye): eei:=abs(19.-y): erk:=abs(19.-yrk):\n eeu[k]:=e e/eoe: eeei[k]:=eei/eoi: eerk[k]:=erk/eok:\nod:" }}{PARA 0 "" 0 "" {TEXT -1 10 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "for k from 2 to 8 do\n eeu[k],eeei [k],eerk[k];\nod;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "h,x,n; 1+steps*h;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "Problems: p. 126 8. use " }{XPPEDIT 18 0 "h=0.1" "/%\"hG$\"\"\"!\"\"" }{TEXT -1 9 " not .2" }}{PARA 0 "" 0 "" {TEXT -1 19 "p. 136- 7, 10, 16." }}{PARA 0 "" 0 "" {TEXT -1 20 "p. 158 5, 8, 11, 12" }}{PARA 0 "" 0 "" {TEXT -1 35 "p. 167- 1, 4, 7, 10 , 15, 18, 27, 28" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "A := vector([exp(-x)* cos(x),exp(-x)*sin(x)]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Wr := w ronskian(A,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "det(Wr);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "simplify(det(Wr));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "A := vector([exp(3*x),exp(-4 *x)]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Wr := wronskian(A,x);" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "det(Wr);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 18 "simplify(det(Wr));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "A := vector([x^2*cos(ln(x)),x^2*sin(ln(x))]);" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Wr := wronskian(A,x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "det(Wr);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "simplify(det(Wr));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "d7:=diff(y(x),x,x)*x^2-2*y(x);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 18 "subs(y(x)=x^2,d7);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 12 "simplify(\");" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "subs(y(x)=x^(-1),d7);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(\");" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "A \+ := vector([x^2,1/x]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Wr := wron skian(A,x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "det(Wr);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "e1:=a*1+b*1=-2; e2:=a*2+b*(-1)=-7; " }}}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "solve(\{e1,e2\},\{a,b\});" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "A := vector([2,exp(5*x)]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Wr := wronskian(A,x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "det(Wr);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "e1:=a*2+b*1=2; e2:=b*(5)=0;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "solve(\{e1,e2\},\{a,b\});" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "58 0 0" 0 }{VIEWOPTS 1 1 0 2 1 1805 }