

def dup_discriminant(f, K):
    '\n    Computes discriminant of a polynomial in `K[x]`.\n\n    Examples\n    ========\n\n    >>> from sympy.polys import ring, ZZ\n    >>> R, x = ring("x", ZZ)\n\n    >>> R.dup_discriminant(x**2 + 2*x + 3)\n    -8\n\n    '
    d = dup_degree(f)
    if (d <= 0):
        return K.zero
    else:
        s = ((- 1) ** ((d * (d - 1)) // 2))
        c = dup_LC(f, K)
        r = dup_resultant(f, dup_diff(f, 1, K), K)
        return f.quo(r, (c * K(s)))

dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py dup_discriminant/VarMisuse@91/216 `K`->`f`