Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The previous question here links to a worksheet which gives the following code:

var ('x y z')
def divergence(F):
    assert(len(F) == 3)
    return diff(F[0],x) + diff(F[1],y) + diff(F[2],z) 
def curl(F):
    assert(len(F) == 3)
    return vector([diff(F[2],y)-diff(F[1],z), diff(F[0],z)-diff(F[2],x), diff(F[1],x)-diff(F[0],y)])

There is also a ticket here on this issue that has a link to some code as well.