{VERSION 5 0 "SUN SPARC SOLARIS" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 1 18 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{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 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 222 " Warning: These sni ps of code made for y'=1-x-y, y(0)=3.\n# Code computes approx values for y(0.1) to y(1.0).\n# 'Dots' is the list of dots for connec t-the-dots graphics. \n# ========================================\n" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 83 "# Euler. Group 1, initiali ze.\n f:=(x,y)->1-x-y:\n x0:=0:y0:=3:h:=0.1:Dots:=[x0,y0]:\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 98 "# Group 2, repeat 10 times. \+ Euler's method\n Y:=y0+h*f(x0,y0);\n x0:=x0+h:y0:=Y:Dots:=Dots,[x0,y0] ;\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "# Group 3, plot.\n p lot([Dots]);\n\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 125 "# ==== ====================================\n# Heun. Group 1, initialize.\n f :=(x,y)->1-x-y:\n x0:=0:y0:=3:h:=0.1:Dots:=[x0,y0]:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 131 "# Group 2, repeat 10 times. Heun m ethod.\n Y1:=y0+h*f(x0,y0);\n Y:=y0+h*(f(x0,y0)+f(x0+h,Y1))/2:\n x0:=x 0+h:y0:=Y:Dots:=Dots,[x0,y0];\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "# Group 3, plot.\n plot([Dots]);\n\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 124 "# ========================================\n# R K4. Group 1, initialize.\n f:=(x,y)->1-x-y:\n x0:=0:y0:=3:h:=0.1:Dots: =[x0,y0]:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 189 "# Group 2, \+ repeat 10 times. RK4 method.\nk1:=h*f(x0,y0):\nk2:=h*f(x0+h/2,y0+k1/2) :\nk3:=h*f(x0+h/2,y0+k2/2):\nk4:=h*f(x0+h,y0+k3):\nY:=y0+(k1+2*k2+2*k3 +k4)/6:\nx0:=x0+h:y0:=Y:Dots:=Dots,[x0,y0];\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "# Group 3, plot.\n plot([Dots]);\n\n" }}}}{MARK "10" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }