Maxima Primer

Maxima is a computer program for doing mathematics calculations, symbolic manipulations, numerical computations and graphics. Procedures can be programmed and then run by Maxima to do complex tasks. Much of the syntax for other languages such as Maple was copied from Maxima. Full documentation is available.

To do basic operations, a line is typed, followed by a semicolon, and then entered. This can be done in the window above. Alternately you may edit the blue portions in this buffer, and click on them, to see the result evaluated above and/or inserted in this window, depending on what was specified in the html source for this file. For example clicking below

  • integrate(1/(1+x^3),x)
You may double click the above formula, and the integral will be substituted into the Maxima evaluation in the other window. There are examples which you may also look at 3d plotting If you wish to have your plots appear in a separate window, go to the preferences button under file, and select separate. You may also go to the netmath page to see some more capabilities.

Here are some examples from basic calculus. To have Maxima evaluate the derivative of the function below, click on this line.

  • diff(cos(x),x); returns RESULT.

Maxima can calculate indefinite integrals.

  • integrate( x/(1+x^3),x ); returns RESULT
  • ...and definite integrals with respect to x from 0 to 1.
    integrate( 1/(1+x^2), x, 0, 1 ); returns RESULT
  • plot2d(sin(x),[x,0,2*%Pi])
  • plot3d(x^2-y^2,[x,-2,2],[y,-2,2],[grid,12,12])
  • Also, limits can be evaluated as x goes to infinity:
    limit( (2*x+1)/(3*x+2), x,inf ); produces RESULT
  • limit( sin(3*x)/x, x,0); evaluates to RESULT

Maxima can perform calculations to arbitrary precision. The following example computes Pi to one hundred decimal places.

  • block([FPPREC:100],bfloat(%pi)) yields RESULT if we took sin of this we would get 0 to to within 100 decimal places..
  • block([FPPREC:100],sin(bfloat(%pi))) gives RESULT

    Maxima can solve equations. Click this line to solve the system.

  • solve([x+y+z=5,3*x-5*y=10,y+2*z=3],[x,y,z]); returns RESULT
  • solve(x^2-5*x+6 =0,x); produces RESULT
Linear Algebra

For example, matrices can be entered and manipulated. Click these two lines.

  • A:matrix([1,2],[3,4]); gives RESULT
  • B:matrix([1,1],[1,1]); gives RESULT

    The matrices can then be added, for example:

  • A + B ; returns the sum RESULT ...and multiplied.
  • A . B ; gives the productRESULT
  • A^^-1 evaluates to the inverse: RESULT
  • determinant(matrix([a,b],[c,d])) gives RESULT
  • Fib[0] : 0; Fib[1] : 1; Fib[n] := Fib[n-1] + Fib[n-2];
Then the procedure can be called. fib[8]; gives 21

Maxima can solve ODEs analytically and numerically. Click the following line for an example of an analytic solution.

  • ode2('diff(y,x)+3*x*y = sin(x)/x, y,x) returns Result
  • ode2('diff(y,x) -y = 1, y,x) returns result
  • ode2('diff(y,x,2) - y = 1, y,x) gives RESULT

Defining a Function

The standard form is

  • f(3) gives F(3)
  • f(x):=x+2
  • now f(3) gives 5

Local variables: