{VERSION 5 0 "IBM INTEL LINUX" "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 }{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 27 "with(DEtools):\nwith (plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 130 "# Ch. 6.12 Ex. 21 part a) \nslopefield:=DEplot( diff(y(x),x)=x+y(x), \n y(x), x=-4. .4, y=-4..4 , arrows=line):\ndisplay(slopefield);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 72 "# Ch. 6.12 Ex. 21 part b)\nsolution:=dsolve( diff(y(x),x)=x+y(x), y(x) );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 355 "# Ch. 6.12 Ex. 21 part c)\n# This extracts the right hand side \+ of the above equation y(x)=...\nop(2,solution);\nf1 := subs(_C1=-2, op (2,solution) );\nf2 := subs(_C1=-1, op(2,solution) );\nf3 := subs(_C1= 0, op(2,solution) );\nf4 := subs(_C1= 1, op(2,solution) );\nf5 := sub s(_C1= 2, op(2,solution) );\ndisplay( slopefield, plot([f1,f2,f3,f4,f5 ],x=-4..4, -4..4) );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 162 "# \+ Ch. 6.12 Ex. 21 part d) \nsolution:=dsolve( \{diff(y(x),x)=x+y(x), y(0 )=-7/10\}, y(x) );\nf:=op(2,solution);\nsolutiongraph:=plot(f, x=0..1) :\ndisplay(solutiongraph);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 288 "# Ch. 6.12 Ex. 21 part e) \neuler4 := dsolve( \{diff(y(x),x)=x+y (x), y(0)=-7/10\}, y(x), \n numeric, method=classical [foreuler], stepsize=1/4);\neuler4plot:= plot( 'op([2,2],euler4(x))', \+ x=0..1, adaptive=false, numpoints=5 , color=yellow):\ndisplay(solution graph, euler4plot);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 777 "# C h. 6.12 Ex. 21 part f) \neuler8 := dsolve( \{diff(y(x),x)=x+y(x), y(0) =-7/10\}, y(x), \n numeric, method=classical[foreuler ], stepsize=1/8);\neuler8plot:= plot( 'op([2,2],euler8(x))', x=0..1, a daptive=false, numpoints=9 , color=cyan):\n\neuler16:= dsolve( \{diff( y(x),x)=x+y(x), y(0)=-7/10\}, y(x), \n numeric, metho d=classical[foreuler], stepsize=1/16);\neuler16plot:=plot( 'op([2,2],e uler16(x))', x=0..1, adaptive=false, numpoints=17, color=green):\n\neu ler32:= dsolve( \{diff(y(x),x)=x+y(x), y(0)=-7/10\}, y(x), \n \+ numeric, method=classical[foreuler], stepsize=1/32);\neuler32 plot:=plot( 'op([2,2],euler32(x))', x=0..1, adaptive=false, numpoints= 33, color=blue):\n\ndisplay(solutiongraph, euler4plot, euler8plot, eul er16plot, euler32plot);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 943 "# Ch. 6.12 Ex. 21 part g) \neuler4 := dsolve( \{diff(y(x),x)=x+y(x), \+ y(0)=-7/10\}, y(x), \n numeric, method=classical[fore uler], stepsize=1/4);\neuler8 := dsolve( \{diff(y(x),x)=x+y(x), y(0)=- 7/10\}, y(x), \n numeric, method=classical[foreuler], stepsize=1/8);\neuler16:= dsolve( \{diff(y(x),x)=x+y(x), y(0)=-7/10\} , y(x), \n numeric, method=classical[foreuler], steps ize=1/16);\neuler32:= dsolve( \{diff(y(x),x)=x+y(x), y(0)=-7/10\}, y(x ), \n numeric, method=classical[foreuler], stepsize=1 /32);\nf4 := op([2,2],euler4(1) );\nf8 := op([2,2],euler8(1) );\nf16:= op([2,2],euler16(1));\nf32:= op([2,2],euler32(1));\nfexact:= evalf( s ubs(x=1, f) );\n\nerror4:= fexact-f4;\nerror8:= fexact-f8;\nerror16:= \+ fexact-f16;\nerror32:= fexact-f32;\n\npercentageerror4 := (fexact-f4 ) /fexact;\npercentageerror8 := (fexact-f8 )/fexact;\npercentageerror16: = (fexact-f16)/fexact;\npercentageerror32:= (fexact-f32)/fexact;\n" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "9" 0 } {VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }