Download Symbolic Math Toolbox User's Guide

Transcript
Variable-Precision Arithmetic
result of the division, and one in the binary to decimal conversion for the
printed output. On computers that use IEEE floating-point standard
arithmetic, the resulting internal value is the binary expansion of 5/6,
truncated to 53 bits. This is approximately 16 decimal digits. But, in this
particular case, the printed output shows only 15 digits.
The symbolic operations used by rational arithmetic are potentially the most
expensive of the three, in terms of both computer time and memory. The results
are exact, as long as enough time and memory are available to complete the
computations.
Variable-precision arithmetic falls in between the other two in terms of both
cost and accuracy. A global parameter, set by the function digits, controls the
number of significant decimal digits. Increasing the number of digits increases
the accuracy, but also increases both the time and memory requirements. The
default value of digits is 32, corresponding roughly to floating-point accuracy.
The Maple documentation uses the term “hardware floating-point” for what we
are calling “numeric” or “floating-point” and uses the term “floating-point
arithmetic” for what we are calling “variable-precision arithmetic.”
Example: Using the Different Kinds of Arithmetic
Rational Arithmetic
By default, the Symbolic Math Toolbox uses rational arithmetic operations, i.e.,
Maple’s exact symbolic arithmetic. Rational arithmetic is invoked when you
create symbolic variables using the sym function.
The sym function converts a double matrix to its symbolic form. For example, if
the double matrix is
A =
1.1000
2.1000
3.1000
1.2000
2.2000
3.2000
1.3000
2.3000
3.3000
its symbolic form, S = sym(A), is
S =
[11/10, 6/5, 13/10]
[21/10, 11/5, 23/10]
[31/10, 16/5, 33/10]
1-65