I have a usual mathematical background in vector and tensor calculus. I was trying to use the differential operators of Mathematica, namely Grad
, Div
and Curl
. According to my knowledge, the definitions of Mathematica for Grad
and Div
coincides with those usually employed in tensor calculus, that is to say
\begin{align*} \text{grad}\mathbf{T}&:=\sum_{k=1}^{3}\frac{\partial\mathbf{T}}{\partial x_k}\otimes \mathbf{e}_k\\ \text{div}\mathbf{T}&:=\sum_{k=1}^{3}\frac{\partial\mathbf{T}}{\partial x_k}\cdot\mathbf{e}_k \\ \tag{1} \end{align*}
for any tensor $\mathbf{T}$ of rank $n\ge1$. $x_k$'s are Cartesian coordinates and $\mathbf{e}_i$'s are the standard basis for $\mathbb{R}^3$. $\otimes$ and $\cdot$ are the usual generalized outer and inner products which are also defined in Mathematica by Outer
and Inner
. The usual definition that I know from tensor calculus for the Curl
is as follows
\begin{align*}
\text{curl}\mathbf{T}&:=\sum_{k=1}^{3}\mathbf{e}_k\times\frac{\partial\mathbf{T}}{\partial x_k}.
\tag{2}
\end{align*}
However, it turns out that Mathematica's definition for curl is totally different. For example, it returns the Curl
of a second order tensor as a scalar, while according to $(2)$ it should be a second order tensor.
I couldn't find a precise definition of Mathematica for
Curl
in the documents. I am wondering what this definition is. What is the motivation for this? and How it can be related to the definition given in $(2)$?
Below is a simple piece of code for you to observe the outputs of Mathematica when we apply the Grad
, Div
and Curl
operators to scalar, vector and second order tensor fields. I would like to draw your attention to some observations. Curl
of a scalar is returned as a second order tensor, which I don't understand why! Curl
of a vector coincides with the usual definition of Curl
used in vector calculus. Curl
of second order tensor is returned as a scalar, which I don't understand again.
Var={Subscript[x, 1],Subscript[x, 2],Subscript[x, 3]};
Sca=\[Phi][Subscript[x, 1],Subscript[x, 2],Subscript[x, 3]];
Vec={Subscript[v, 1][Subscript[x, 1],Subscript[x, 2],Subscript[x, 3]],Subscript[v, 2][Subscript[x, 1],Subscript[x, 2],Subscript[x, 3]],Subscript[v, 3][Subscript[x, 1],Subscript[x, 2],Subscript[x, 3]]};
Ten=Table[Subscript[T, i,j][Subscript[x, 1],Subscript[x, 2],Subscript[x, 3]],{i,1,3},{j,1,3}];
MatrixForm[Grad[Sca, Var]]
MatrixForm[Grad[Vec, Var]]
MatrixForm[Grad[Ten, Var]]
MatrixForm[Div[Sca, Var]]
MatrixForm[Div[Vec, Var]]
MatrixForm[Div[Ten, Var]]
MatrixForm[Curl[Sca, Var]]
MatrixForm[Curl[Vec, Var]]
MatrixForm[Curl[Ten, Var]]
I will be happy if someone can reproduce the following result for the curl of a second order tensor with Mathematica's Curl
function.
\begin{align*} \text{curl}\mathbf{T}&:=\sum_{k=1}^{3}\mathbf{e}_k\times\frac{\partial\mathbf{T}}{\partial x_k}=\sum_{k=1}^{3}\mathbf{e}_k\times\frac{\partial}{\partial x_k}\left(\sum_{i=1}^{3}\sum_{j=1}^{3}T_{ij}\mathbf{e}_i\otimes\mathbf{e}_j\right)\\ &=\sum_{k=1}^{3}\sum_{i=1}^{3}\sum_{j=1}^{3}\frac{\partial T_{ij}}{\partial x_k}(\mathbf{e}_k\times\mathbf{e}_i)\otimes\mathbf{e}_j\\ &=\sum_{k=1}^{3}\sum_{i=1}^{3}\sum_{j=1}^{3}\sum_{m=1}^{3}\epsilon_{kim}\frac{\partial T_{ij}}{\partial x_k}\mathbf{e}_m\otimes\mathbf{e}_j \tag{3} \end{align*}
where $\epsilon_{kim}$ is the LeviCivitaTensor
for $3$ dimensions. Consequently, we get
\begin{align*} \left(\text{curl}\mathbf{T}\right)_{mj}=\sum_{k=1}^{3}\sum_{i=1}^{3}\epsilon_{kim}\frac{\partial T_{ij}}{\partial x_k}. \tag{4} \end{align*}
Implementing $(4)$ in Mathematica, we obtain
CurlTen = Table[
Sum[
LeviCivitaTensor[3][[k, i, m]]
D[Subscript[T, i, j][Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]], {Subscript[x, k]}], {k, 1, 3}, {i, 1, 3}],
{m, 1, 3}, {j, 1, 3}];
MatrixForm[CurlTen]