Converting answers to decimal

Mathematica

In[1]:= E^Pi

         Pi
Out[1]= E

In[2]:= N[%]

Out[2]= 23.1407

In[3]:= N[Out[1],20]

Out[3]= 23.140692632779269006

Maxima

(%i1) %e^%pi;

                                       %PI
(%o1)                                %E
(%i2) %o1,numer;

(%o2)                          23.14069263277927
(%i3) %o1,bfloat;

(%o3)                         2.314069263277927B1
(%i4) %o1,bfloat,fpprec=20;

(%o4)                       2.3140692632779269006B1

Axiom

In Axiom, you may usually specify ` :: Float` to have something represented as a decimal. There are some situations where this may fail, but they can often be worked around with a little creativity. For example, values that have an "Expression" type will probably need to be converted to `

Expression Float `. Sometimes it may be possible to coerce a "Float" type specifying the type of one of the arguments.

(1) -> %e^%pi
(1) ->
          %pi
   (1)  %e
                                                     Type: Expression Integer
(2) ->
 2) ->
   Cannot convert from type Expression Integer to Float for value
     %pi
   %e

(2) -> % :: Expression Float
(2) ->
   (2)  23.1406926327 79269006
                                                       Type: Expression Float
(3) -> %e ^ %pi::Float
(3) ->
   (3)  23.1406926327 79269006
                                                       Type: Expression Float`

In Axiom, digits() controls the number of significant figures of output. OutputSpacing() sets the number of decimal digits printed before a space is inserted for legibility. Set to zero to suppress the spaces.

(4) -> digits(40)
(4) ->
   (4)  20
                                                        Type: PositiveInteger
(5) -> outputSpacing(0)
                                                                   Type: Void
(6) -> %e^%pi::Float
(6) ->
   (6)  23.14069263277926900572908636794854738026
                                                       Type: Expression Float

Octave

All data in Octive is stored internally as double precision numbers. That means it is possible to specify output with more precision than actually exists in a value. Notice by comparison with Mathematica and Maxima, that the precision of the value below actually has only 16 places.

octave:1> e^pi
ans = 23.141
octave:2> output_precision=20
output_precision = 20
octave:3> e^pi
ans =  2.3140692632779263249e+01

Saved Macros

Mathematica

If you have commands that you want run every time you start Mathematica, put them in a file called \~/.Mathematica/Kernel/init.m.

Maxima

If you have commands that you want run every time you start Maxima, put them in a file called \~/.maxima/maxima-init.mac. On sand, to get a copy of Dr. Bindner’s macros, open a shell window (one where you can type Linux commands) and type:

$ cp -r ~dbindner/.maxima ~

If you are working on Windows, your file probably goes in something similar to C:\Documents and Settings\dbindner\maxima\maxima-init.mac.

Axiom

If you have commands that you want run every time you start Axiom, put them in a file called \~/.axiom.input. On ice, to get a copy of Dr. Bindner’s macros, open a shell window (one where you can type Linux commands) and type:

$ cp ~dbindner/.axiom.input ~