{VERSION 5 0 "IBM INTEL NT" "5.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 Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT 257 21 "Forward Euler Method." } {TEXT -1 47 " Written for Math 251, Fall 2001 by J.Gerlach." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "This is a routine which executes Euler's method." }}{PARA 0 "" 0 "" {TEXT -1 21 "The input consists of" }}{PARA 0 "" 0 "" {TEXT -1 36 "f the differential equation" }}{PARA 0 "" 0 "" {TEXT -1 46 "a,b the coordinates of the starting point" }}{PARA 0 "" 0 "" {TEXT -1 26 "L the final x-value" }}{PARA 0 "" 0 "" {TEXT -1 22 "h the step size" }}{PARA 0 "" 0 "" {TEXT -1 83 "The output \+ is an array of points, containing the coordinates of the approximation s." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 226 "Euler := proc(f,a,b,L,h)\nlo cal N, x,y,j,pt,dy, pts;\nN := round(L/h)+1;\nx := a; y:= b;\npt(1) : = [x,y];\nfor j from 2 to N do\ndy := h*f(x,y);\nx := x+h; y := y + d y;\npt(j) := [x,y];\nend do;\npts := [seq(pt(j),j=1..N)];\nend proc:\n " }}}{EXCHG {PARA 0 "" 0 "" {TEXT 256 8 "Example:" }{TEXT -1 38 " Sol ve the initial value problem " }{XPPEDIT 18 0 "y;" "6#%\"yG" } {TEXT -1 4 "' = " }{XPPEDIT 18 0 "1-x*y^2;" "6#,&\"\"\"F$*&%\"xGF$*$% \"yG\"\"#F$!\"\"" }{TEXT -1 3 " " }{XPPEDIT 18 0 "y(0) = 1;" "6#/-% \"yG6#\"\"!\"\"\"" }{TEXT -1 86 " on the interval [0,2] with step size h=0.1, and generate a plot of the solution.." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{MPLTEXT 1 0 21 "f:= (x ,y) -> 1-x*y^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "pts := E uler(f,0,1,2,.1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "plot(p ts,style=point);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {MARK "1 7 0" 71 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }