22

Has anybody used tensors in Mathematica? How to properly work with them? I find Mathematica not very friendly in this field, as I am defining my own functions for lowering & raising indices, multiplication and stuff like that. I was wondering if there is some good package or a secret way to use tensors more properly in Mathematica. For example, I need tensor analysis for general relativity kind of calculations.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Vladimir
  • 1,503
  • 1
  • 12
  • 28
  • 2
    Have a look at guide/SymbolicTensors in the help. – b.gates.you.know.what Feb 21 '13 at 13:34
  • 2
    Related http://mathematica.stackexchange.com/questions/8895/how-to-calculate-scalar-curvature-ricci-tensor-and-christoffel-symbols-in-mathem. For Maththematica 9 you might try to look at newer capabiliteis – Artes Feb 21 '13 at 13:41
  • @Vladimir, What exactly is it that you find difficult to use? –  Feb 21 '13 at 18:42
  • @b.gatessucks: I am aware there is a package in Mathematica called Tensors, but I do not agree that is able to do any computation in physics. It is more like N-dim matrix operations. This is why extra packages for Mathematica were made, as I was starting, and like some others have already developed in depth. The list of available packages with some description on them would be a great start (like you can see bellow). – Vladimir Feb 21 '13 at 20:37
  • I agree, @Artes, there is a related question. However, this one is more general, while first one was for one-time problem. I would suggest you to have a look at some free packages (knowing that you were also working on these functions). – Vladimir Feb 21 '13 at 20:42
  • Thanks for the clarification, I briefly played around with a package called Ricci a long time ago. Added link to @Szabolcs post. – b.gates.you.know.what Feb 21 '13 at 20:48
  • @b.gatessucks Since you used Ricci, could you add a few words about it? The aim would be to make someone reading this list easier to decide which package is worth looking at (considering his purposes) – Szabolcs Feb 21 '13 at 21:04
  • @Szabolcs That was way too long ago to remember, sorry. – b.gates.you.know.what Feb 21 '13 at 21:15
  • @Vladimir I'm very curious what you mean by one-time problem. You have not pointed out what you are really looking for. I used my own package (sketched in the previous link) successfully. If you need something more sophisticated then xAct by J.M. Martin-Garcia is the best choice. Moreover you have provided no explaining why new (in ver.9) tensor capabilities are unsatisfactory. – Artes Feb 22 '13 at 07:25
  • @Artes: The user who asked previous question, was satisfied with a routine among answers. I do not have problems in writing these routines myself (as I was doing), except that I don't want to spend more time on that. As I expected, there are good packages already and if you had a chance in using some, please write a note about your experience. It would be really helpful. At the moment, I am playing with all from the list below. I use Mathematica 8, but my feeling would be that still these packages are more advanced than Tensors from ver. 9. – Vladimir Feb 22 '13 at 16:27

2 Answers2

25

Mathematica 9 contains some functionality for working with symbolic tensors.

Here's a list of packages in no particular order, that may have some functionality for working with symbolic tensors.

  • TensoriaCalc - intended for basic calculations in general relativity, but not finished (calculates only Christoffel symbols, Riemann and Ricci tensor). Parallel working with many metrics is possible. Symbolic calculations are not supported.

  • FeynCalc

  • grt - intended for basic calculations in general relativity, but full of bugs (only Christoffel symbols fully function). Symbolic calculations are not supported.

  • NCAlgebra, for manipulating non-commuting algebraic expressions and computing non-commutative Gröbner bases. It allows working with symbolic matrices and symbolic block matrices (e.g. symbolic block matrix inversion).

  • xAct - a package designed by researchers for large scale projects in general relativity; subpackages capable of extensive tensor manipulation (xTensor, xCoba) as well as perturbation theory in general relativity to any order (xPert). Other subpackages can also work with tensor spherical harmonics, spinor computations as well as exterior calculus (diferential forms).

  • GRQUICK

  • MathTensor (non-free)

  • Tensorial (non-free)

  • Ricci (last updated Sep 2011)

  • diffgeo (free) - a very simple package for differential geometry. Works only with given basis and metric

  • GREATER2 (free) - a simple package for tensorial calculations. Aimed more at physicists where e.g. the metric can be input as a line element.

  • OGRe (free) - released in 2021 for Mathematica 12.0 and later. Designed to be both powerful and user-friendly. Especially suitable for general relativity. Allows performing arbitrarily complicated tensor operations, and automatically transforms between index configurations and coordinate systems behind the scenes as needed for each operation.

See also the Wikipedia page on Tensor Software.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • 1
    I marked this as community wiki so everyone can edit. If you have used any of these, please edit this post and add a short description. This question could be repurposed to be a list of tensor-related packages, explaining what each one can or cannot do, so people who are looking for this functionality can more easily decide which one to try. Symbolic tensors or matrices are a common question, so this will be useful to have. – Szabolcs Feb 21 '13 at 14:49
  • Also feel free to remove packages from the list if you have tried them and found them significantly wanting. A list of the best, with short descriptions of what they're meant for, is much more useful than an exhaustive list. – Szabolcs Feb 21 '13 at 21:08
  • Very nice idea! – Dr. belisarius Feb 22 '13 at 02:06
  • 1
    https://library.wolfram.com/infocenter/ID/8848/ is another one. – Bill Watts Feb 10 '21 at 21:36
  • @BillWatts If you are familiar with it, please add it to the post with a short description. – Szabolcs Feb 11 '21 at 11:17
7

The link for Tensorial above is dead, you may find something interesting on J. F. Gouyet's page.

I prefer in general not to use packages and make my own simple cooking.

Also there are two functions Subscript and Index with almost same formats but slightly different syntaxes and definitions.

Index was introduced in V10. Using Subscript may be more careful because many people still have old Mathematica versions.