# Revision history [back]

### discriminant of multivariate polynomial

If I do

R.<x,z,I>=QQ[]
f_str = 'x**3 + x*z +1'
f = eval(f_str)
f.discriminant(x)


this works out correctly, giving

-4*z^3 - 27


But if I instead replace the coefficient of any monomial with a rational, such as

R.<x,z,I>=QQ[]
f_str = 1.0*'x**3 + x*z +1'
f = eval(f_str)
f.discriminant(x)


I get the following error:

AttributeError: 'MPolynomial_polydict' object has no attribute 'discriminant'


Can someone explain how to make it work?

### discriminant of multivariate polynomial

If I do

R.<x,z,I>=QQ[]
f_str = 'x**3 + x*z +1'
f = eval(f_str)
f.discriminant(x)


this works out correctly, giving

-4*z^3 - 27


But if I instead replace the coefficient of any monomial with a rational, such as

R.<x,z,I>=QQ[]
f_str = 1.0*'x**3 '1.0*x**3 + x*z +1'
f = eval(f_str)
f.discriminant(x)


I get the following error:

AttributeError: 'MPolynomial_polydict' object has no attribute 'discriminant'


Can someone explain how to make it work?