ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 15 Feb 2014 21:38:03 -0600resultant and gcd over real ?http://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/The resultant and gcd work well over rational but not over real or complex!
R.<x,y> = PolynomialRing(RR,2)
a = x^2 + y
b = x - y^2
a.resultant(b)
a.gcd(b)
This does not work while with QQ, it works. Anyone has an idea?Wed, 12 Feb 2014 11:03:49 -0600http://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/Answer by lftabera for <p>The resultant and gcd work well over rational but not over real or complex!</p>
<pre><code>R.<x,y> = PolynomialRing(RR,2)
a = x^2 + y
b = x - y^2
a.resultant(b)
a.gcd(b)
</code></pre>
<p>This does not work while with QQ, it works. Anyone has an idea?</p>
http://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/?answer=16037#post-id-16037The problem is that for these kind of inexact rings the methods are not implemented.
For the resultant, you can compute the resultant with
a.sylvester_matrix(b,x).det()
But I cannot promise performance nor numeric stability.
The gcd is more tricky. For instance, if you take univariate polynomials over an inexact rings and perform Euclides method, you will end with a gcd 1 due to numerical errors. You are asking for an approximate gcd which is not easy to compute.Wed, 12 Feb 2014 23:23:20 -0600http://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/?answer=16037#post-id-16037Answer by Jeroen Demeyer for <p>The resultant and gcd work well over rational but not over real or complex!</p>
<pre><code>R.<x,y> = PolynomialRing(RR,2)
a = x^2 + y
b = x - y^2
a.resultant(b)
a.gcd(b)
</code></pre>
<p>This does not work while with QQ, it works. Anyone has an idea?</p>
http://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/?answer=15909#post-id-15909If you define your polynomial ring as follows, it does work:
sage: P.<y> = PolynomialRing(RR)
sage: R.<x> = PolynomialRing(P)
sage: a = x^2 + y
sage: b = x - y^2
sage: a.resultant(b)
Sat, 15 Feb 2014 21:38:03 -0600http://ask.sagemath.org/question/11028/resultant-and-gcd-over-real/?answer=15909#post-id-15909