#NEWLINE# def cross( self , other ) : #NEWLINE# #INDENT# "\n        Returns the cross product of this Vector with another Vector or\n        Dyadic instance.\n        The cross product is a Vector, if 'other' is a Vector. If 'other'\n        is a Dyadic, this returns a Dyadic instance.\n\n        Parameters\n        ==========\n\n        other: Vector/Dyadic\n            The Vector or Dyadic we are crossing with.\n\n        Examples\n        ========\n\n        >>> from sympy.vector import CoordSysCartesian\n        >>> C = CoordSysCartesian('C')\n        >>> C.i.cross(C.j)\n        C.k\n        >>> C.i ^ C.i\n        0\n        >>> v = 3*C.i + 4*C.j + 5*C.k\n        >>> v ^ C.i\n        5*C.j + (-4)*C.k\n        >>> d = C.i.outer(C.i)\n        >>> C.j.cross(d)\n        (-1)*(C.k|C.i)\n\n        " #NEWLINE# if isinstance ( other , Dyadic ) : #NEWLINE# #INDENT# if isinstance ( self , VectorZero ) : #NEWLINE# #INDENT# return Dyadic . zero #NEWLINE# #UNINDENT# outdyad = Dyadic . zero #NEWLINE# for ( k , v ) in other . components . items ( ) : #NEWLINE# #INDENT# cross_product = self . cross ( k . args [ 0 ] ) #NEWLINE# outer = cross_product . outer ( k . args [ 1 ] ) #NEWLINE# outdyad += ( v * outer ) #NEWLINE# #UNINDENT# return outdyad #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( other , Vector ) ) : #NEWLINE# #INDENT# raise TypeError ( ( str ( other ) + ' is not a vector' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( self , VectorZero ) or isinstance ( other , VectorZero ) ) : #NEWLINE# #INDENT# return Vector . zero #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# def _det( mat ) : #NEWLINE# #INDENT# "This is needed as a little method for to find the determinant\n            of a list in python.\n            SymPy's Matrix won't take in Vector, so need a custom function.\n            The user shouldn't be calling this.\n\n            " #NEWLINE# return ( ( ( mat [ 0 ] [ 0 ] * ( ( mat [ 1 ] [ 1 ] * mat [ 2 ] [ 2 ] ) - ( mat [ 1 ] [ 2 ] * mat [ 2 ] [ 1 ] ) ) ) + ( mat [ 0 ] [ 1 ] * ( ( mat [ 1 ] [ 2 ] * mat [ 2 ] [ 0 ] ) - ( mat [ 1 ] [ 0 ] * mat [ 2 ] [ 2 ] ) ) ) ) + ( mat [ 0 ] [ 2 ] * ( ( mat [ 1 ] [ 0 ] * mat [ 2 ] [ 1 ] ) - ( mat [ 1 ] [ 1 ] * mat [ 2 ] [ 0 ] ) ) ) ) #NEWLINE# #UNINDENT# outvec = Vector . zero #NEWLINE# for ( system , vect ) in other . separate ( ) . items ( ) : #NEWLINE# #INDENT# tempi = system . i #NEWLINE# tempj = system . j #NEWLINE# tempk = system . k #NEWLINE# tempm = [ [ tempi , tempj , cross_product ] , [ ( self & tempi ) , ( self & tempj ) , ( self & tempk ) ] , [ ( vect & tempi ) , ( vect & tempj ) , ( vect & tempk ) ] ] #NEWLINE# outvec += _det ( tempm ) #NEWLINE# #UNINDENT# return outvec