

def dmp_discriminant(f, u, 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,y,z,t = ring("x,y,z,t", ZZ)\n\n    >>> R.dmp_discriminant(x**2*y + x*z + t)\n    -4*y*t + z**2\n\n    '
    if (not u):
        return dup_discriminant(f, K)
    (d, v) = (dmp_degree(f, u), (u - 1))
    if (d <= 0):
        return dmp_zero(v)
    else:
        s = ((- 1) ** ((d * (d - 1)) // 2))
        c = dmp_LC(f, K)
        r = dmp_resultant(f, dmp_diff(f, 1, u, K), u, K)
        c = dmp_mul_ground(c, K(s), v, K)
        return dmp_quo(r, c, v, K)

dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py dmp_discriminant/original