Home | Mathematics | * Maxima |     Share This Page
Symbolic Mathematics Using Maxima
P. Lutus Message Page

Copyright © 2007, P. Lutus

Background | Discussion | Resources
Next | References

(double-click any word to see its definition)

NOTE: This page has been superseded -- I now recommend Sage and my Sage tutorial
for most users (Sage contains Maxima within it).


The history of mathematics can fairly be described as a Greek tragedy, one in which the most sublime Platonic ideals collide with the most mundane practical necessities. There are any number of mathematical stories in which a bold claim is made based on computations that, for practical reasons, weren't actually carried out, or were performed badly. Sometimes the underlying claim was true, sometimes false, but resolving the question required calculation resources that were unavailable at the time.

An example. In 1873, a masochist named Shanks used this equation (Machin) to compute the value of π to 707 decimal places:

Mr. Shanks published his work and retired in apparent victory. Unfortunately, much later his magnum opus was discovered to be in error after the 527th decimal place, a revelation we can assume didn't disturb Mr. Shanks' eternal rest.

There are many similar examples in mathematical history, dramas in which exhaustion trumped idealism. But there is a new player on the mathematical scene — computers can be used to perform certain kinds of mathematical operations in a fashion for which humans are temperamentally ill-suited.

An example. In 1971, a project meant to automatically create and test Calculus integrals discovered that many existing math textbooks were riddled with errors.

In this project, meant to formalize the creation and evaluation of integrals, the authors used existing tables of integrals as a starting point to test their computer algorithms. But a difficulty quickly arose — it seemed their code wasn't able to confirm the validity of many of the published integrals. The error rates sometimes exceeded 25%. The authors obviously assumed the problem lay with their new computer method, not the textbooks. But after much labor, they were forced to the realization that the mathematical tables created in the pre-computer era were not checked in any rigorous way, relying instead on the diligence and reputation of the mathematicians who created them.

The seriousness of a situation like this cannot be overemphasized. The equations listed in these textbooks are the basis of much of modern science and engineering. A professional engineer responsible for designing a bridge would rely on the validity of such equations to confirm that his bridge could bear the expected loads, and he would not personally check each of the equations he uses (because engineering is not science, it is applied science).

My reason for citing this example should be obvious — a computer can be used to check the work of humans, and in some cases, a computer's literalness and inability to be distracted will improve on the results a human can achieve alone.

This example shows there is a role for computers in mathematics that goes beyond routine calculation. In recent decades people have begun designing increasingly sophisticated programs meant to perform symbolic mathematics. Symbolic mathematics rises above the task of providing numerical results for defined mathematical operations, and performs mathematics at a higher level.

Example. I have this equation:


I would like an alternative statement of this equation, one that will provide x for any given values of a, b and c. Therefore I need a new equation that places x by itself on one side of the equals sign. And I am not interested in any particular numerical result, instead I want the general solution to this problem — an equation that can be applied to any numerical values.

This is a classic problem known as the general quadratic, and it has held the attention of mathematicians for centuries. But let's say for the sake of argument that I don't want to rediscover all of algebra, but simply obtain a result that meets this specific need. Here is the result that Maxima will provide if given the right instructions:


This result says there are two solutions, two possible equations for given values of a, b and c, and Maxima provides the equations as a list. I can take this result and create any number of numerical solutions, but the point of this example is that there are now free computer programs that will process mathematics at the symbolic level.


So there are programs that can perform mathematics at the symbolic level, and some of them are free. This fact leads to an objection, heard with increasing frequency, that people will use programs like Maxima to avoid learning anything about mathematics at all, instead depending on symbolic math software to conceal their ignorance.

This objection has an interesting history. To my knowledge, it was first applied to books, when books became commonplace. At that time, critics argued people would become reliant on books and lose the ability to memorize things. And guess what, boys and girls? The critics were right — because of books we've lost the ability to memorize vast amounts of trivial information. In exchange, we've freed up some of our precious neurons to think about what we know — instead of simply cataloging facts, we are free to process facts into new ideas.

Before we try to apply that argument to mathematics, let's see if it has merit. Have we gained anything by adopting books as a mass storage device? Are we better off, or have we become intellectually impoverished by not having to memorize everything we need to know? Wouldn't it be nice if there were a living basis for comparison, a time traveler from medieval times, someone who can only memorize, but who cannot process the memorized facts?

It turns out there are people who perfectly embody the essence of the counterargument, who represent a living example of the medieval model for learning. They're called "idiot savants." Typical idiot savants will forever remember anything they read or see, they can recite entire books they have read once, word for word, they are apparently perfect recorders of direct experience. But notwithstanding their carnival talents, in modern times they are seen as handicapped, because they don't have any surplus neurons to do anything with the facts they've so efficiently gathered. In the year 1500 they would be regarded as perfect students and scholars, because medieval knowledge consisted of facts. But in modern times they can scarcely function, because modern knowledge consists of ideas.

As with any but the most trivial issues, both sides of this argument have merit. There is a risk that we will use math software to become intellectually lazy. But the possibility exists that, in partnership with computer math software, people will learn much more about mathematics than they would be likely to do while using the older methods. Because we have computers to perform low-level computations, we can spend our time acquiring mathematical knowledge at a higher level. Just as we have done with books.

Here's an example from my own mathematical adventures (and I am not a professional mathematician, not by any means). It once occurred to me that π is the value we would get if we measured the area of a circle with a radius of 1. This crossed my mind when I first learned Calculus, a field of mathematics in which otherwise lifeless equations start moving, and when such issues as the area of geometric objects start to seem important.

I expressed the idea this way:

But then I started considering how I would try to compute the area for the curve drawn by the function used by the integral above — this function:


I knew it was very likely to be a valid basis for my assumption about π because I had graphed the curve on paper and it seemed to be a perfect quarter-circle:


At the time I was able to picture this function's curve (and draw it on paper), so I knew it was a quarter-circle. I realized if I could get the precise area under the curve, I would have π/4 to a fare-thee-well. I proceeded to write increasingly sophisticated hand-computation algorithms to efficiently measure the area. Shortly thereafter the first hand calculators appeared, and I began to straddle the fence between purely human calculation and the computer variety.

This kind of problem may seem trivial in a time and place where computers are everywhere, but this was many years ago, when the only graphing equipment I had was a tablet of lined paper. But let's cut to the chase — does Maxima know that the above integral equals π? Let's find out:

            (my entry to Maxima)  integrate(4*sqrt(1-(x^2)),x,0,1);
             (Maxima's response)  π

When I first expressed this idea to my first symbolic math program (Mathematica), I expected it to print a bunch of digits of π without understanding what it was actually doing (which is what my own math programs did). But no, Mathematica knew exactly what the integral defined, and it said so. Since then I've used this expression to test the level of comprehension of various mathematical programs I've come across. Maxima passes most of my tests, it approaches the performance of the best symbolic math software, and it is free and open-source.

If you are a mathematics student, if you need to find efficient mathematical expressions in connection with your professional activities, if you simply want to learn more mathematics, I can recommend Maxima based on personal experience.


Searching the Web for information about Maxima can be a frustrating experience, mostly because of its name. Maxima branched off from another program named Macsyma (a commercial product) and to avoid confusion, the maintainers chose the name "Maxima". In fairness to the namers, this decision was taken long before there was an Internet or search engines. I would personally prefer that the program had been named absolutely anything that could not suffer confusion with anything else.

In my first efforts to uncover Web resources, I naïvely typed "maxima" as a search string. Unfortunately there is a car with the same name, and given the commercial nature of the modern Internet, I mostly read about cars. So I tried "maxima math", and got a list of hundreds of definitions for the term "maxima" as it applies to mathematics, to wit:
maxima: points on a function's curve whose first derivative is zero and whose second derivative is negative.

My point? Don't name uncommon things using common words. When I named my (now well-known, free) Web editor "Arachnophilia", I knew exactly what I was doing (no one could claim they were inadvertently driving traffic away from my Web site to theirs using a common dictionary word). When Apple Computer named my (then well-known) word processor "Apple Writer", they also knew what they were doing (they could and did sue anyone who misused the name "Apple" in a computer context) — in spite of my wanting to name it "Lexicalc".

But in due time I managed to stumble on some interesting and informative Maxima sites. Here's a list:

In the following pages, I will show you how to install and use Maxima. To navigate, just open the drop-down lists located at the top and bottom of each page, or use the arrows to choose the next or prior page.
  1. Melvin Klerer and Fred Grossman. "Error Rates in Tables of Indefinite Integrals." Industrial Math. 18 (1968) 31-62. See also, by the same authors, "A New Table of Indefinite Integrals; Computer Processed", Dover, New York, 1971, ISBN 0-486-62714-4.

Home | Mathematics | * Maxima |     Share This Page