Message Boards Message Boards


How to use/ evaluate symbolic vector calculus identities?

Posted 4 months ago
3 Replies
2 Total Likes

Dear Wolfram Team:

If have tried to apply identities of vector derivatives involving ratios and products (not just for simple " * " but also the "Dot" and "TensorProduct" generalizations).

Unfortunately, the expressions, done in simbolic tensor form, remain unevaluated.

See notebook attached for an example with the divergence, where the following identities (taken from Vector Derivative (Wolfram mathworld)) should be used by the program:

Divergence identities from wolfram mathworld I am not sure if:

1) I am missing something (maybe some add-in, but in the reference pages the relevant add-in should be incorporated in main program since at least version 9)

2) I should activate some extra command.

3) Something is wrong with my version of Mathematica so I need to download//install it again.

4) Anything else

Thank you in advance for your help.

3 Replies

I am not aware of built-in facilities for vector calculus at this level of abstraction. There may be ready-made packages around. However, we can roll out a version using pattern replacement rules:

scalarQ[_?NumberQ] := True;
divRules = {myDiv[(s_ /; scalarQ[s])*v_, x_] /; FreeQ[s, x] :> 
    s*myDiv[v, x],
   myDiv[v1_ + v2_, x_] :> myDiv[v1, x] + myDiv[v2, x],
   myDiv[(s_ /; scalarQ[s])*v_, x_] :> 
    s*myDiv[v, x] + myDot[myGrad[s, x], v],
   myDiv[myCross[v1_, v2_], x_] :> 
    myDot[v2, myCurl[v1, x]] - myDot[v1, myCurl[v2, x]]};
renderRules = {myDiv -> Inactive[Div], myDot -> Inactive[Dot], 
   myGrad -> Inactive[Grad], myCross -> Inactive[Cross],
   myCurl -> Inactive[Curl]};
scalarQ[s1] = True;
scalarQ[s2[__]] = True;
expr = s1*v[t, x] + v2[t, x] + s2[t, x]*v3[t, x] + 
   myCross[v4[t, x], v5[t, x]];
expr /. renderRules
myDiv[expr, x] //. divRules /. renderRules

Dear professor Gianluca Gorni:

Thank you very much for your help, now my problem is almost solved!

I slightly modified the code received to allow for the following options:

1) non-numeric scalar symbols like "s0" or "s1[t,x]":

scalarQ[S_] := TrueQ[TensorRank[S] === 0];

2) Identities for Dot and TensorProduct combinations, taken from Lebedev (2003):

myDot[T_, S_] /; scalarQ[S] :> T*S

myDot[TensorProduct[T1_, T2_], T3_] :> 
 TensorProduct[T1, myDot[T2, T3]]

myDot[T1_, TensorProduct[T2_, T3_]] :> 
 TensorProduct[myDot[T1, T2], T3],

3) Divergence of a Tensor product. For this, I applied the product rule:

myDiv[TensorProduct[T1_, T2_], x_] :> 
 TensorProduct[myDiv[T1, x], T2] + myDot[T1, myGrad[T2, x]],

4) Finally, to allow for constant functions, I added the conditions:

yDiv[T_, x_] /; FreeQ[T, x] :> 0

myGrad[T_, x_] /; FreeQ[T, x] :> 0

My main doubt is the item nÂș3, as I cannot find an explicit published reference. The best I could find was this entry in a physics forum (coincidentally, the fluid mechanics problem involved is the same I have):

Fluid dynamics - divergence of a tensor product

The derivation offered there seems right, but maybe I am wrong.

Finally, I am attaching the full notebook (with the continuum mechanics problem included). Please tell me if there is some mistake there.


Lebedev, Leonid P, and Michael J Cloud. Tensor Analysis, World Scientific Publishing Company, 2003


Maybe the identity involving the divergence of a tensor product can be proved by making the algebraic computation of the partial derivatives, assuming T1 = Through[{f1, f2, f3}[x1, x2, x3]] etc.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract