Numbers
Numerical values are all of type double and complex. . The default type is double.
Exponential notation can be used to represent numbers; e.g. x = 1.0e10;
assigns the value 1.0x1010
to x.
Predefined values
pi ratio of circumference of a circle to its diameter i unit imaginary value Inf representation of `infinity'. NaN representation of `Not a Number'.
To change the format of the values when they are displayed use the format command. One can also change
this format from the Preferences dialog that appears when the File/Preferences item is selected in the GUI.
Use eps to display the floating point relative accuracy.
See Also : Displaying/Saving Results
Samples
% Printing out 15 digits of the the internal value of pi
format long pi ans = 3.14159265358979
% Resetting the format to 5 digits and then evaluating the sqrt(-1)
format short sqrt(-1) ans = 0+ 1.0000i
% Evaluating the complex exponential of i :
exp(1.0i) ans = 0.5403+ 0.8415i
% Generate Inf and NaN's
1.0/0.0 Warning: Divide by zero. ans = Inf 0.0/0.0 Warning: Divide by zero. ans = NaN
UCLA Mathematics Department | ©2000 |