(f, g, include=True)
Cancel common factors in a rational function ``f/g``.
Cancel common factors in a rational function ``f/g``.
Cancel common factors in a rational function f / g .
def cancel(f, g, include=True):
        """Cancel common factors in a rational function ``f/g``. """
        lev, dom, per, F, G = f.unify(g)

        if include:
            F, G = dmp_cancel(F, G, lev, dom, include=True)
        else:
            cF, cG, F, G = dmp_cancel(F, G, lev, dom, include=False)

        F, G = per(F), per(G)

        if include:
            return F, G
        else:
            return cF, cG, F, G
def cancel ( f , g , include = True ) : lev , dom , per , F , G = f . unify ( g ) if include : F , G = dmp_cancel ( F , G , lev , dom , include = True ) else : cF , cG , F , G = dmp_cancel ( F , G , lev , dom , include = False ) F , G = per ( F ) , per ( G ) if include : return F , G else : return cF , cG , F , G