(f, g)
return f.__rmul__(g)
Multiply rational functions ``f`` and ``g``.
Multiply rational functions ``f`` and ``g``.
Multiply rational functions f and g .
def __mul__(f, g):
        """Multiply rational functions ``f`` and ``g``. """
        field = f.field

        if not f or not g:
            return field.zero
        elif isinstance(g, field.dtype):
            return f.new(f.numer*g.numer, f.denom*g.denom)
        elif isinstance(g, field.ring.dtype):
            return f.new(f.numer*g, f.denom)
        else:
            if isinstance(g, FracElement):
                if isinstance(field.domain, FractionField) and field.domain.field == g.field:
                    pass
                elif isinstance(g.field.domain, FractionField) and g.field.domain.field == field:
                    return g.__rmul__(f)
                else:
                    return NotImplemented
            elif isinstance(g, PolyElement):
                if isinstance(field.domain, PolynomialRing) and field.domain.ring == g.ring:
                    pass
                else:
                    return g.__rmul__(f)

        return f.__rmul__(g)
def __mul__ ( f , g ) : field = f . field if not f or not g : return field . zero elif isinstance ( g , field . dtype ) : return f . new ( f . numer * g . numer , f . denom * g . denom ) elif isinstance ( g , field . ring . dtype ) : return f . new ( f . numer * g , f . denom ) else : if isinstance ( g , FracElement ) : if isinstance ( field . domain , FractionField ) and field . domain . field == g . field : pass elif isinstance ( g . field . domain , FractionField ) and g . field . domain . field == field : return g . __rmul__ ( f ) else : return NotImplemented elif isinstance ( g , PolyElement ) : if isinstance ( field . domain , PolynomialRing ) and field . domain . ring == g . ring : pass else : return g . __rmul__ ( f ) return f . __rmul__ ( g )