1
Clear[coord,metric,inversemetric,affine,riemann,ricci,scalar,r,θ,ϕ]
n = 3

coord = {r,θ,ϕ}

metric = {{(1 - ((r^2)/3) - ((2 m)/r))^(-1), 0, 0}, {0, r^2, 0}, 
{0, 0, r^2*(sin[θ])^2}}

MatrixForm[metric]

inversemetric = Simplify[Inverse[metric]]

MatrixForm[inversemetric]

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

listaffine := 
 Table[If[UnsameQ[affine[[i, j, k]], 
    0], {ToString[Γ[i, j, k]], affine[[i, j, k]]}], {i, 
   1, n}, {j, 1, n}, {k, 1, j}]

TableForm[Partition[DeleteCases[Flatten[listaffine], Null], 2], 
 TableSpacing -> {2, 2}]

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,1,n}],{i,1,n},{j,1,n},{k,1,n},{l,1,n}]]

listriemann:=Table[If[UnsameQ[riemann[[i,j,k,l]],0],{ToString[R[ 
i,j,k,l]],riemann[[i,j,k,l]]}],{i,1,n},{j,1,n},{k,1,n},{l,1,k - 1}]    

TableForm[Partition[DeleteCases[Flatten[listriemann],Null],2],TableSpacing 
 ->{2,2}]

Output:

enter image description here

ricci=Simplify[Table[Sum[riemann[ [i,j,i,l]],{i,1,n}],{j,1,n}, 
{l,1,n}]]

listricci:=Table[If[UnsameQ[ ricci[[ j, l]], 0], {ToString[ 
R[j,l]],ricci[[j,l]]}],{j,1,n},{l, 1, j}]

TableForm[Partition [DeleteCases[ Flatten[ listricci], Null],2],TableSpacing 
-> {2, 2}]

Output:

enter image description here

scalar = Simplify[
  Sum[inversemetric [[i, j]] ricci [[i, j]], {i, 1, n}, {j, 1, n}]]

Output:

enter image description here

By using these results, I found that the metric is not Einstein, but someone said to me that my calculation was wrong, and the metric was supposed to be Einstein. So I think maybe there's something wrong with my code, but I just can't find any. Please someone help me to figure it out, thanks!

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
gogo2020
  • 113
  • 4
  • related by OP on physics.SE: https://physics.stackexchange.com/q/420798/84967 – AccidentalFourierTransform Aug 05 '18 at 13:43
  • You've been told, by several users already, that your metric is not Einstein. I'm not sure why you insist. It is not. And if you do believe it is Einstein, then you'll have to include a reputable reference where it is claimed that it is. "someone said to me" is useless. – AccidentalFourierTransform Aug 05 '18 at 13:44
  • 1
    That being said, there are several problems with your code. For one thing, you should use Sin instead of sin, the former being the sine function, the latter being undefined. Basic differential geometry operations are defined in Compute covariant derivative in Mathematica. In particular, I used that code when I said to you, on physics.SE, that your metric is not Einstein. Please do check it for yourself. – AccidentalFourierTransform Aug 05 '18 at 13:47
  • I checked this metric with my code. All calculations are the same. There are no errors in your code. Of course, we must take Sin[] instead of a sin, but it is not necessary. And so everything is clear. – Alex Trounev Aug 05 '18 at 14:11
  • @AccidentalFourierTransform I do believe that the metric is not Einstein. I just want to make sure that my calculation is not wrong. Thank you I will check it. – gogo2020 Aug 05 '18 at 14:17
  • @AlexTrounev Thank you. – gogo2020 Aug 05 '18 at 14:18
  • Try to use a more descriptive title and use more words in your questions rather than give a bunch of code at the start. – Chris K Aug 06 '18 at 01:33

0 Answers0