1

I'm trying for first time to write a Ricci tensor with Mathematica. The code I've written is this:

Ricci := Simplify[Table[(Sum[D[GammaTesiGenerale[[i, k, m]], coord[[i]]], {i, 1, 4}] -
  Sum[D[GammaTesiGenerale[[i, k, i]], coord[[m]]], {i, 1, 4}] + 
 Sum[Sum[GammaTesiGenerale[[i, s, i]], {i, 1, 4}]*
   GammaTesiGenerale[[s, k, m]], {s, 1, 4}] - 
 Sum[Sum[GammaTesiGenerale[[i, s, m]]*
    GammaTesiGenerale[[s, k, i]], {i, 1, 4}], {s, 1, 4}]), {k, 1, 
4}, {m, 1, 4}]]

Where GammaTesiGenerale is:

GammaTesiGenerale := Simplify[Table[(1/2*
 Sum[(m[[i, s]])*(D[g[[s, j]], coord[[k]]] + 
     D[g[[s, k]], coord[[j]]] - D[g[[j, k]], coord[[s]]]), {s, 1, 
   4}]), {i, 1, 4}, {j, 1, 4}, {k, 1, 4}]]

g is the metric

{{n[t]^2, 0, 0, 0}, {0, -a[t]^2, 0, 0}, {0, 0, -a[t]^2, 0}, {0, 0, 0, -a[t]^2}}

And coord := {t, x, y, z}

My problem is that after evaluation mathematica gives me this:

Part specification 1[[1,1]] is longer than depth of object. >>
Part specification 1[[1,2]] is longer than depth of object. >>
Further output of Part::partd will be suppressed during this calculation. >>

I also get a really large matrix with many of -1[[2, 1]]. I've no idea of where these are coming form.

Have you an idea about what is happening?


I've evaluated Ricci[[1, 1]], for example.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

0 Answers0