GRTensor is a very handy Maple package for doing calculations in General Relativity. Given a specific metric, it’s great at calculating the components of tensors. You can define your own tensors or use the predefined ones. You can even define your own metrics.
Unfortunately, getting it working on Mac OS X is a bit of a pain. This is due to a bug in GRTensor that has gone unfixed for quite a while. Fortunately, there is a straightforwarde solution.The bug is triggered whenever you try to load a metric, which is usually the first thing you would do in a GRTensor session. When you do so, you are presented with the following error:
> qload(schw2); Warning: grOptionMetricPath has not been assigned. Error, (in qload) Could not find metric schw2
This error is telling us that GRTensor isn’t able to find the
schw metric, even though we know it is present in the
metrics directory. The problem seems to arise from the way GRTensor deals with path separators on the Mac. Historically, Mac OS used the colon as a path separator but, since OSX, it uses the more unix-like slash. GRTensor appears to be trying to use the old, pre-OSX colon system, so it mistakenly searches for
metrics:schw, which it obviously can’t find.
The solution is fairly straightforward – since GRTensor is looking for the file
metrics:schw.mpl, all we need to do is make sure our file is named as such and GRTensor will be able to find it (Note that the file must also reside in the directory GRTensor is installed in, not the metrics subdirectory). This rule is also valid for any other metric files you create – their names must all be prefixed with
metrics:. Unfortunately, OSX is a bit awkward about naming things with colons in them, so it’s usually easiest to rename the files using the command line.
Now, quite a few metrics come bundled with GRTensor, so renaming them all manually is quite time consuming. It’s easiest to use a simple bash script such as this one to do it automatically. Just download this script and place it in the directory where GRTensor is installed (probably
/usr/local/grii/). Make sure it’s executable and run it. On the command line, you could do so using the commands (assuming you downloaded the file to your desktop and GRTensor is in the default install location of
$ sudo cp ~/Desktop/fixmetrics.sh /usr/local/grii/ $ cd /usr/local/grii/ $ chmod +x fixmetrics.sh $ ./fixmetrics.sh
You should now be able to load all your metrics in GRTensor without any problems:
> qload(schw2); Calculated ds for schw (0.000000 sec.) Default spacetime = schw For the schw spacetime: Coordinates x(up) a x = [r, theta, phi, t] Line element 2 2 d r 2 2 2 2 2 / 2 m\ 2 ds = ------- + r d theta + r sin(theta) d phi + |-1 + ---| d t 2 m \ r / 1 - --- r The Schwarzschild metric in curvature coordinates