(self, a)
return self((num, den)).cancel()
Convert SymPy's expression to `dtype`.
Convert SymPy's expression to `dtype`.
Convert SymPy s expression to dtype .
def from_sympy(self, a):
        """Convert SymPy's expression to `dtype`. """
        p, q = a.as_numer_denom()

        num, _ = dict_from_basic(p, gens=self.gens)
        den, _ = dict_from_basic(q, gens=self.gens)

        for k, v in num.items():
            num[k] = self.dom.from_sympy(v)

        for k, v in den.items():
            den[k] = self.dom.from_sympy(v)

        return self((num, den)).cancel()
def from_sympy ( self , a ) : p , q = a . as_numer_denom ( ) num , _ = dict_from_basic ( p , gens = self . gens ) den , _ = dict_from_basic ( q , gens = self . gens ) for k , v in num . items ( ) : num [ k ] = self . dom . from_sympy ( v ) for k , v in den . items ( ) : den [ k ] = self . dom . from_sympy ( v ) return self ( ( num , den ) ) . cancel ( )