{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 44 "# Code snips for exa ct/error reports 2.4-#5\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 262 "# =========================================\n# Making multiple cu rves on one plot\n# ========================================\n Exact: =x->2+x-exp(x); # An exact solution for #5\n plot(\{Exa ct(x),[Dots]\},x=0..1/2); # plot exact and approx solutions\n\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 220 "# ========================= ===============\n# How to create a Dots table for the exact solution\n # ========================================\nExact:= x -> 2+x-exp(x):\n ExactDots:=seq([Dots[j][1],Exact(Dots[j][1])],j=1..11);\n\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 395 "# ========================= ===============\n# How to define and print percentage error:\n# ====== ==================================\n Perr:=(exact,approx)->evalf(100* abs(exact-approx)/abs(exact));\n ExactVal:=ExactDots[11][2]: # Pick off exact y-value for x=0.5\n ApproxVal:=Dots[11][2]: # Get Eu ler approx y-value for x=0.5\n Perr(ExactVal),ApproxVal); # print \+ percent relative error\n\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 270 "# ========================================\n# How to create a Dot s table for percentage error\n# ====================================== ==\nPerr:=(exact,approx)->evalf(100*abs(exact-approx)/abs(exact));\nPe rrDots:=seq([Dots[j][1],Perr(ExactDots[j][2],Dots[j][2])],j=1..11);\n \n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 310 "# ================== =======================\n# Printing results and tables\n# Make tables \+ with a pencil, it saves time. \n# ==================================== ====\n# To extract and print items 1,101,201,1001 from a list:\nDots1: =Dots[1],Dots[101],Dots[201],Dots[1001];\n\n# ======================== =================" }}}}{MARK "5 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }