Graphics Reference
In-Depth Information
A number in floating point, or a number with a decimal point, is interpreted as exact if rational format is enabled.
If there is a number with a floating point expression, MATLAB is entirely exact in how the rational expression is
represented with the result in rational numbers.
>> format rat
>> 10/23 + 2.45/44
Ans =
1183 / 2412
The other fundamental subset within the actual numbers is irrational numbers, which have always created
difficulties in the processes of numerical calculations by their special nature. The impossibility of representing an
irrational accurately in numeric mode (using the ten digits from the decimal numbering system) is the cause of most
of the problems. MATLAB represents the results with greater accuracy which can be the accuracy required by the user.
The irrational cannot be represented exactly as the ratio of two integers. If you try the square root of the number 17,
MATLAB returns the number 5.1962 in that format by default.
>> sqrt (27)
Ans =
5.1962
There is a large group of irrational and real numbers deserving special treatment for common use.
MATLAB incorporates the following:
pi
Number p = 3.1415926
exp (1)
Number e = 2.7182818
inf
Infinity (for example 1/0)
nan
Uncertainty (for example 0/0)
realmin
Least usable positive real number
realmax
Greatest usable positive real number
Then these numbers with outputs of MATLAB are illustrated as follows:
>> long format
>> pi
years =
3.14159265358979
>> exp (1)
Ans =
2.71828182845905
Search WWH ::




Custom Search