(self, *vector_fields)
Apply on a list of vector_fields.

        If the number of vector fields supplied is not equal to 1 + the order of
        the form field inside the differential the result is undefined.

        For 1-forms (i.e. differentials of scalar fields) the evaluation is
        done as `df(v)=v(f)`. However if `v` is ``None`` instead of a vector
        field, the differential is returned unchanged. This is done in order to
        permit partial contractions for higher forms.

        In the general case the evaluation is done by applying the form field
        inside the differential on a list with one less elements than the number
        of elements in the original list. Lowering the number of vector fields
        is achieved through replacing each pair of fields by their
        commutator.

        If the arguments are not vectors or ``None``s an error is raised.
Apply on a list of vector_fields.
Apply on a list of vector_fields .
def __call__(self, *vector_fields):
        """Apply on a list of vector_fields.

        If the number of vector fields supplied is not equal to 1 + the order of
        the form field inside the differential the result is undefined.

        For 1-forms (i.e. differentials of scalar fields) the evaluation is
        done as `df(v)=v(f)`. However if `v` is ``None`` instead of a vector
        field, the differential is returned unchanged. This is done in order to
        permit partial contractions for higher forms.

        In the general case the evaluation is done by applying the form field
        inside the differential on a list with one less elements than the number
        of elements in the original list. Lowering the number of vector fields
        is achieved through replacing each pair of fields by their
        commutator.

        If the arguments are not vectors or ``None``s an error is raised.
        """
        if any((contravariant_order(a) != 1 or covariant_order(a)) and a is not None
                for a in vector_fields):
            raise ValueError('The arguments supplied to Differential should be vector fields or Nones.')
        k = len(vector_fields)
        if k == 1:
            if vector_fields[0]:
                return vector_fields[0].rcall(self._form_field)
            return self
        else:
            # For higher form it is more complicated:
            # Invariant formula:
            # http://en.wikipedia.org/wiki/Exterior_derivative#Invariant_formula
            # df(v1, ... vn) = +/- vi(f(v1..no i..vn))
            #                  +/- f([vi,vj],v1..no i, no j..vn)
            f = self._form_field
            v = vector_fields
            ret = 0
            for i in range(k):
                t = v[i].rcall(f.rcall(*v[:i] + v[i + 1:]))
                ret += (-1)**i*t
                for j in range(i + 1, k):
                    c = Commutator(v[i], v[j])
                    if c:  # TODO this is ugly - the Commutator can be Zero and
                        # this causes the next line to fail
                        t = f.rcall(*(c,) + v[:i] + v[i + 1:j] + v[j + 1:])
                        ret += (-1)**(i + j)*t
            return ret
def __call__ ( self , * vector_fields ) : if any ( ( contravariant_order ( a ) != 1 or covariant_order ( a ) ) and a is not None for a in vector_fields ) : raise ValueError ( 'The arguments supplied to Differential should be vector fields or Nones.' ) k = len ( vector_fields ) if k == 1 : if vector_fields [ 0 ] : return vector_fields [ 0 ] . rcall ( self . _form_field ) return self else : # For higher form it is more complicated: # Invariant formula: # http://en.wikipedia.org/wiki/Exterior_derivative#Invariant_formula # df(v1, ... vn) = +/- vi(f(v1..no i..vn)) #                  +/- f([vi,vj],v1..no i, no j..vn) f = self . _form_field v = vector_fields ret = 0 for i in range ( k ) : t = v [ i ] . rcall ( f . rcall ( * v [ : i ] + v [ i + 1 : ] ) ) ret += ( - 1 ) ** i * t for j in range ( i + 1 , k ) : c = Commutator ( v [ i ] , v [ j ] ) if c : # TODO this is ugly - the Commutator can be Zero and # this causes the next line to fail t = f . rcall ( * ( c , ) + v [ : i ] + v [ i + 1 : j ] + v [ j + 1 : ] ) ret += ( - 1 ) ** ( i + j ) * t return ret