Message Boards Message Boards

10 Replies
6 Total Likes
View groups...
Share this post:

Mathematica for General Relativity and Gravity research

Posted 11 years ago
Dear community members,

I'm currently try to use Wolfram Mathematica to some gravity research. But i can't find built-in methods do differential geometry calculations in Mathematica.
For example, is there any way to compute Einstein or Ricci tensor by metric? Or something more complicate, like create manifold, some medium with fixed state equation and write Einstein equations for this system?


Boris Latosh
POSTED BY: Boris Latosh
10 Replies
I did not need this type of functionality in the past, so unfortunately I cannot tell you which packages are the most useful.

But you'll find a list of tensor-related packages here on Mathematica.SE.

The list can be edited by the public wiki-style, so if you put some time into trying one of these packages, you can add a paragraph to the wiki post describing your experiences.
POSTED BY: Szabolcs Horvát
Here's my rewrite of one of the notebooks at
 rewritten from
 In[5]:= n = 4;
 In[6]:= coord = {r, \[Theta], \[Phi], t};
 In[8]:= metric = DiagonalMatrix[{(1 - 2 m/r)^-1, r^2, r^2 Sin[\[Theta]]^2,
     2 m/r - 1}];
In[10]:= inversemetric = Simplify @ Inverse[metric];

In[12]:= affine = Simplify @
   Table[1/2 Sum[
        s]]*(D[metric[[s, j]], coord[[k]]] + D[metric[[s, k]], coord[[j]]] -
         D[metric[[j, k]], coord[[s]]]), {s, n}], {i, n}, {j, n}, {k, n}];

In[14]:= riemann = Simplify @
   Table[D[affine[[i, j, l]], coord[[k]]] - D[affine[[i, j, k]], coord[[l]]] +
      Sum[affine[[s, j, l]] affine[[i, k, s]] -
       affine[[s, j, k]] affine[[i, l, s]], {s, n}], {i, n}, {j, n}, {k,
     n}, {l, n}];

In[15]:= ricci = Simplify @ Table[Sum[riemann[[i, j, i, l]], {i, n}], {j, n}, {l, n}]

Out[15]= {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}

In[16]:= scalar = Simplify[Sum[inversemetric[[i, j]] ricci[[i, j]], {i, n}, {j, n}]]

Out[16]= 0

In[17]:= einstein = ricci - 1/2 scalar*metric

Out[17]= {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
It shows that the Schwarzschild metric satisifes the Einstein equation.  I didn't show the components of the 3rd and 4th rank tensors here.
POSTED BY: Frank Kampas
You may want to look through this thread on Mathematica StackExchange:

which has material that may help you get going (as well as having some additional possibly useful links)
POSTED BY: David Reiss
I looked at the TensorProduct page and didn't see a component-based definition of TensorProduct.
POSTED BY: Frank Kampas
Please take a look at the new Symbolic Tensors functionality introduced in version 9. Specifically:
To get started with basic examples read through this page: TensorProduct
POSTED BY: Sam Carrettie
Posted 11 years ago
Great! Thank to everybody! This will do for beginning!
POSTED BY: Boris Latosh
You might want to have a look at this:

POSTED BY: Marco Thiel
There are some old Mathematica (v 4) notebooks for doing GR at this link:

I've updated and run one of them myself and it worked fine,
working from the pdf version.  It may be possible to run the notebook itself
but I didn't try that.
POSTED BY: Frank Kampas
How does one work from a pdf version?
POSTED BY: Douglas Youvan
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract