Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Discriminant of multivariate polynomials with complex coefficients

I would like to compute the discriminant of some polynomial in two variables, x and z, the discriminant should be computed with respect to x. I am able to do so in certain cases, but not when the coefficients are complex numbers written in a certain way. For example, this works:

R.<z> = QQ[]
S.<x> = R[]
p = x**2 - z**2
p.discriminant()

gives:

4*z^2

But when I try to use a complex coefficient, discriminant fails because the expression is regarded as a symbolic expression, instead of a polynomial

q = x**2 - z**2 * I
q.discriminant()

AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'discriminant'

Curiously, if I use instead

q = x**2 - z**2 * 1j
q.discriminant()

this gives the correct answer. Now for particular reasons I really need to deal with 'I' as the complex unit, and cannot use 'j'. What's wrong with 'I'?