Previous: Basic Information on Running Maxima Up: Basic Information on Running Maxima Next: Floating Point Calculations

Starting Up MAXIMA

After login, you type the following command to run Maxima


% maxima
You'll see a message starting with

AKCL (Austin Kyoto Common Lisp)  Thu Feb 28 16:39:20 EST 1991
...
Type (run) to start Maxima.
>
Now you are at the CL level of maxima. Type (run) to load maxima initialization files (if any) and enter maxima top level. You'll see

Loading /usr/local/maxima.obj/maximarc.lsp

(C1)

The label (c1) is a name being automatically assigned to your first command. ( c labels are used for user input commands, d labels for Maxima output expressions, and e labels for Maxima intermediate output expressions.)

Suppose you want to work with the expression . You could type it in by using FORTRAN-like syntax as follows:


(c1)   (x+1)**3;

The ``;'' terminates your input string and prompts Maxima to evaluate your expression, simplify it, and display the result. ``$'' (dollar sign) may also be used to terminate a command when the user wishes display of the result to be suppressed. The current Maxima ordinarily distinguish between upper and lower case characters. Therefore, the command must be lower case characters.

In the above case, Maxima will come back with


                                          3
(d1)                               (x + 1)

(c2)

Your result was assigned as a label d1 which may be used in subsequent commands. Maxima also automatically labeled the next input line c2.

Let us indicate one of the over hundred commands available in Maxima , a command for expanding expression. Commands are written in functional notation, as follows:


(c2)   expand(d1);

3 2 (d2) x + 3 x + 3 x + 1

Let us consider a few additional commands and facilities. To differentiate an expression use diff(expr, var). Here expr is the expression or its name, var is the variable with respect to which differentiation is to be performed.


(c3)   sin(x)*cos(x);

(d3) cos(x) sin(x)

(c4) diff(%,x);

2 2 (d4) cos (x) - sin (x)

Note the use of % in c4. The symbol % always represents the previous expression, in this case d3.

To differentiate an expression twice use diff( expr, var, 2).


(c5) diff(d3,x,2);

(d5) - 4 cos(x) sin(x)

There are a number of ways for effecting a substitution of one expression for another. For example, to substitute for every occurrence of in the expression d6 which is you could write


(c7)   d6,Z=x**2;

2 2 x (d7) x %e

Note that the base of natural logarithms is written %e not e. The is written as %i and is written %pi.

An alternative syntax for command c7 is


(c8)   ev(d6,Z=x^2);

2 2 x (d8) x %e

Note that `` '' can be used as ``**''.

The assignment can be done by using ``:'' (colon symbol).


(c10)   A:d8;

2 2 x (d10) x %e

(c11) A;

2 2 x (d11) x %e

To unassign a variable A say

(c12)   kill(A);

(d12) done

Now if you were ask for the value of A, you'd get

(c13)   A;

(d13) A

To define a function f(z) to use ``:=''


(c14)   f(z):=sin(z)^2 + 1;

2 (d14) f(z) := sin (z) + 1

(c15) f(x+1);

2 (d15) sin (x + 1) + 1

Equations in Maxima are a particular useful form of expression. To represent the equation , use


(c16)   x^2+2*x = y^2;

2 2 (d16) x + 2 x = y

One may add expressions to equations.


(c17)   d16+1;

2 2 (d17) x + 2 x + 1 = y + 1

The left-hand-side of an equation is obtained by the function lhs. rhs obtains the right-hand-side.


(c18)   lhs(%);

2 (d18) x + 2 x + 1

Finally, to exit Maxima , type

(c30)  exit();

farrell@mcs.kent.edu