def divergence(vect, frame):
 _check_vector(vect)
 if (vect == 0):
  return S(0)
 vect = express(vect, frame, variables=True)
 vectx = vect.dot(frame.x)
 vecty = vect.dot(frame.y)
 vectz = vect.dot(frame.z)
 out = S(0)
 out += diff(vectx, frame[0])
 out += diff(vecty, frame[1])
 out += diff(vectz, frame[2])
 return out

def divergence ( vect , frame ) : _check_vector ( vect ) if ( vect == 0 ) : return S ( 0 ) vect = express ( vect , frame , variables = True ) vectx = vect . dot ( frame . x ) vecty = vect . dot ( frame . y ) vectz = vect . dot ( frame . z ) out = S ( 0 ) out += diff ( vectx , frame [ 0 ] ) out += diff ( vecty , frame [ 1 ] ) out += diff ( vectz , frame [ 2 ] ) return out
returns the divergence of a vector field computed wrt the coordinate symbols of the given frame .