(self, printer=None)
return Fake()
Pretty Printing method.
Pretty Printing method.
Pretty Printing method .
def _pretty(self, printer=None):
        """Pretty Printing method. """
        from sympy.physics.vector.printing import VectorPrettyPrinter
        e = self

        class Fake(object):
            baseline = 0

            def render(self, *args, **kwargs):
                self = e
                ar = self.args  # just to shorten things
                if len(ar) == 0:
                    return unicode(0)
                ol = []  # output list, to be concatenated to a string
                for i, v in enumerate(ar):
                    for j in 0, 1, 2:
                        # if the coef of the basis vector is 1, we skip the 1
                        if ar[i][0][j] == 1:
                            ol.append(u(" + ") + ar[i][1].pretty_vecs[j])
                        # if the coef of the basis vector is -1, we skip the 1
                        elif ar[i][0][j] == -1:
                            ol.append(u(" - ") + ar[i][1].pretty_vecs[j])
                        elif ar[i][0][j] != 0:
                            # If the basis vector coeff is not 1 or -1,
                            # we might wrap it in parentheses, for readability.
                            if isinstance(ar[i][0][j], Add):
                                arg_str = VectorPrettyPrinter()._print(
                                    ar[i][0][j]).parens()[0]
                            else:
                                arg_str = (VectorPrettyPrinter().doprint(
                                    ar[i][0][j]))

                            if arg_str[0] == u("-"):
                                arg_str = arg_str[1:]
                                str_start = u(" - ")
                            else:
                                str_start = u(" + ")
                            ol.append(str_start + arg_str + ' ' +
                                      ar[i][1].pretty_vecs[j])
                outstr = u("").join(ol)
                if outstr.startswith(u(" + ")):
                    outstr = outstr[3:]
                elif outstr.startswith(" "):
                    outstr = outstr[1:]
                return outstr
        return Fake()
def _pretty ( self , printer = None ) : from sympy . physics . vector . printing import VectorPrettyPrinter e = self class Fake ( object ) : baseline = 0 def render ( self , * args , * * kwargs ) : self = e ar = self . args # just to shorten things if len ( ar ) == 0 : return unicode ( 0 ) ol = [ ] # output list, to be concatenated to a string for i , v in enumerate ( ar ) : for j in 0 , 1 , 2 : # if the coef of the basis vector is 1, we skip the 1 if ar [ i ] [ 0 ] [ j ] == 1 : ol . append ( u ( " + " ) + ar [ i ] [ 1 ] . pretty_vecs [ j ] ) # if the coef of the basis vector is -1, we skip the 1 elif ar [ i ] [ 0 ] [ j ] == - 1 : ol . append ( u ( " - " ) + ar [ i ] [ 1 ] . pretty_vecs [ j ] ) elif ar [ i ] [ 0 ] [ j ] != 0 : # If the basis vector coeff is not 1 or -1, # we might wrap it in parentheses, for readability. if isinstance ( ar [ i ] [ 0 ] [ j ] , Add ) : arg_str = VectorPrettyPrinter ( ) . _print ( ar [ i ] [ 0 ] [ j ] ) . parens ( ) [ 0 ] else : arg_str = ( VectorPrettyPrinter ( ) . doprint ( ar [ i ] [ 0 ] [ j ] ) ) if arg_str [ 0 ] == u ( "-" ) : arg_str = arg_str [ 1 : ] str_start = u ( " - " ) else : str_start = u ( " + " ) ol . append ( str_start + arg_str + ' ' + ar [ i ] [ 1 ] . pretty_vecs [ j ] ) outstr = u ( "" ) . join ( ol ) if outstr . startswith ( u ( " + " ) ) : outstr = outstr [ 3 : ] elif outstr . startswith ( " " ) : outstr = outstr [ 1 : ] return outstr return Fake ( )