Go to the first, previous, next, last section, table of contents.

# Introduction to MAXIMA

Start MAXIMA with the command "maxima". MAXIMA will display version information and a prompt. End each MAXIMA command with a semicolon. End the session with the command "quit();". Here's a sample session:

    sonia$ maxima
    GCL (GNU Common Lisp)  Version(2.3) Tue Mar 21 14:15:15 CST 2000
    Licensed under GNU Library General Public License
    Contains Enhancements by W. Schelter
    Maxima 5.4 Tue Mar 21 14:14:45 CST 2000 (enhancements by W. Schelter)
    Licensed under the GNU Public License (see file COPYING)
    (C1) factor(10!);

                                       8  4  2
    (D1)                              2  3  5  7
    (C2) expand((x+y)^6);

               6        5       2  4       3  3       4  2      5      6
    (D2)      y  + 6 x y  + 15 x  y  + 20 x  y  + 15 x  y  + 6 x  y + x
    (C3) factor(x^6-1);

                                         2            2
    (D3)               (x - 1) (x + 1) (x  - x + 1) (x  + x + 1)
    (C4) quit();

    sonia$

MAXIMA can search the info pages. Use the `describe` command to show all the commands and variables containing a string, and optionally their documentation:

    (C1) describe(factor);

     0: DONTFACTOR :(maxima.info)Definitions for Matrices and ..
     1: EXPANDWRT_FACTORED :Definitions for Simplification.
     2: FACTOR :Definitions for Polynomials.
     3: FACTORFLAG :Definitions for Polynomials.
     4: FACTORIAL :Definitions for Number Theory.
     5: FACTOROUT :Definitions for Polynomials.
     6: FACTORSUM :Definitions for Polynomials.
     7: GCFACTOR :Definitions for Polynomials.
     8: GFACTOR :Definitions for Polynomials.
     9: GFACTORSUM :Definitions for Polynomials.
     10: MINFACTORIAL :Definitions for Number Theory.
     11: NUMFACTOR :Definitions for Special Functions.
     12: SAVEFACTORS :Definitions for Polynomials.
     13: SCALEFACTORS :Definitions for Miscellaneous Options.
     14: SOLVEFACTORS :Definitions for Equations.
    Enter n, all, none, or multiple choices eg 1 3 : 2 8;

    Info from file /d/linux/local/lib/maxima-5.4/info/maxima.info:
     - Function: FACTOR (EXP)
         factors the expression exp, containing any number of variables or
         functions, into factors irreducible over the integers.
         FACTOR(exp, p) factors exp over the field of integers with an
         element adjoined whose minimum polynomial is p.  FACTORFLAG[FALSE]
         if FALSE suppresses the factoring of integer factors of rational
         expressions.  DONTFACTOR may be set to a list of variables with
         respect to which factoring is not to occur.  (It is initially
         empty).  Factoring also will not take place with respect to any
         variables which are less important (using the variable ordering
         assumed for CRE form) than those on the DONTFACTOR list.
         SAVEFACTORS[FALSE] if TRUE causes the factors of an expression
         which is a product of factors to be saved by certain functions in
         order to speed up later factorizations of expressions containing
         some of the same factors.  BERLEFACT[TRUE] if FALSE then the
         Kronecker factoring algorithm will be used otherwise the Berlekamp
         algorithm, which is the default, will be used.  INTFACLIM[1000] is
         the largest divisor which will be tried when factoring a bignum
         integer.  If set to FALSE (this is the case when the user calls
         FACTOR explicitly), or if the integer is a fixnum (i.e.  fits in
         one machine word), complete factorization of the integer will be
         attempted.  The user's setting of INTFACLIM is used for internal
         calls to FACTOR. Thus, INTFACLIM may be reset to prevent MACSYMA
         from taking an inordinately long time factoring large integers.
         NEWFAC[FALSE] may be set to true to use the new factoring routines.
         Do EXAMPLE(FACTOR); for examples.

     - Function: GFACTOR (EXP)
         factors the polynomial exp over the Gaussian integers (i.  e.
         with SQRT(-1) = %I adjoined).  This is like FACTOR(exp,A**2+1)
         where A is %I.
              (C1)  GFACTOR(X**4-1);
              (D1)        (X - 1) (X + 1) (X + %I) (X - %I)
    (D1) 				     FALSE

To use a result in later calculations, you can assign it to a variable or refer to it by its automatically supplied label. In addition, `%` refers to the most recent calculated result:

    (C2) u:expand((x+y)^6);

               6        5       2  4       3  3       4  2      5      6
    (D2)     y  + 6 x y  + 15 x  y  + 20 x  y  + 15 x  y  + 6 x  y + x
    (C3) diff(u,x);

                    5         4       2  3       3  2       4        5
    (D3)        6 y  + 30 x y  + 60 x  y  + 60 x  y  + 30 x  y + 6 x
    (C4) factor(d3);

                                               5
    (D4)                             6 (y + x)

MAXIMA knows about complex numbers and numerical constants:

    (C6) cos(%pi);

    (D6)                                  - 1

    (C7) %e^(%i*%pi);

    (D7)                                  - 1

MAXIMA can do differential and integral calculus:

    (C8) u:expand((x+y)^6);

               6        5       2  4       3  3       4  2      5      6
    (D8)     y  + 6 x y  + 15 x  y  + 20 x  y  + 15 x  y  + 6 x  y + x
    (C9) diff(%,x);

                    5         4       2  3       3  2       4        5
    (D9)        6 y  + 30 x y  + 60 x  y  + 60 x  y  + 30 x  y + 6 x
    (C10) integrate(1/(1+x^3),x);

                                             2 x - 1
                           2            ATAN(-------)
                      LOG(x  - x + 1)        SQRT(3)    LOG(x + 1)
    (D10)           - --------------- + ------------- + ----------
                             6             SQRT(3)          3

MAXIMA can solve linear systems and cubic equations:

    (C11) linsolve( [ 3*x + 4*y = 7, 2*x + a*y = 13], [x,y]);

                                   7 a - 52        25
    (D11)                     [x = --------, y = -------]
                                   3 a - 8       3 a - 8
    (C12) solve( x^3 - 3*x^2 + 5*x = 15, x);

    (D12)              [x = - SQRT(5) %I, x = SQRT(5) %I, x = 3]

MAXIMA can solve nonlinear sets of equations. Note that if you don't want a result printed, you can finish your command with `$` instead of `;`.

    (C13) eq1: x^2 + 3*x*y + y^2 = 0$

    (C14) eq2: 3*x + y = 1$

    (C15) solve([eq1, eq2]);

                  3 SQRT(5) + 7      SQRT(5) + 3
    (D15) [[y = - -------------, x = -----------],
                        2                 2

                                        3 SQRT(5) - 7        SQRT(5) - 3
                                   [y = -------------, x = - -----------]]
                                              2                   2

Under the X window system, MAXIMA can generate plots of one or more functions:

    (C13) plot2d(sin(x)/x,[x,-20,20]);

    (YMIN -3.0 YMAX 3.0 0.29999999999999999)
    (D13)                                  0
    (C14) plot2d([atan(x), erf(x), tanh(x)], [x,-5,5]);

    (YMIN -3.0 YMAX 3.0 0.29999999999999999)
    (YMIN -3.0 YMAX 3.0 0.29999999999999999)
    (YMIN -3.0 YMAX 3.0 0.29999999999999999)
    (D14)                                  0
    (C15) plot3d(sin(sqrt(x^2+y^2))/sqrt(x^2+y^2),[x,-12,12],[y,-12,12]);

    (D15)                                  0

Moving the cursor to the top left corner of the plot window will pop up a menu that will, among other things, let you generate a PostScript file of the plot. (By default, the file is placed in your home directory.) You can rotate a 3D plot.

Go to the first, previous, next, last section, table of contents.