# How to represent and manipulate abstract indexed vector (or tensor) expressions?

I have a couple abstract indexed quantities, both differential elements

$dx = dx^\mu e_\mu + x^\mu de_\mu$

$du = du^\mu e_\mu + u^\mu de_\mu$

I can compute the expression $(dx + du) \cdot (dx + du) - dx \cdot dx$ manually on paper, contracting the products appropriately and taking the differences. However, evaluating that end result for specific parameterizations and basis representations becomes messy (I've done only the 3D Euclidian cartesian and cylindrical coordinate cases).

This seems to be a perfect opportunity for a symbolic computation engine, but I'm having trouble starting. The mathematica book hints that tensor expressions can be represented by lists, but an expression of the above form does not require any specific dimensionality, and can still be symbolically manipulated (on paper).

If I use a list, does that list not have to have specific dimension? For example, I'm guessing that I could use an explicit 3D representation for the upper index coordinates like so:

x = { x1, x2, x3 }
u = { u1, u2, u3 }


then define a metric tensor for the lower index coordinates. I don't know how I'd represent the basis vectors $e_\mu$ in Mathematica though, even if I restricted myself to 3D Euclidean spaces.

Is this sort of computation within the scope of Mathematica, and if so, how does one setup the variables?

• A list of software for tensor calculations is collected here. This includes 3 Mathematica packages that can do differential forms MathSource/683, MathSource/482 and Ricci. It also includes xAct which is a good GR package has differential forms on its todo list. Do any of these packages meet your needs? Jan 20, 2012 at 10:31
• There are lots of answers below that only give suggestions for packages but don't actually answer the question, i.e., show that the package can do the work. As a meta question (similar to this meta question) are these answers appropriate or better off as comments? Jan 20, 2012 at 10:40
– acl
Jan 20, 2012 at 10:57
• One problem is that the question title is about indexed expressions and tensors, while the question comments care about differential forms. I read the latter as being more important, but maybe others thought the tensor part was the key part. So maybe I was being a little harsh, since the links did answer the title of the question. Jan 20, 2012 at 10:58
• @Simon: On that note, I think one could make a communitywiki thread with a list of packages sorted for all the possible areas of research for which Mathematica is used. Jan 20, 2012 at 11:33

On this wikipedia page you find a collection of Tensor software and Mathematica has the biggest section.

The package Ricci, which username acl pointed out in his answer is there, and I personally have used xAct. It looks like this

http://img692.imageshack.us/img692/211/pic1ni.png

And yes, as you suggest in your question, for smaller computation in specific dimensions you can also work in components directly. For me, this usually looks something like this (only have a screenshot atm.).

http://img835.imageshack.us/img835/5023/bild4go.png

Although the expression $de_\mu$ makes me think the package variant is best suited for you.

• Your images appear to have disappeared. Nov 13, 2014 at 18:36
• @PeeterJoot: Yeah, Imageshack went private this year. I don't have copies of the pictures I think. Maybe I make new ones.. Nov 14, 2014 at 8:20
• Would you please fix the image files. :) Feb 18, 2016 at 17:03

Mathematica does not yet support tensor calculus and notation natively, but there are numerous 3rd party packages which address this issue very well. This is a list of the packages I am more familiar with:

xAct suite: free (GPL license), most powerful, created by relativists, actively supported.

Disclosure: I contributed to the suite by creating the WYSIWYG user interface.

http://www.xact.es/

MathTensor: used to cost around 1000$in the 90's, very powerful, A bit outdated but still working. http://smc.vnet.net/MathTensor.html Tensorial: 50$, powerful, very well supported by David Park.

http://home.comcast.net/~djmpark/TensorialPage.html

Ricci: free, some limitations "Limitations: Ricci currently does not support computation of explicit values for tensor components in coordinates,..." http://www.math.washington.edu/~lee/Ricci/

• (+1) You are answer is useful. :) Don't you have any updates on this concerning Mathematica or other softwares? :) Feb 10, 2016 at 14:57
• @H.R. xAct is still the most complete package in my opinion. It is free. Go for it! Feb 15, 2016 at 19:25