# Trying to find divergence of 4-D second rank tensor

I want to find a divergence of a 2-rank 4-dimensional tensor(one time and three spherical spatial), and the following is the code I've tried. :

    (*Defining the stress-energy tensor as a 4x4 symmetric array*)
\[Sigma][t_, r_, \[Theta]_, \[CurlyPhi]_] =
SymmetrizedArray[{{1, 1} -> \[Sigma]tt[r, \[Theta], \[CurlyPhi]],
{1, 2} -> \[Sigma]tr[r, \[Theta], \[CurlyPhi]],
{1, 3} -> \[Sigma]t\[Theta][r, \[Theta], \[CurlyPhi]],
{1, 4} -> \[Sigma]t\[Phi][r, \[Theta], \[CurlyPhi]],
{2, 2} -> \[Sigma]rr[r, \[Theta], \[CurlyPhi]],
{2, 3} -> \[Sigma]r\[Theta][r, \[Theta], \[CurlyPhi]],
{2, 4} -> \[Sigma]r\[CurlyPhi][r, \[Theta], \[CurlyPhi]],
{3, 3} -> \[Sigma]\[Theta]\[Theta][r, \[Theta], \[CurlyPhi]],
{3, 4} -> \[Sigma]\[Theta]\[Phi][r, \[Theta], \[CurlyPhi]],
{4, 4} -> \[Sigma]\[Phi]\[Phi]}, {4, 4}, Symmetric[All]];

(*Define the divergence of the stress-energy tensor*)
Div[\[Sigma][r, \[Theta], \[Phi]], {t, r, \[Theta], \[Phi]},
"Spherical"] // Simplify // Normal


I know "Spherical" is not defined for four dimensions, so how do I manipulate this code to get Div for a 4-dimensional 2-rank Tensor? These are the errors I get :

DataStructure::setop: -- Message text not found -- (SymmetrizedArray[Dimensions: {4,4} Symmetry: Symmetric[{1,2}]][t_,r_,[Theta],[CurlyPhi]]) (t_)

Div::sclr: The scalar expression SymmetrizedArray[Dimensions: {4,4} Symmetry: Symmetric[{1,2}]][r,[Theta],[Phi]] does not have a divergence.

I am not shure what kind of 4d sperical you have in mind. Use hyperspherical coordinates

 div4= Div[Array[Subscript[f, #][r, \[Theta], \[Phi], \[Psi]] &,4],
{r, \[Theta], \[Phi], \[Psi]}, {"Hyperspherical", 4}];

div4 //.{ Subscript[f,p_][r,\[Theta],__]:>Subscript[f, p],
Derivative[n__][f_][__]:>
Subscript["\[PartialD]", {n}.{r,[Theta],\[Phi],\[Psi]}]
[CenterDot]f}//Expand


that Mathematica TeX copy yields as stacked fraction $$\frac{\frac{\frac{2 f_2 \cos (\theta )+\partial _{\psi }\cdot f_4+f_3 \cos (\phi )+3 f_1}{\sin (\phi )}+\partial _{\phi }\cdot f_3}{\sin (\theta )}+\partial _{\theta }\cdot f_2}{r}+\partial _r\cdot f_1$$

If you want to use 3-spherical plus cartesian time, eg as a continuity equation, its of course $$\partial_t T(t,r,\theta ,\phi) + \text{div}_{r,\theta,\phi} \left(A_r,A_\theta, A_\phi\right)$$ in spherical coordinates.