# 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.

I would say that this discussion is best handled on sage-devel and/or on a ticket. Sounds like a great idea to improve this, though! Now that resultants are back in style.

Agreed. Also, my research involves computing multivariate resultants. I was hoping to write some basic code, myself, but kudos to you if you're thinking about doing it! I'd be happy to at least be a tester. :) Basically, I just want to say that I'd like to see this functionality soon!