{VERSION 4 0 "SUN SPARC SOLARIS" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 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 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Text Output " -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 3 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE " " -1 -1 "" 0 1 0 0 255 1 0 0 0 0 0 0 1 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Plot" 0 13 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 } {PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 256 "" 0 "" {TEXT 256 11 "Math 2280-2" }}{PARA 257 "" 0 "" {TEXT 257 23 "Maple Project 1, Part 2" }}{PARA 258 "" 0 "" {TEXT -1 16 "January 25, 2001" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 60 " You should download this file from our Maple ho me page " }{TEXT 259 62 "http://www.math.utah.edu/~korevaar/2280spring 01/2280maple.html" }{TEXT -1 190 ", and then open it from Maple. It c ontains discussion and Maple commands which will help you answer the q uestions on the Part 2 solution template, which is also available at t he Maple page." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 629 " In this part of the project we will study numerical methods for approximating solutions to first order differential equat ions. We will see soon how higher order differential equations can be converted into first order systems of differential equations. It tu rns out that there is a natural way to generalize what we do here in t he context of a single first order differential equations, to systems \+ of first order differential equations. So understanding this project \+ material will be an important step in understanding numerical solutio ns to higher order differential equations and to systems of differenti al equations." }}{PARA 0 "" 0 "" {TEXT -1 75 " We will be working \+ through material from sections 2.4-2.6 of the text." }}{PARA 0 "" 0 " " {TEXT -1 1036 " The most basic method of approximating solutions to differential equations is called Euler's method, after the 1700's \+ mathematician who first formulated it. If you want to approximate the solution to the initial value problem dy/dx = f(x,y), y(x0)=y0, first pick a step size ``h''. Then for x between x0 and x0+h, use the cons tant slope f(x0,y0). At x-value x1:=x0+h your y-value will therefore \+ be y1:=y0 + f(x0,y0)h. Then for x between x1 and x1+h you use the con stant slope f(x1,y1), so that at x2:=x1+h your y-value is y2:=y1+f(x1, y1)h. You continue in this manner. It is easy to visualize if you un derstand the slope field concept we've been talking about; you just us e the slope field with finite rather than infinitesimal stepping in th e x-variable. You use the value of the slope field at your current po int to get a slope which you use to move to the next point. It is str aightforward to have the computer do this sort of tedious computation \+ for you. In Euler's time such computations would have been done by ha nd!" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }{TEXT 258 1 " " }{TEXT -1 464 " A good first example to illustrate Euler's method is our favorite D E from the time of Calculus, namely dy/dx =y, say with initial value y (0)=1, so that y=exp(x) is the solution. Let's take h=0.2 and try to \+ approximate the solution of the x-interval [0,1]. Since the approxima te solution will be piecewise affine, we only need to know the approxi mations at the discrete x values x=0,0.2,0.4,0.6,0.8,1. Here's a simp le ``do loop'' to make these computations. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "restart: #clear a ny memory from earlier work " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 150 "x0:=0.0; xn:=1.0; y0:=1.0; n:=5; h:=(xn-x0)/n; \n # specify \+ initial\n # values, number of steps, step size. \+ " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#x0G$\"\"!F& " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#xnG$\"#5!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#y0G$\"#5!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# >%\"nG\"\"&" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"hG$\"+++++?!#5" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 100 "f:=(x,y)->y; \n #this \+ is the \"slope\" function f(x,y) \n #in dy/dx = f(x,y). We want dy/ dx = y." }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fGR6$%\"xG%\"yG6\"6$%)o peratorG%&arrowGF)9%F)F)F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "x:=x0; y:=y0; #initialize x,y for the do loop" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%\"xG$\"\"!F&" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>% \"yG$\"#5!\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 340 "for i fr om 1 to n do\n k:= f(x,y): #current slope, use : to suppress output\n y:= y + h*k: #new y value via Euler\n x:= \+ x + h: #updated x-value:\n print(x,y,exp(x)); \n \+ #display current values, \n #and compare to exact solutio n.\n od: \n #``od'' ends a do loop " }}{PARA 11 "" 1 "" {XPPMATH 20 "6%$\"+++++?!#5$\"+++++7!\"*$\"+eFS@7F(" }} {PARA 11 "" 1 "" {XPPMATH 20 "6%$\"+++++S!#5$\"++++S9!\"*$\"+)pC=\\\"F (" }}{PARA 11 "" 1 "" {XPPMATH 20 "6%$\"+++++g!#5$\"++++G " 0 "" {MPLTEXT 1 0 25 "with(plots):with(linalg):" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 68 "xval:=vector(n+1);yval:=vector(n+1); \n #to collect all our points" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%xvalG-%& arrayG6$;\"\"\"\"\"'7\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%yvalG-%& arrayG6$;\"\"\"\"\"'7\"" }}}{PARA 11 "" 1 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "xval[1]:=x0; yval[1]:=y0; \n #initial values" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>&%%xvalG6#\"\" \"$\"\"!F)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>&%%yvalG6#\"\"\"$\"#5! \"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 347 " #paste in the pr evious work, and modify for plotting:\nfor i from 1 to n do\n \+ x:=xval[i]: #current x\n y:=yval[i]: #current y\n \+ k:= f(x,y): #current slope\n yval[i+1]:= y + h*k: #new y \+ value via Euler\n xval[i+1]:= x + h: #updated x-value:\n \+ od: #``od'' ends a do loop " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "approxsol:=pointplot(\{seq([xval[i] ,yval[i]], i=1..n+1)\}):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 95 "exactsol:=plot(exp(t),t=0..1,`color`=`black`): \n #used t becau se x was already used above" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "display(\{approxsol,exactsol\});" }}{PARA 13 "" 1 "" {GLPLOT2D 298 257 257 {PLOTDATA 2 "6&-%'CURVESG6$7S7$$\"\"!F)$\"\"\"F)7$$\"3dmmm ;arz@!#>$\"3)y_2wWO?-\"!#<7$$\"3[LL$e9ui2%F/$\"3aNdbY\\gT5F27$$\"3nmmm \"z_\"4iF/$\"3#=fT9tfS1\"F27$$\"3[mmmT&phN)F/$\"3;Hr`&G_r3\"F27$$\"3BL Le*=)H\\5!#=$\"3L^LEiEj56F27$$\"3fmm\"z/3uC\"FE$\"3q]yZ%yaG8\"F27$$\"3 %)***\\7LRDX\"FE$\"3')oPGkJLc6F27$$\"3]mm\"zR'ok;FE$\"3-Am\"\\\\E6=\"F 27$$\"3v***\\i5`h(=FE$\"36)e/'[$pj?\"F27$$\"3WLLL3En$4#FE$\"3]RSV5x*GB \"F27$$\"3pmm;/RE&G#FE$\"3)>3j2pYnD\"F27$$\"3\")*****\\K]4]#FE$\"3Sm9j Yu9%G\"F27$$\"3$******\\PAvr#FE$\"3%*p#e<$=E78F27$$\"3)******\\nHi#HFE $\"3PYw>&\\P*R8F27$$\"3jmm\"z*ev:JFE$\"3@KG01]dl8F27$$\"3?LLL347TLFE$ \"3?9H.#p*p'R\"F27$$\"3+LLLLY.KNFE$\"35Lbfo2iB9F27$$\"3v***\\7o7Tv$FE$ \"3\"ouv#H**eb9F27$$\"3&GLLLQ*o]RFE$\"3r1/UDl[%[\"F27$$\"3@++D\"=lj;%F E$\"3\\;8&[1^o^\"F27$$\"31++vV&R
'=e\"F27$$\"3GLLeR\"3Gy%FE$\"3+.c]c%)H8;F27$$\"3cmm;/T1&
*\\FE$\"3#**eh)zw!zk\"F27$$\"3%em;zRQb@&FE$\"3G,G!GGVYo\"F27$$\"3[***
\\(=>Y2aFE$\"3L6+U5yG< '=e
\"F`[m7$$\"3GLLeR\"3Gy%Fc\\m$\"3+.c]c%)H8;F`[m7$$\"3cmm;/T1&*\\Fc\\m$
\"3#**eh)zw!zk\"F`[m7$$\"3%em;zRQb@&Fc\\m$\"3G,G!GGVYo\"F`[m7$$\"3[***
\\(=>Y2aFc\\m$\"3L6+U5yG<