{VERSION 2 3 "SUN SPARC SOLARIS" "2.3" }
{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 Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "2
D 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 "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255
1 0 0 0 0 0 1 3 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading
1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0
6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1
0 0 255 1 0 0 0 0 0 0 1 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 37 "Exact vs. floating-point computations" }
}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 154 "Maple c
an use exact arithmetic, where rational numbers are expressed as fract
ions and irrational numbers are expressed using symbolic expressions s
uch as " }{XPPEDIT 18 0 "sqrt(2*Pi)" "-%%sqrtG6#*&\"\"#\"\"\"%#PiGF'"
}{TEXT -1 54 ", or floating-point arithmetic, where numbers such as "
}{XPPEDIT 18 0 "2.506628274" "$\"+u#Gm]#!\"*" }{TEXT -1 336 " are expr
essed using a certain number of decimal places. It is often important
to decide which of these is more appropriate in a particular problem.
Often there is a tradeoff to consider: exact arithmetic avoids any p
roblems of roundoff error, but can be much slower than floating-point \+
and may result in very complicated expressions." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 408 "The following is an exam
ple of exact arithmetic. To save space, the result has been deleted f
rom this help page: it is a fraction where both numerator and denomina
tor have 15710 digits. This example should be no problem to calculate
(except that it takes more than one screen to write), but it is easy \+
to construct similar examples that will use up all available memory or
take a very long time to compute." }}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 16 "(1+1/4321)^4321;" }}}{PARA 0 "" 0 "" {TEXT -1 258 "Ty
pically, however, all you really want is a few decimal places of the a
nswer. For this purpose it is better to do the calculation in floatin
g point. A numerical expression involving a number with a decimal po
int is evaluated in floating point (but see " }{HYPERLNK 17 "Forcing
floating-point arithmetic" 2 "Forcing_floating-point_arithmetic" "" }
{TEXT -1 24 "). Thus you could use " }}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 17 "(1+1./4321)^4321;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#
$\"+1%ozr#!\"*" }}}{PARA 0 "" 0 "" {TEXT -1 82 "This is calculated ver
y quickly, and the answer is in a much more convenient form." }}{PARA
0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 208 "The main disad
vantage of floating point arithmetic is roundoff error. The calculati
on above is one in which the roundoff error is rather severe, due to t
he fact that we are adding a relatively small number (" }{MPLTEXT 0
21 22 "1./4321=.0002314279102" }{TEXT -1 29 ") to a relatively large o
ne (" }{MPLTEXT 0 21 1 "1" }{TEXT -1 147 "), and losing significant di
gits in the process. This can be remedied by doing the calculation wi
th a larger setting of the environment variable " }{MPLTEXT 0 21 6 "D
igits" }{TEXT -1 70 ", which controls the number of decimal digits use
d in the calculation." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "Dig
its:= 15:\nr:= (1+1./4321)^4321:\nDigits:= 10:\nevalf(r);" }}{PARA 11
"" 1 "" {XPPMATH 20 "6#$\"+_t'zr#!\"*" }}}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{PARA 0 "" 0 "" {TEXT -1 181 "There are some cases, however, in wh
ich even a very accurate floating-point approximation is no good, and \+
exact arithmetic is necessary. Suppose, for example, we want to calcu
late " }{XPPEDIT 18 0 "Limit(f(x)*(x-a), x = a) " "-%&LimitG6$*&-%\"fG
6#%\"xG\"\"\",&F)F*%\"aG!\"\"F*/F)F," }{TEXT -1 7 " where " }{XPPEDIT
18 0 "f(x)" "-%\"fG6#%\"xG" }{TEXT -1 22 " is some function and " }
{XPPEDIT 18 0 "a" "I\"aG6\"" }{TEXT -1 18 " some number with " }
{XPPEDIT 18 0 "f(x) -> infinity" ":6#-%\"fG6#%\"xG7\"6$%)operatorG%&ar
rowG6\"%)infinityGF,F," }{TEXT -1 4 " as " }{XPPEDIT 18 0 "x -> a" ":6
#%\"xG7\"6$%)operatorG%&arrowG6\"%\"aGF)F)" }{TEXT -1 50 ". Maple may
be able to calculate it correctly if " }{XPPEDIT 18 0 "a" "I\"aG6\""
}{TEXT -1 105 " is given as an exact expression. But if instead you g
ive Maple an inexact floating-point approximation " }{XPPEDIT 18 0 "b
" "I\"bG6\"" }{TEXT -1 16 " of the correct " }{XPPEDIT 18 0 "a" "I\"aG
6\"" }{TEXT -1 24 ", it will tell you that " }{XPPEDIT 18 0 "Limit(f(x
)*(x-b),x=b) = 0" "/-%&LimitG6$*&-%\"fG6#%\"xG\"\"\",&F*F+%\"bG!\"\"F+
/F*F-\"\"!" }{TEXT -1 49 ". This is in a sense perfectly correct (bec
ause " }{XPPEDIT 18 0 "f(x)" "-%\"fG6#%\"xG" }{TEXT -1 34 " approaches
some finite number as " }{XPPEDIT 18 0 "x -> b" ":6#%\"xG7\"6$%)opera
torG%&arrowG6\"%\"bGF)F)" }{TEXT -1 33 "), but it is not what you want
ed." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "f:= x -> 1/sin(x):\nl
imit(f(x)*(x-Pi), x = Pi);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#!\"\"" }
}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "b:= evalf(Pi,20);" }}
{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG$\"5&QKz*e`EfTJ!#>" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "limit(f(x)*(x-b), x = b);" }}{PARA
11 "" 1 "" {XPPMATH 20 "6#\"\"!" }}}{PARA 0 "" 0 "" {TEXT -1 19 "Simil
arly, suppose " }{MPLTEXT 0 21 1 "A" }{TEXT -1 29 " is a matrix with e
igenvalue " }{MPLTEXT 0 21 1 "a" }{TEXT -1 68 ", and you want to find \+
the corresponding eigenvectors. You can use " }{MPLTEXT 0 21 11 "kern
el(A-a)" }{TEXT -1 4 " if " }{MPLTEXT 0 21 1 "a" }{TEXT -1 79 " is exa
ct, but this will not work if it is only a floating-point approximatio
n." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg):" }}
{PARA 7 "" 1 "" {TEXT -1 32 "Warning, new definition for norm" }}
{PARA 7 "" 1 "" {TEXT -1 33 "Warning, new definition for trace" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "A:= matrix([[1,2,3],[3,1,4],
[1,5,9]]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'MATRIXG6#7%7%\"
\"\"\"\"#\"\"$7%F,F*\"\"%7%F*\"\"&\"\"*" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 20 "evalf(Eigenvals(A));" }}{PARA 11 "" 1 "" {XPPMATH 20
"6#-%'VECTORG6#7%$\"*O&o#=)!\"*$!+kT2h:F)$\"+k0Gu6!\")" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "kernel(A-.818268536);" }}{PARA 11 "
" 1 "" {XPPMATH 20 "6#<\"" }}}{PARA 0 "" 0 "" {TEXT -1 100 "In this ca
se you can express the exact eigenvalue as a root of the characteristi
c polynomial, using " }{MPLTEXT 0 21 6 "RootOf" }{TEXT -1 61 " (with a
third argument that identifies which root is meant):" }}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 45 "kernel(A-RootOf(charpoly(A,t),t,.81826853
6));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#-%'VECTORG6#7%\"\"\",(#!\")
\"#>F(-%'RootOfG6$,**$%#_ZG\"\"$F(*$F2\"\"#!#6F2!#5\"#:F($\"*O&o#=)!\"
*F5*$F-F5#!\"$F,,(#!\"\"F,F(F-FAF<#F5F," }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 9 "evalf(\");" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#-%'VEC
TORG6#7%$\"\"\"\"\"!$\"+**Qw46!\"*$!+`v>/!)!#5" }}}{PARA 0 "" 0 ""
{TEXT -1 61 "However, a better method for large matrices might be to \+
use " }{TEXT -1 32 "the optional second argument to " }{MPLTEXT 0 21
9 "Eigenvals" }{TEXT -1 62 " to obtain all the eigenvectors, and extra
ct the one you want." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "eval
f(Eigenvals(A,'vects'));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECTORG
6#7%$\"*O&o#=)!\"*$!+kT2h:F)$\"+k0Gu6!\")" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 13 "col(vects,1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%
'VECTORG6#7%$!+v.`p_!#5$!+tX$z%eF)$\"+6i$y@%F)" }}}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}}{PARA 3 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 0 "" 0
"" {TEXT 26 9 "See also:" }{TEXT -1 1 " " }{HYPERLNK 17 "Automatic sim
plification and evalf" 2 "Automatic_simplification_and_evalf" "" }
{TEXT -1 2 ", " }{HYPERLNK 17 "Digits" 2 "Digits" "" }{TEXT -1 2 ", "
}{HYPERLNK 17 "Eigenvals" 2 "Eigenvals" "" }{TEXT -1 3 ", " }
{HYPERLNK 17 "evalf" 2 "evalf" "" }{TEXT -1 2 ", " }{HYPERLNK 17 "Forc
ing floating-point arithmetic" 2 "Forcing_floating-point_arithmetic" "
" }{TEXT -1 2 ", " }{HYPERLNK 17 "RootOf" 2 "RootOf" "" }{TEXT -1 2 ",
" }{HYPERLNK 17 "Roundoff error" 2 "Roundoff_error" "" }{TEXT -1 3 ",
" }{HYPERLNK 17 "The meaning of Digits" 2 "The_meaning_of_Digits" "
" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 0 "" 0 "" {TEXT 26
24 "Maple Advisor Database, " }{TEXT -1 15 " R. Israel 1997" }}}}
{MARK "1 6 0" 12 }{VIEWOPTS 1 1 0 1 1 1803 }