'Computes the discriminant of ``f``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> Poly(x**2 + 2*x + 3, x).discriminant()
-8'

def discriminant(f):

    if hasattr(f.rep, 'discriminant'):
        result = f.rep.discriminant()
    else:
        raise OperationNotSupported(f, 'discriminant')
    return f.per(result, remove=0)
