We will set up the Einstein field equations , with the Ricci tensor and scalar curvature all computed from the Riemann tensor , which we construct from the metric and the Christofel symbols
We will construct a spherically symmetric static metric with , , and using REDUCE’s “operator”, the generic indexed variable with dependencies. The metric and as well as the Riemann, Ricci, and Einstein tensors are all defined as operators.
and we try to get the equations for that will lead to the Schwartzchild solution
perator g,h,x,gamm,R,!G;
depend !A, x(2);
depend !B, x(2);
% lower-index metric
for n:=1:4 do for m:=1:4 do g(n,m):=0;
for n:=1:4 do for m:=1:4 do h(n,m):=0;
g(1,1):=e^!A; h(1,1):=1/g(1,1);
g(2,2):=-e^!B; h(2,2):=1/g(2,2);
g(3,3):=-x(2)^2; h(3,3):=1/g(3,3);
g(4,4):=-(x(2)*sin(x(3)))^2; h(4,4):=1/g(4,4);
First we compute the operators gamma(i,j,k), the Christofel symbols. Lines in reduce end in ; if you want output printed, or in a dollar sign if you want output suppressed. WE suppress the output here because we don’t want all 64 symbols printed
% Christofel symbols
for i:=1:4 do for j:=1:4 do for k:=1:4 do
gamm(i,j,k):=for l:=1:4 sum (df(g(k,l),x(j))+df(g(j,l),x(k))
-df(g(j,k),x(l)))*h(i,l)/2$
Next we compute the Riemann tensor, Ricci tensor, and scalar curvature
% Riemann, first upper, rest lower index
for a:=1:4 do for b:=1:4 do for c:=1:4 do for d:=1:4 do
R(a,b,c,d):=df(gamm(a,d,b),x(c))-df(gamm(a,c,b),x(d))
+for m:=1:4 sum (gamm(m,d,b)*gamm(a,c,m)-gamm(m,c,b)*gamm(a,m,d))$
% Ricci tensor, lower indices
operator ricci;
for i:=1:4 do for j:=1:4 do ricci(i,j):=for k:=1:4 sum R(k,i,k,j)$
% scalar curvature
operator sc;
sc:=for i:=1:4 sum for j:=1:4 sum h(i,j)*ricci(i,j)$
Finally we build the Einstein tensor…
% Einstein, all lower indices
for i:=1:4 do for j:=1:4 do !G(i,j):=ricci(i,j)-(1/2)*g(i,j)*sc$
We have suppressed printing all along, now we load the rlfi package and use it to print the components of but remember our labels are , , ,
load_package rlfi$ % load LaTeX package
on latex$ % switch on LaTeX output
operator !R$ defindex !R(down,down,arg)$ defid !R,name=!R$ % so we can print math
operator !x$ defindex !x(down,arg)$ defid !x,name=!x$
!R(1,1)=ricci(2,2);
!R(0,0)=ricci(1,1);
!R(2,2)=ricci(3,3);
!R(3,3)=ricci(4,4);
This is what it looks like, a little cleanup is needed