{VERSION 3 0 "IBM INTEL NT" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 } {CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 }{CSTYLE " " 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 }{CSTYLE "Help Heading" -1 26 "" 1 14 0 0 0 0 0 1 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 }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 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 8 "Advice: " }{TEXT -1 34 "Automatic simplification and evalf" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 4 "The " } {MPLTEXT 0 21 5 "evalf" }{TEXT -1 184 " function has a second, optiona l, argument which sets the number of digits to be used in the computat ion of the first argument. Without this second argument, the environm ent variable " }{MPLTEXT 0 21 6 "Digits" }{TEXT -1 222 " sets the numb er of digits. However, in some cases the second argument is not effec tive. The reason is a very fundamental aspect of the way Maple proces ses input. Here is an example. First a calculation at the default " }{MPLTEXT 0 21 9 "Digits=10" }{TEXT -1 1 "." }}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 26 "Digits:= 10: t:= 3.0:\n1/t;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"+LLLLL!#5" }}}{PARA 0 "" 0 "" {TEXT -1 24 "Now a cal culation using " }{MPLTEXT 0 21 5 "evalf" }{TEXT -1 27 " with its seco nd parameter." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "evalf(1/t,2 0);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"5LLLLLLLLLL!#?" }}}{PARA 0 " " 0 "" {TEXT -1 24 "However, if you replace " }{MPLTEXT 0 21 1 "t" } {TEXT -1 18 " by its value 3.0:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "evalf(1/3.0,20);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"+LLLLL! #5" }}}{PARA 0 "" 0 "" {TEXT -1 68 "What happened? Unlike nearly all \+ Maple functions, the arguments to " }{MPLTEXT 0 21 5 "evalf" }{TEXT -1 39 " are not evaluated first. This is why " }{MPLTEXT 0 21 13 "eva lf(1/t,20)" }{TEXT -1 22 " worked: the argument " }{MPLTEXT 0 21 3 "1/ t" }{TEXT -1 15 " was passed to " }{MPLTEXT 0 21 5 "evalf" }{TEXT -1 50 " unchanged, rather than being evaluated (which at " }{MPLTEXT 0 21 11 "Digits = 10" }{TEXT -1 238 " would have resulted in .3333333333 ). But even though evaluation is not done, there is always some autom atic simplification applied to any input, and among the simplification s performed are arithmetic operations involving numbers. Thus " } {MPLTEXT 0 21 5 "1/3.0" }{TEXT -1 65 " was immediately simplified to . 3333333333 (at the current value " }{MPLTEXT 0 21 11 "Digits = 10" } {TEXT -1 9 ") before " }{MPLTEXT 0 21 5 "evalf" }{TEXT -1 33 " could o perate on the expression." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 82 "There are two ways to work around this problem. O ne is to use variables (such as " }{MPLTEXT 0 21 1 "t" }{TEXT -1 117 " above) to prevent the automatic simplifier from performing arithmetic . A second is to use the environment variable " }{MPLTEXT 0 21 6 "Dig its" }{TEXT -1 35 " instead of the second argument to " }{MPLTEXT 0 21 5 "evalf" }{TEXT -1 1 ":" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "Digits:= 20:\n1/3.0;\nDigits:= 10:" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"5LLLLLLLLLL!#?" }}}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 9 "See a lso:" }{TEXT -1 1 " " }{HYPERLNK 17 "Digits" 2 "Digits" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "evalf" 2 "evalf" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "Exact vs. floating-point computations" 2 "Exact_vs._floating-point _computations" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "Forcing floating-poi nt arithmetic" 2 "Forcing_floating-point_arithmetic" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "Roundoff error" 2 "Roundoff_error" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "The meaning of Digits" 2 "The_meaning_of_Digits" "" }}}{SECT 0 {PARA 0 "" 0 "" {TEXT 26 24 "Maple Advisor Database, " } {TEXT -1 15 " R. Israel 1997" }}}}{MARK "3" 0 }{VIEWOPTS 1 1 0 1 1 1803 }