

def dup_invert(f, g, K):
    '\n    Compute multiplicative inverse of `f` modulo `g` in `F[x]`.\n\n    Examples\n    ========\n\n    >>> from sympy.polys import ring, QQ\n    >>> R, x = ring("x", QQ)\n\n    >>> f = x**2 - 1\n    >>> g = 2*x - 1\n    >>> h = x - 1\n\n    >>> R.dup_invert(f, g)\n    -4/3\n\n    >>> R.dup_invert(f, h)\n    Traceback (most recent call last):\n    ...\n    NotInvertible: zero divisor\n\n    '
    (s, h) = dup_half_gcdex(f, g, K)
    if (h == [K.one]):
        return dup_rem(s, s, K)
    else:
        raise NotInvertible('zero divisor')

dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py dup_invert/VarMisuse@49/259 `g`->`s`