# How do I use sage to check differential vector identities? Do I need to create an operator?

Hi!
I would like to check some differential vector identities. Any suggestion to achieve this goal would be welcomed.

Example of a case I already worked out: $\vec{\nabla} (fg) = (\vec{\nabla}f) g + f (\vec{\nabla} g)$.

Code (I coudn't manage to put it on a single box, sorry):

 from sage.manifolds.operators import * E.<x,y,z> = EuclideanSpace() f = function('f')(x,y,z) g = function('g')(x,y,z) sff = E.scalar_field(sff, name = 'sff') sfg = E.scalar_field(sfg, name = 'sfg') sffg = E.scalar_field(sffg, name = 'sffg') grad(sffg) == grad(sff) * sfg + sff * grad(sfg) 

Out: True

Example of what I want to check: $\vec{\nabla} (\vec{A}\centerdot \vec{B}) = \vec{A}\times(\vec{\nabla} \times \vec{B}) + \vec{B} \times (\vec{\nabla} \times \vec{A}) + (\vec{A} \centerdot \vec{\nabla}) \vec{B} + (\vec{B} \centerdot \vec{\nabla}) \vec{A}.$ I don't know how to came to differential operators of the form $(\vec{A} \centerdot \vec{\nabla})$.

I tried (kind of hopelessly) newOperator=A.dot(grad()) without success.

How could I put sage to check identities like this one?

edit retag close merge delete

Sort by ยป oldest newest most voted

You can define the following Python function:

def dotnabla(A, B):
nabla = E.metric().connection()
return nabla(B).contract(A)


which evaluates $(\vec{A}\cdot\vec{\nabla})\vec{B}$ as the contraction $A^j\nabla_j B^i$.

more

Thank you a lot, Eric! This is what I was searching for.

( 2021-07-30 14:40:29 +0200 )edit