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. enter image description here


1 Answer 1


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],
               Subscript["\[PartialD]", {n}.{r,[Theta],\[Phi],\[Psi]}]

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.