I would like to calculate
$$ \mathbf T = (\mathbf B \bullet \nabla) \mathbf B$$
Where nabla (the upside down triangle) is the grad operator $(\partial/\partial x,\partial/\partial y,\partial/\partial z)$ and the dot is the divergence operator. This is the magnetic tension force, for those who are interested.
I have a vector
$$ \mathbf B = (B_x, B_y, B_z ) $$
At the moment I break this down into single-dimensional operations, do that for each dimension, then create the $\mathbf T$ vector, but I wanted to know if I could do it using the vector operations that Mathematica offers.
The struggle is that I am doing an operation on an operator, then the latter operator carries out its operation. So, the divergence operation will give us a scaler:
$$ (\mathbf B \bullet \nabla) = (B_x * \partial/\partial x + B_y * \partial/\partial y + B_z * \partial/\partial z)$$
Then for instance in the x dimension:
$$T_x = (B_x * \partial/\partial x + B_y * \partial/\partial y + B_z * \partial/\partial z) B_x = B_x \frac{\partial B_x}{\partial x} + B_y \frac{\partial B_x}{\partial y} + B_z \frac{\partial B_x}{\partial z}$$
So the full vector would be:
$$\mathbf T = (B_x \frac{\partial B_x}{\partial x} + B_y \frac{\partial B_x}{\partial y} + B_z \frac{\partial B_x}{\partial z}, B_x \frac{\partial B_y}{\partial x} + B_y \frac{\partial B_y}{\partial y} + B_z \frac{\partial B_y}{\partial z} , B_x \frac{\partial B_z}{\partial x} + B_y \frac{\partial B_z}{\partial y} + B_z \frac{\partial B_z}{\partial z}) $$
Mathematica offers the following functions Grad[]
and Div[]
; however, I can't work out how to get them to work in the required fashion.
Grad
andDiv
that did not work as intended? For instance, why is the result ofGrad[{bx[x, y, z], by[x, y, z], bz[x, y, z]}, {x, y, z}]
not suitable? $\endgroup$b = {bx[x], by[y], bz[z]}; b.Grad[b, {x, y, z}]
, which returns{bx[x] bx'[x], by[y] by'[y], bz[z] bz'[z]}
. The elements of this list seem to resemble the expressions you showed for the elements of $\mathbf T$. $\endgroup$b.Transpose@Grad[b, {x, y, z}]
. $\endgroup$