Simple variable assignments

Mathematica

Use equal(=) to perform simple assignments.

In[1]:= x = 2
Out[1]= 2
In[2]:= x
Out[2]= 2

Maxima

Use colon(:) to perform simple assignments.

(C1) x : 2;
(D1)  2
(C1) x;
(D2)  2

Axiom

Use colon-equal(:=) to perform simple assignments. Multiple assignments can be made simultaneously using ordered pair notation.

(1) -> x := 5
(1) ->
   (1)  5
                                                        Type: PositiveInteger
(2) -> x
(2) ->
   (2)  5
                                                        Type: PositiveInteger
(3) -> (a,b) := (1,2)
(3) ->
   (3)  2
                                                        Type: PositiveInteger
(4) -> a
(4) ->
   (4)  1
                                                        Type: PositiveInteger
(5) -> b
(5) ->
   (5)  2
                                                        Type: PositiveInteger

Octave

Use equal(=) to perform simple assignments:

octave:1> x = 2
x = 2
octave:2> x
x = 2

Clearing variables

Mathematica

In[3]:= Clear[x]
In[4]:= x
Out[4]:= x

Maxima

(C2) kill(x);
(D2)  DONE
(C3) x;
(D3)  x

Axiom

If you want to clear a variable, what you probably mean is that you want to clear all of the "properties" of the variable (taking it back to its unset state). You use ")clear properties" to do this, although it may be abbreviated as below. It is possible to simply clear the value of a variable and still let Axiom remember, for example, that it is a real number; but that is a more advanced idea.

(8) -> )clear p x
(8) -> x
(8) ->

Octave

octave:3> clear x
octave:4> x
error: `x' undefined near line 4 column 1
error: evaluating expression near line 4, column 1

History variables

Mathematica

In Mathematica, % may be used in a calculation to refer to the previous answer. In addition, there are a special functions Out[], In[] which can be used later to refer to values in the history.

In[1]:= Pi/2

        Pi
Out[1]= --
        2

In[2]:= Sin[ % ]

Out[2]= 1

In[3]:= Sin[ Out[1]/3 ]

        1
Out[3]= -
        2

Maxima

In Maxima, % may be used in a calculation to refer to the previous answer. In addition, the prompt on each input and output is a a special variable which can be used later to refer to values in the history.

(%i1) %pi/2;

                                      %PI
(%o1)                                 ---
                                       2
(%i2) sin( % );

(%o2)                                  1
(%i3) sin( %o1/3 );

                                       1
(%o3)                                  -
                                       2

Axiom

In Axiom, % may be used in a calculation to refer to the previous answer. In addition, there is a special function %%() which can be used later to refer to values in the history.

(1) -> %pi/2
(1) ->
        %pi
   (1)  ---
         2
                                                                     Type: Pi
(2) -> sin( % )
(2) ->
   (2)  1
                                                     Type: Expression Integer
(3) -> sin( %%(1)/3 )
(3) ->
        1
   (3)  -
        2
                                                     Type: Expression Integer