The Maple Computer Algebra System

Michael Monagan^{1}

Maple is a comprehensive general purpose computer algebra system. It is used primarily in education and scientific research in the sciences, in mathematics, and in engineering. Maple can do both symbolic and numerical calculations and has facilities for 2 and 3-dimensional graphical output. The newest version of Maple, Maple V Release 2, sports a new user interface that integrates these three facilities as well as text into a document called a worksheet. Worksheets are a nice medium for presenting and communicating results and teaching material. A new feature of Release 2 that makes worksheets especially appealing is that results computed by Maple are displayed in a high quality font with full support for math symbols, Greek characters, subscripts, superscripts etc.

Maple is also a programming language. In fact almost all of the mathematical and graphical facilities are written in Maple and not in a systems implementation language like other computer algebra systems. These Maple programs reside on disk in the Maple library and are loaded on demand. The programming language supports procedural and functional programming. We will not give specific details of the programming language beyond this, even though this is perhaps a key part of the Maple system. Details and examples can be found in the manuals cited in the references. We wish to mention a bit of history however.

The main design goal of Maple in 1980 was to design a language for implementing mathematical algorithms which was powerful and efficient enough so that almost all of the mathematical algorithms could be written in it, rather than in a systems implementation language like C or Lisp. Another main design objective was to minimize overall memory requirements so that larger problems could be solved, and Maple could run on smaller computers, and support many simultaneous users on time-shared systems. The outcome is a system consisting of three components, the user interface, the kernel, and the Maple library. The user interface and kernel are programmed in C and comprise about 500Kbytes of memory. The Maple library is programmed in Maple. It consists of about 2,500 functions (about 150,000 lines of Maple code).

This design makes it possible for Maple to run on small computers e.g. Amigas, PC’s, Macintoshes with as little as 2 megabytes of RAM, as well as on most workstations, mainframes and supercomputers. This is attractive for educational laboratories and for students. The attention to space efficiency has helped in solving large problems and also contributed to the overall time efficiency of the system. Also, because the clean separation of the user interface from the kernel and library, and the overall space efficiency, Maple is used as the symbolic component in other commercial and research systems. For example, the system MathCAD, a numerical system popular amongst engineers, makes some of Maples symbolic functionality accessible to the user.

1Departement Informatik, ETH Zentrum, CH 8092, Zurich, Switzerland.

There is also a growing number of functions and packages in the Maple share library which have been contributed by users from around the world. The share library also contains additional documentation, other software tools, etc. It is updated quarterly as new applications codes are contributed and is now distributed electronically by an electronic mail server and anonymous ftp.

Other sources of information include the Maple news group, an electronic forum for discussion, the Maple ROOTS newsletter, which contains information about new releases, and the Maple Technical newsletter which contains application and technical articles on Maple. Further information about Maple can be obtained from

In Europe  In North America and elsewhere
Waterloo Maple Software  Waterloo Maple Software,
Tiergartenstrasse 17  160 Columbia Street West,
W-6900 Heidelberg 1  Waterloo, Ontario, N2L 3L3
Germany  Canada
Phone: +49-6221-487 180  Phone: (519) 747-2373
FAX: +49-6221-487 184  FAX: (519) 747-5284

Email: info@maplesoft.on.ca

We summarize below the capabilities of Maple under the headings Numeric, Symbolic and Graphics and follow with some examples illustrating some of the new features of Release 2. Maple input commands are the lines beginning with the > prompt character. The Maple output shown is close to what you see on your terminal in Release 2.

Numeric facilities

• Arbitrary precision integer, floating point, and complex numeric arithmetic

• Numerical evaluation of the elementary functions and a large library of special functions including the error function, the Gamma and related functions, the exponential integral, the Riemann zeta function, Bessel and related functions, Hypergeometric functions, statistical distributions etc.

• Numerical linear algebra: linear systems, eigenvalues and eigenvectors, SVD,

• Numerical approximation: interpolating splines, B-splines, least squares, Pade, continued fractions, Chebyshev series, Remez algorithm,

• Numerical calculus: numerical integration, numerical evaluation of infinite sums and products, solution of ODE’s, root finding, FFT.

Symbolic facilities

• Indefinite and definite integration of rational functions, elementary functions (Risch), algebraic functions (Trager), and special functions.

• Laplace, Fourier, Mellin, and Z transforms and inverse transforms,

• Definite and indefinite summation, infinite products, solution of recurrence equations, Taylor series, asymptotic expansions, symbolic limits,

• Polynomial arithmetic over finite and algebraic number fields, including GCDs, resultants, decomposition, factorization, root finding, Galois groups,

• Symbolic linear algebra: matrix determinant and inverse, eigenvalues and eigenvectors, Row echelon, Smith, Hermite, and Jordan canonical forms,

• Solving equations: linear systems, polynomial systems, Grobner bases, ODE’s,

• Specialized packages: finite Groups, number theory, Tensors, generating functions, geometry, orthogonal polynomials, differential forms, symmetric functions, graph theory, statistics, etc.

Graphic facilities

Basic facilities support the display of an arbitrary number of curves, surfaces, polygons, and text. Surfaces may be displayed in various styles, e.g. with hidden line removal, gray scale shading, color shading. Shaded surfaces can include contours, grids, lighting, etc. Also support for 2 and 3D frame sequence animation. Hardcopy output is available for a variety of printers and may be included in a Maple worksheet. Specific plots (all programmed in Maple) include

• Curves in cartesian, and polar co-ordinates,

• Surfaces in cartesian, cylindrical or spherical co-ordinates,

• Curves and surfaces defined parametrically or implicitly as the solution of a polynomial equation,

• Contour plots, log plots, density plots, conformal plots, vector plots,

• Phase portraits and direction field plots, plotting of systems of first order ODE’s

Examples from polynomial factorization.

Maple V can factor univariate polynomials over the rationals and more generally, algebraic number fields, and also finite fields. For example, the polynomial x^{8} −8, which is irreducible over Q, factors over Q( ^{4} \sqrt{2}) as

> factor(x^8-8,2^(1/4));

(x^{4} + 2 \sqrt{2}) (x^{2} − 2^{3/4}) (x^{2} + 2^{3/4})

Release 2 includes factorization of multivariate polynomials over any algebraic number or algebraic function field. E.g. a factorization over Q(\sqrt{2})

  > factor( y^4-2*x*y^2-x^2, sqrt(2) );

− (x + y^{2} − y^{2}\sqrt{2}) (x + y^{2} + y^{2}\sqrt{2})

Other facilities of Maple that exploit these new facilities for algebraic functions include integration, symbolic eigenvalues and eigenvectors, solution of systems of equations etc.

Examples from linear algebra.

Maple can compute exact formulae for eigenvalues and eigenvectors as well as numerical approximations. E.g. given the matrix

  > A := matrix( 3,3, [sqrt(2),x,alpha,x,sqrt(2),x,alpha,x,sqrt(2)] );

[ \begin{matrix}\sqrt{2} & x & α \\ x & \sqrt{2} & x \\ α & x & \sqrt{2} \end{matrix} ]

The eigenvalues are the roots of the characteristic polynomial

  > factor(charpoly(A,lambda));

(λ^{2} − 2 \sqrt{2}λ − α λ + 2 + α \sqrt{2} − 2 x^{2}) (λ − \sqrt{2} + α)

Note that Maple has factored the characteristic polynomial over Q(\sqrt{2}). Solving for λ we obtain

  > e := eigenvals(A);

\frac{α}{2} + \sqrt{2} + \frac{\sqrt{α^{2} + 8 x^{2}}}{2} , \frac{α}{2} + \sqrt{2} − \frac{\sqrt{α^{2} + 8 x^{2}}}{2} , −α + \sqrt{2}

For each eigenvalue λ_{i}, a basis for its corresponding eigenvectors is given by the nullspace of characteristic matrix λ_{i}I − A, i.e.

  > seq( nullspace(charmat(A,lambda)), lambda = e );

\{[1, −\frac{α − \sqrt{α^{2} + 8 x^{2}}}{2 x} , 1]\} , \{[1, −\frac{α + \sqrt{α^{2} + 8 x^{2}}}{2 x} , 1]\} , \{[−1, 0, 1]\}

Examples from rational function integration.

Consider integrating the following rational function

  > f := (6*x^5+6*x^2-4*x+8*x^3-4)/(x^6+2*x^3-2*x^2+1);

\frac{6 x^{5} + 8 x^{3} + 6 x^{2} − 4 x − 4}{x^{6} + 2 x^{3} − 2 x^{2} + 1}

The difficulty in this example is that the denominator does not factor over Q, hence we cannot use the traditional method of splitting the rational function into partial fractions. The Trager-Rothstein algorithm implemented in Maple V yields the nice result

∫ fdx = ∑_{α^{2}−2=0} (1 + α) ln(x^{3} − α x + 1)

That is, there are two logs corresponding to two roots ±\sqrt{2} of the polynomial α^{2} − 2 = 0. Hence, Maple obtains

  > int(f,x);

(1 − \sqrt{2}) ln(x^{3} + \sqrt{2}x + 1) + (\sqrt{2} + 1) ln(x^{3} − \sqrt{2}x + 1)

An improvement to this algorithm due to Rioboo is implemented in Release 2. It seeks to obtain a real result from a real integrand with no new poles. For example (note: in Maple V this integral returned complex logs),

  > f := (x^4-3*x^2+6)/(x^6-5*x^4+5*x^2+4);
  > int(f,x);

arctan(−\frac{3}{2}x^{3} + \frac{1}{2}x^{5} + \frac{1}{2}x) + arctan(x^{3}) + arctan(x)

Examples from definite integration

Maple V includes a new method for computing definite integrals based on evaluating the derivatives of special functions. For example, it can compute integrals of the form

∫ _{a}^{∞} t^{n} exp(−ut^{s}) ln(bt)^{m} sin(ct^{r}) dt
or cos

where r ∈ {0, s, 2s, s/2}, and other restrictions on the constants apply. In general these integrals can be expressed in terms of the incomplete Gamma function, the Riemann zeta function, the Meijer G function, and other special functions e.g.

  > int( exp(-t)*cos(t)*ln(t), t=0..infinity );

−\frac{ln(2)}{4} − \frac{γ}{2} − \frac{π}{8}

where γ is Eulers constant. The calculation below illustrates a new family of definite integrals that Release 2 knows about and also the ability to make assumptions about symbolic parameters. The answer to the integral below depends on the parameters p and q, in this case whether they are positive or negative. With no additional information, Maple cannot solve the problem. The assume facility in Release 2 allows users to state assumptions about symbolic parameters e.g. here that p and q are real and positive

  > f := x^(a-1)*exp(-p*x^s-q*x^(-s));
  > assume(p>0); assume(q>0);
  > Int(f,x=0..infinity) = int(f,x=0..infinity);

∫_{0}^{∞}x^{a−1}e^{−p˜ x^{s}−q˜ x^{−s}}dx = 2 signum(s)\sqrt{q}^{˜\frac{a}{s}} BesselK(\frac{a}{s}, 2 \sqrt{p}\sqrt{˜ q}˜ )\frac{1}{\sqrt{p}^{˜\frac{a}{s}}} s^{−1}

Examples of asymptotic series and limits.

Maple includes an implementation of a new model of “hierarchical” series in which various essential singularities in addition to simple poles are allowed e.g. ln(x) and e^{\frac{1}{x}} about x = 0. For example, the asymptotic series for the error function is

  > asympt(erf(x),x);

1 + (−\frac{1}{\sqrt{π}x} + \frac{1}{2 \sqrt{π}x^{3}} − \frac{3}{4 \sqrt{π}x^{5}} + O(x^{−7})) e^{x^{2}}^{−1}

From this series expansion, Maple can determine the following limit

  > Limit(exp(x^2)*(1-erf(x)),x=infinity) =
  > limit(exp(x^2)*(1-erf(x)),x=infinity);

lim_{x→∞} e^{x^{2}} (1 − erf(x)) = 0

Release 2 includes a more powerful model of series for nested functions. For example, the limit of the nested Γ function f below

  > f := (GAMMA(n+1/GAMMA(n))-GAMMA(n))/ln(n):
  > Limit(f,n=infinity) = limit(f,n=infinity);

lim_{n→∞} \frac{Γ(n + Γ(n)^{−1}) − Γ(n)}{ln(n)} = 1

References

[1] Bruce W. Char, Keith O. Geddes, Gaston H. Gonnet, Benton Leong, Michael B. Monagan, and Stephen M. Watt. First Leaves: Tutorial Introduction to Maple. ISBN 0-387-87621-3 Springer-Verlag, New York, 1992.

[2] Bruce W. Char, Keith O. Geddes, Gaston H. Gonnet, Benton Leong, Michael B. Monagan, and Stephen M. Watt. Maple V Language Reference Manual, 1st edition. ISBN 0-387-97622-1 Springer-Verlag, New York, 1991.

[3] Bruce W. Char, Keith O. Geddes, Gaston H. Gonnet, Benton Leong, Michael B. Monagan, and Stephen M. Watt. Maple V Library Reference Manual ISBN 0-387-97592-6 Springer-Verlag, New York, 1991.

[4] Wade Ellis, Eugene W. Johnson, Ed Lodi, Daniel Schwalbe. Maple V Flight Manual: Tutorials for Calculus, Linear Algebra, and Differential Equations Brooks/Cole Publishing Company, Pacific Grove, California 93950, 1992.

[5] The Maple Technical Newsletter, Birkhäuser, Boston, 1992.