Tensor Algebra in Maxima


One of the oldest computer algebra systems is MACSYMA, developed originally in the 1960s at the US Department of Energy, supposedly to help with complicated nuclear physics calculations.

Originally maintained by government and the academic community, MACSYMA soon became a commercial product. However, the original, non-commercial version lived on, and eventually its maintainer, William Schelter, obtained permission to turn MACSYMA into an open-source system. As the MACSYMA name itself was commercial property, the system had to be renamed; hence the name Maxima.

In addition to the core system that contains fundamental algorithms such as the simplifier, Maxima has many add-on packages. Three of these add-on packages deal with tensor algebra.

There are (at least) three ways of looking at tensors.

First, one can think of a tensor in terms of its representation, i.e., a column or row vector, a matrix, an array of matrices, etc. The rules of tensor manipulation are then just the rules of matrix multiplication. This view of tensors through a specific representation can be very useful when one works in a specific coordinate system. For instance, the so-called Schwarzschild metric of general relativity, the static, spherically symmetric vacuum solution that describes the gravitational field of a massive test particle, can be thought of as the tensor


in a spherical coordinate system with coordinates \((r,\theta,\phi)\), supplemented with the time coordinate \(t\). That is not to say that this matrix IS the Schwarzschild metric; on the contrary, the Schwarzschild metric has (infinitely) many different representations, of which this is but one. But, insofar as physically meaningful results are concerned, which are independent of the choice of coordinates, one is free to work in any particular coordinate system, and when the metric is that of Schwarzschild, this system of coordinates may be the most useful. (At least outside the event horizon. At the event horizon, this coordinate system breaks down and another one is needed.)

Second, one can think of a tensor in terms of the algebraic rules of matrix manipulation, without picking a specific representation. For instance, if my two tensors are a row vector \(a_\mu\) and a column vector \(b^\mu\), I know that their scalar product is \(\sum a_\mu b^\mu\) and the resulting number will be the same regardless of the choice of coordinate system. I.e., \(a_\mu b^\mu\) (where I dropped the summation sign in accordance with the Einstein summation convention) is a well defined scalar quantity even when I don’t specify a coordinate system and a specific representation of \(a_\mu\) and \(b^\mu\). The rules of tensor manipulation then boil down (largely) to an algebra of tensor indices and summation rules.

Third, I can do away with indices and components altogether, and focus on the purely algebraic properties of tensors. Tensors form a noncommutative group under multiplication, but this group is reducible and there are sets of tensors that can be used to represent many associative algebras. The generators and commutation rules of an algebra are sufficient to fully define that algebra; this algebraic view is another way of thinking about tensors.

These three views of tensors are implemented in Maxima by three add-on packages. Ctensor does component tensor manipulation. Itensor is the indicial tensor manipulation package. Lastly, Atensor stands for algebraic tensor manipulation.

More information about Maxima and tensor algebra in Maxima can be obtained from the following resources:

 Posted by at 3:29 pm

  2 Responses to “Tensor Algebra in Maxima”

  1. […] a contributor to Maxima, I occasionally receive requests from students to fill out surveys. I got one today, and after […]