Maxima data input and output

When you start an interactive Maxima session, the symbol (%i1) is shown on the screen. The first command that you type will go to the right of that symbol and when you enter the command by clicking on the end-of-line key, that command you wrote will be saved in a variable %i1 and the result will be saved in another variable %o1 and displayed on the screen. Next, the symbol (%i2) will appear, which will identify the second command that you enter, and so forth. The most basic use ​for Maxima is as a simple calculator, to make some calculations, as in the following examples.

(%i1) 2.5*3.1; (%o1)                      7.75 (%i2) 5.2*log(2); (%o2)                   5.2 log(2)

The result %o2 shows two important features of Maxima. Firstly, the natural logarithm of 2 was not calculated because the result is an irrational number which can not be represented exactly in numerical form. The other important thing is that the character * which was used in the input command to indicate a product has not been written in the output. This is because the output is being displayed by default in a mode called display2d where the output is centered on the screen and presented in a way similar to how we usually write algebraic expressions by hand.

One way to get an approximate numerical representation of the logarithm of 2 would be forcing it to be approximated by a floating point number, by writing the 2 with a trailing decimal point: log(2.0). Another way would be to use the function float like this: float(log(2))</tt>. When a previous result has been obtained which includes an irrational number, such as the result %o2</tt>, one can obtain the approximate representation of that previous result using the following syntax:

(%i3) float(%o2); (%o3)               3.604365338911716

The function float</tt> will convert its argument into floating point notation with 16 digits. The function bfloat</tt> (big float) produces a similar result, but allows using a higher numerical accuracy; the variable fpprec</tt> (which means floating point precision), indicates how many decimal places are used and its default value is 16. Increasing its value one can obtain more accurate results, for example, to show the result %o2</tt> with 40 significant digits, the following commands can be used:

(%i4) fpprec: 40; (%o4)                       40 (%i5) bfloat(%o2); (%o5)  3.604365338911715732097280521448436249843b0

The letter b and number 0 on the end of the result %o5</tt> indicate that this is a number with big floating point precision. The number after the letter is the exponent. In this particular case where the exponent is zero, the number must be multiplied by 100 = 1. The one-letter notation b followed by an integer may also be used to force a result to be converted into big floating point, eg 5.2*log(2b0)</tt>.

To check the information in the manual for a specific function or variable (eg, the functions mentioned above: display2d</tt>, float</tt>, bfloat</tt> or the variable fpprec</tt>), one uses the function describe</tt>, which can be abbreviated with a question mark followed by the function name or variable, for instance,

(%i6) ? float -- Function: float Converts integers, rational numbers and bigfloats in to     floating point numbers. It is also an `evflag', `float' causes non-integral rational numbers and bigfloat numbers to be converted to floating point. There are also some inexact matches for `float'. Try `?? float' to see them. (%o6)                      true