# Revision history [back]

### Problems with computing discriminants and resultants.

I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.

I have noticed the following:

1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like

f.resultant(f.derivative(y),y)


Other option would be to convert our polynomials to a univariate polynomial ring (over a ring with the other variables), and then use the function defined in univariate rings. But this has the following problem:

2) Both discriminant and resultants are defined for univariate polynomial rings, but they raise an error when the variable is not 'x', and there are more variables in the base ring. I think it can be solved in three possible ways: -Go back to the multivariate case and use the approach above. -Change the name of the variables, in such a way that the variable of the univariate polynomial ring is called 'x', compute the resultant/discriminant and then change the names back. -Make pari forget about the other variables involved, making them live not in a polynomial ring, but in its base field. The computation works fine there, and then we can convert the result (who lives in the fraction field, back to the original ring. See an example:

R.<x,y>=QQ[]
f=R(x^2+y^3-1)
gf=f.polynomial(R(y))
gf.base_ring()(gf.change_ring(gf.base_ring().fraction_field()).discriminant())


I plan to submit a patch with some of this solutions, but i would like to know what do you think would be the best approach.

 2 No.2 Revision kcrisman 11847 ●36 ●117 ●236

### Problems with computing discriminants and resultants.

I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.

I have noticed the following:

1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like

f.resultant(f.derivative(y),y)


Other option would be to convert our polynomials to a univariate polynomial ring (over a ring with the other variables), and then use the function defined in univariate rings. But this has the following problem:

2) Both discriminant and resultants are defined for univariate polynomial rings, but they raise an error when the variable is not 'x', and there are more variables in the base ring. I think it can be solved in three possible ways: -Go ways:

• Go back to the multivariate case and use the approach above. -Change above.
• Change the name of the variables, in such a way that the variable of the univariate polynomial ring is called 'x', compute the resultant/discriminant and then change the names back. -Make back.
• Make pari forget about the other variables involved, making them live not in a polynomial ring, but in its base field. The computation works fine there, and then we can convert the result (who lives in the fraction field, back to the original ring.

See an example:

R.<x,y>=QQ[]
f=R(x^2+y^3-1)
gf=f.polynomial(R(y))
gf.base_ring()(gf.change_ring(gf.base_ring().fraction_field()).discriminant())


I plan to submit a patch with some of this solutions, but i would like to know what do you think would be the best approach.

 3 retagged Kelvin Li 503 ●5 ●12 ●17

### Problems with computing discriminants and resultants.

I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.

I have noticed the following:

1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like

f.resultant(f.derivative(y),y)


Other option would be to convert our polynomials to a univariate polynomial ring (over a ring with the other variables), and then use the function defined in univariate rings. But this has the following problem:

2) Both discriminant and resultants are defined for univariate polynomial rings, but they raise an error when the variable is not 'x', and there are more variables in the base ring. I think it can be solved in three possible ways:

• Go back to the multivariate case and use the approach above.
• Change the name of the variables, in such a way that the variable of the univariate polynomial ring is called 'x', compute the resultant/discriminant and then change the names back.
• Make pari forget about the other variables involved, making them live not in a polynomial ring, but in its base field. The computation works fine there, and then we can convert the result (who lives in the fraction field, back to the original ring.

See an example:

R.<x,y>=QQ[]
f=R(x^2+y^3-1)
gf=f.polynomial(R(y))
gf.base_ring()(gf.change_ring(gf.base_ring().fraction_field()).discriminant())


I plan to submit a patch with some of this solutions, but i would like to know what do you think would be the best approach.