(* coordinate 벡터의 크기로 차원 결정한다: n=Length[vars]; *)
InverseMetric[g_] := Simplify[Inverse[g]]
ChristoffelSymbol[g_, vars_] :=
Block[{n, ig, res}, n = Length[vars]; ig = InverseMetric[g];
res = Table[(1/2) * Sum[ig[[i, s]] *
(-D[g[[j, k]], vars[[s]]] + D[g[[j, s]], vars[[k]]] + D[g[[s, k]], vars[[j]]]), {s, 1, n}],
{i, 1, n} , {j, 1, n} , {k, 1, n}];
Simplify[res]]
RiemannTensor[g_, vars_] :=
Block[{n, Chr, res}, n = Length[vars];
Chr = ChristoffelSymbol[g, vars];
res = Table[
D[Chr[[i, k, m]], vars[[l]]] - D[Chr[[i, k, l]], vars[[m]]] +
Sum[Chr[[i, s, l]]*Chr[[s, k, m]], {s, 1, n}] -
Sum[Chr[[i, s, m]]*Chr[[s, k, l]], {s, 1, n}],
{i, 1, n} , {k, 1, n} , {l, 1, n} , {m, 1, n}];
Simplify[res]]
RicciTensor[g_, vars_] :=
Block[{n, Rie, res}, n = Length[vars]; Rie = RiemannTensor[g, vars];
res = Table[
Sum[Rie[[s, i, s, j]], {s, 1, n}],
{i, 1, n} , {j, 1, n}];
Simplify[res]]
RicciScalar[g_, vars_] :=
Block[{n, Ricci, ig, res}, n = Length[vars];
Ricc = RicciTensor[g, vars]; ig = InverseMetric[g];
res = Sum[ig[[s, i]] Ricc[[s, i]], {s, 1, n} , {i, 1, n}];
Simplify[res]]
예제: 구대칭 metric
$$ds^2 = -e^{ 2\nu(r)} dt^2 + e^{2\lambda(r)} dr^2 + r^2 d\theta^2 + r^2 \sin^2 \theta d\varphi^2$$
vars = {t, r, \[Theta], \[Phi]};
g = {{-Exp[2 \[Nu][r]], 0, 0, 0}, {0, Exp[2 \[Lambda][r]], 0, 0}, {0,
0, r^2, 0}, {0, 0, 0, r^2 Sin[\[Theta]]^2}};
RicciTensor[g, vars]
결과:
'Physics > Research' 카테고리의 다른 글
Shooting method for the boundary value problems: Maple (0) | 2012.08.01 |
---|---|
Shooting Method for Boundary Value Problem: Mathematica (0) | 2012.07.28 |
Relaxation Methods for Differential Equations (0) | 2012.07.26 |
Wald’s Entropy, Area & Entanglement (0) | 2012.02.25 |
Topics in f(R) THEORIES OF GRAVITY (0) | 2012.02.24 |