Docsity

Computer Algebra Packages for Relativity: Maple's GRTensor & Mathematica's GRTensorM, Exams of Mathematics

Toggle sidebar
bg1
MTH 675 Fall 2005
COMPUTER ALGEBRA IN RELATIVITY
1. INTRODUCTION
Below is an introduction to the use of some computer algebra packages in relativity. The
most easily accessible is probably the Maple package GRTensor (more properly GRTensorII),
which I discuss first; there is also a Mathematica version called GRTensorM (which is not
quite as good). I also discuss the Maple package tensor, which comes with Maple. Other
available packages, discussed elsewhere, include the more specialized packages sheep and
classi, based on psl (and hence closely related to reduce).
Some of these packages, such as tensor and sheep, do coordinate computations, whereas
classi does frame computations; GRTensor and GRTensorM can do either.
These instructions are aimed at users of the unix computers in the College of Science, but should
work with minor changes on other platforms. Maple and Mathematica are available by logging into
the machine app.science.oregonstate.edu.
2. PACKAGES BASED ON MAPLE
Start Maple by typing maple for a shell interface, or xmaple & for the worksheet
front end under XWindows. All Maple commands must end with either a semicolon or a
colon; a colon suppresses output. All definitions must use := , not just =. Exit Maple
with the command quit; .
a) GRTensor
GRTensor is freeware; if you have access to Maple elsewhere and would like to obtain a copy of
GRTensor, let me know.
To enable Maple to find the GRTensor files, type (note the backquotes!)
libname:=libname,`/home/math/tevian/GRtensor/lib`:
(You can add the appropriate command to the file .mapleinit in your home directory.)
Then type readlib(grii): and grtensor(); to start GRTensor.
GRTensor contains an interactive program for constructing your own metric: Simply
type makeg(metricname); , where metricname is the name you wish to call the metric.
You will be prompted to enter the metric in one of several forms, and guided through the
necessary steps; don’t forget the semi-colon after each input!
Some standard metrics can be loaded by first telling GRTensor where to find them
with the command grOptionMetricPath:=`/home/math/tevian/GRtensor/metrics`: af-
ter which the file you want can be loaded using qload . (You can put this command in a
file called grtensor.ini in your home directory, but not in your .mapleinit file.) For
example, the Schwarzschild black hole metric can be loaded with qload(schw) .
You can also create metric files of your own by using the canned files as an analogy, then loading
your file with qload or grload . This is not as hard as it sounds, as the file only needs to
define the number of coordinates Ndim , list the coordinates x1 , etc, and enter the metric
components g11 , etc; note the trailing underscore in each variable name. For the sphere, the
file would be
Ndim :=2:
x1 :=theta:x2 :=phi:
g11 :=r^2:g22 :=r^2*sin(theta)^2:
Unspecified metric components are assumed to be zero, so you do not need to explicitly set off-
diagonal elements like g12 to zero.
- 1 -
pf3

Partial preview of the text

Download Computer Algebra Packages for Relativity: Maple's GRTensor & Mathematica's GRTensorM and more Exams Mathematics in PDF only on Docsity!

MTH 675 Fall 2005

COMPUTER ALGEBRA IN RELATIVITY

1. INTRODUCTION

Below is an introduction to the use of some computer algebra packages in relativity. The most easily accessible is probably the Maple package GRTensor (more properly GRTensorII), which I discuss first; there is also a Mathematica version called GRTensorM (which is not quite as good). I also discuss the Maple package tensor, which comes with Maple. Other available packages, discussed elsewhere, include the more specialized packages sheep and classi, based on psl (and hence closely related to reduce).

Some of these packages, such as tensor and sheep, do coordinate computations, whereas classi does frame computations; GRTensor and GRTensorM can do either.

These instructions are aimed at users of the unix computers in the College of Science, but should work with minor changes on other platforms. Maple and Mathematica are available by logging into the machine app.science.oregonstate.edu.

  1. PACKAGES BASED ON MAPLE

Start Maple by typing maple for a shell interface, or xmaple & for the worksheet front end under XWindows. All Maple commands must end with either a semicolon or a colon; a colon suppresses output. All definitions must use := , not just =. Exit Maple with the command quit;.

a) GRTensor

GRTensor is freeware; if you have access to Maple elsewhere and would like to obtain a copy of GRTensor, let me know.

To enable Maple to find the GRTensor files, type (note the backquotes!)

libname:=libname,/home/math/tevian/GRtensor/lib:

(You can add the appropriate command to the file .mapleinit in your home directory.) Then type readlib(grii): and grtensor(); to start GRTensor.

GRTensor contains an interactive program for constructing your own metric: Simply type makeg(metricname); , where metricname is the name you wish to call the metric. You will be prompted to enter the metric in one of several forms, and guided through the necessary steps; don’t forget the semi-colon after each input!

Some standard metrics can be loaded by first telling GRTensor where to find them with the command grOptionMetricPath:=/home/math/tevian/GRtensor/metrics: af- ter which the file you want can be loaded using qload. (You can put this command in a file called grtensor.ini in your home directory, but not in your .mapleinit file.) For example, the Schwarzschild black hole metric can be loaded with qload(schw).

You can also create metric files of your own by using the canned files as an analogy, then loading your file with qload or grload. This is not as hard as it sounds, as the file only needs to define the number of coordinates Ndim , list the coordinates x1 , etc, and enter the metric components g11 , etc; note the trailing underscore in each variable name. For the sphere, the file would be Ndim :=2: x1 :=theta:x2 :=phi: g11 :=r^2:g22 :=r^2*sin(theta)^2: Unspecified metric components are assumed to be zero, so you do not need to explicitly set off- diagonal elements like g12 to zero.

Many standard tensors are predefined in terms of the metric you have entered or loaded, including the inverse metric invmetric , the Christoffel symbols Chr2 , the covariant (all indices down!) Riemann tensor Riemann , the Ricci tensor Ricci , the Ricci scalar Ricciscalar , and the Einstein tensor Einstein ; the metric itself is called metric. You can calculate any of these tensors using grcalc , and see the result of the calcu- lation using grdisplay. For instance, to find the Ricci scalar, type

grcalc(Ricciscalar); grdisplay(Ricciscalar); Further documentation can be obtained by typing ?grtensor. You may need to use the gralter and/or grmap commands to fully simplify your results.

b) Tensor

The package tensor is distributed with Maple; if you have Maple, you have tensor. The information in this section is a summary of the online documentation which can be obtained by typing ?tensor or help(tensor);. Type the command with(tensor): to load the tensor package, then choose coordi- nates with a command like coord:=[theta,phi]:. Tensors are created using the some- what messy create command, in which you must first explicitly specify which indices are “up” (+1) and “down” (−1), then give a matrix of components. For instance, the (covariant, that is, both indices “down”) metric for the sphere can be entered as

g:=create([-1,-1],array(symmetric, [[r^2,0],[0,r^2*sin(theta)^2]]));

It is essential that the metric be defined as a symmetric array. The Ricci scalar R is now computed by first successively computing the inverse metric ginv , the partial derivatives of the metric dg and ddg , the Christoffel symbols Gam , the Riemann tensor Rie , and the Ricci tensor Ric , as follows; any names can be used for the intermediate steps.

ginv := invert(g,´detg´): dg := d1metric(g,coord): ddg := d2metric(dg,coord): Gam := Christoffel1(dg): Rie := Riemann(ginv,ddg,Gam): Ric := Ricci(ginv,Rie): R := Ricciscalar(ginv,Ric):

Finally, to display the result of this computation, use the command get_compts(R);.

WARNING: tensor defines the Ricci tensor and scalar to be −1 times our definitions.