Hello everyone,
I'm trying to understand how the package works and I can't figure out how to define a new tensor from already defined tensors.
My initial code is,
Needs["xAct`xCoba`"];
$DefInfoQ = $UndefInfoQ = False;
DefManifold[M4, 4, {\[Mu], \[Nu], \[Alpha], \[Beta], \[Gamma], \
\[Delta], \[Lambda]}]
DefChart[schw, M4, {0, 1, 2, 3}, {t[], r[], \[Theta][], \[Phi][]}]
ServantsOf[schw]
DefConstantSymbol[Mass, PrintAs -> "M"]
DefScalarFunction[a]
k = 0;
g = CTensor[
DiagonalMatrix[{-1, a[t[]]^2/(1 - k*r[]^2), a[t[]]^2*r[]^2,
a[t[]]^2*(r[]^2)*Sin[\[Theta][]]^2}], {-schw, -schw}];
MetricsOfVBundle[TangentM4] ^= {g};
CD = CovDOfMetric[g];
RicciScalar[CD]
and now I'm trying to define the Energy-Momentum tensor using the 4 velocity
u = CTensor[{1, 0, 0, 0}, {-schw}];
and the combination
DefScalarFunction[\[Rho]];
DefScalarFunction[p];
((\[Rho] + p)*u[-\[Alpha]]*u[-\[Beta]] + p*g[-\[Alpha], -\[Beta]])
My question is, how do I define a new tensor from the above expression in which the indices work as they should? I would like to be able to have a new tensor called T[\alpha,\beta] from the expression a above which would allow me to obtain, for example, the trace T[\alpha,-\alpha] and calculate covariant derivatives.
Thanks in advance!
P.