ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 18 Feb 2011 07:53:04 +0100Problems with computing discriminants and resultants.https://ask.sagemath.org/question/7944/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.Tue, 15 Feb 2011 08:17:34 +0100https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/Comment by cswiercz for <p>I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.</p>
<p>I have noticed the following:</p>
<p>1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like</p>
<pre><code>f.resultant(f.derivative(y),y)
</code></pre>
<p>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:</p>
<p>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:</p>
<ul>
<li>Go back to the multivariate case and use the approach above.</li>
<li>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.</li>
<li>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. </li>
</ul>
<p>See an example:</p>
<pre><code>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())
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/?comment=22107#post-id-22107Agreed. 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!Wed, 16 Feb 2011 18:35:05 +0100https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/?comment=22107#post-id-22107Comment by kcrisman for <p>I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.</p>
<p>I have noticed the following:</p>
<p>1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like</p>
<pre><code>f.resultant(f.derivative(y),y)
</code></pre>
<p>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:</p>
<p>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:</p>
<ul>
<li>Go back to the multivariate case and use the approach above.</li>
<li>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.</li>
<li>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. </li>
</ul>
<p>See an example:</p>
<pre><code>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())
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/?comment=22112#post-id-22112I 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.Wed, 16 Feb 2011 15:52:38 +0100https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/?comment=22112#post-id-22112Answer by mmarco for <p>I have been trying to prepare a class on algebraic geometry, and make some exercises (involving resultants and discriminants of polynomials) in sage.</p>
<p>I have noticed the following:</p>
<p>1) Discriminant is not defined for multivariate polynomial rings (handled by libsingular), they could be easily implemented by something like</p>
<pre><code>f.resultant(f.derivative(y),y)
</code></pre>
<p>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:</p>
<p>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:</p>
<ul>
<li>Go back to the multivariate case and use the approach above.</li>
<li>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.</li>
<li>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. </li>
</ul>
<p>See an example:</p>
<pre><code>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())
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/?answer=12124#post-id-12124It is now track ticket 10799. I have changed the .resultant() procedure for univariable polynomials that could have problems with the PARI interface, and send them to the multivariable case (handled by Singular).
Please test and review it.Fri, 18 Feb 2011 07:53:04 +0100https://ask.sagemath.org/question/7944/problems-with-computing-discriminants-and-resultants/?answer=12124#post-id-12124