ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 23 Apr 2019 06:29:58 -0500Intersection of polynomial Ideals over $\mathbb{R}$https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/I am trying to compute the intersection of Ideals over $\mathbb{R}[x,y]$, but I get problems from the coefficient $\frac{1}{\sqrt{2}}$. This is my code:
R.<x,y>=PolynomialRing(RR,order='lex')
I=Ideal([(x^2+y^2-1),(x*y),(y^3-y)])
I5=Ideal([x-1/sqrt(2),y-1/sqrt(2)])
I6=Ideal([x+1/sqrt(2),y-1/sqrt(2)])
I7=Ideal([x+1/sqrt(2),y+1/sqrt(2)])
I8=Ideal([x-1/sqrt(2),y+1/sqrt(2)])
J=I.intersection(I5,I6,I7,I8)
and this is the error I get:
TypeError: Intersection is only available for ideals of the same ring.
So when I ask if
I5 in R
the answer is False. I also tried with QQbar but same result, can someone explain this?
Thanks!
EDIT: I also tried with $\frac{\sqrt{2}}{2}$ instead of $\frac{1}{\sqrt{2}}$ and I get the same error.Thu, 18 Apr 2019 10:29:09 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/Comment by Iguananaut for <p>I am trying to compute the intersection of Ideals over $\mathbb{R}[x,y]$, but I get problems from the coefficient $\frac{1}{\sqrt{2}}$. This is my code:</p>
<pre><code>R.<x,y>=PolynomialRing(RR,order='lex')
I=Ideal([(x^2+y^2-1),(x*y),(y^3-y)])
I5=Ideal([x-1/sqrt(2),y-1/sqrt(2)])
I6=Ideal([x+1/sqrt(2),y-1/sqrt(2)])
I7=Ideal([x+1/sqrt(2),y+1/sqrt(2)])
I8=Ideal([x-1/sqrt(2),y+1/sqrt(2)])
J=I.intersection(I5,I6,I7,I8)
</code></pre>
<p>and this is the error I get:</p>
<pre><code>TypeError: Intersection is only available for ideals of the same ring.
</code></pre>
<p>So when I ask if </p>
<pre><code>I5 in R
</code></pre>
<p>the answer is False. I also tried with QQbar but same result, can someone explain this?
Thanks!</p>
<p>EDIT: I also tried with $\frac{\sqrt{2}}{2}$ instead of $\frac{1}{\sqrt{2}}$ and I get the same error.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46259#post-id-46259I fixed the block quoting. Not sure why you were having trouble.Thu, 18 Apr 2019 10:56:28 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46259#post-id-46259Answer by Iguananaut for <p>I am trying to compute the intersection of Ideals over $\mathbb{R}[x,y]$, but I get problems from the coefficient $\frac{1}{\sqrt{2}}$. This is my code:</p>
<pre><code>R.<x,y>=PolynomialRing(RR,order='lex')
I=Ideal([(x^2+y^2-1),(x*y),(y^3-y)])
I5=Ideal([x-1/sqrt(2),y-1/sqrt(2)])
I6=Ideal([x+1/sqrt(2),y-1/sqrt(2)])
I7=Ideal([x+1/sqrt(2),y+1/sqrt(2)])
I8=Ideal([x-1/sqrt(2),y+1/sqrt(2)])
J=I.intersection(I5,I6,I7,I8)
</code></pre>
<p>and this is the error I get:</p>
<pre><code>TypeError: Intersection is only available for ideals of the same ring.
</code></pre>
<p>So when I ask if </p>
<pre><code>I5 in R
</code></pre>
<p>the answer is False. I also tried with QQbar but same result, can someone explain this?
Thanks!</p>
<p>EDIT: I also tried with $\frac{\sqrt{2}}{2}$ instead of $\frac{1}{\sqrt{2}}$ and I get the same error.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?answer=46260#post-id-46260You can check what ring each ideal is in like `I5.ring()`. In this case I get `Symbolic Ring`. Presumably it converts to this because Sage treats `sqrt(2)` as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like `x` and `y` that are in your ring on `RR`. (In this case I feel like it *should* be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the `.ideal` method on your ring like `R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])`. This ensures that each of the generators can be converted to an element of your ring. I get:
sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
And so on.
Unfortunately when I try to take the intersection I get an exception:
TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
If I try things like:
sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
I get:
NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
which is strange because the [Singular docs](https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38) seem to say so.
I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives *an* answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:
sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
Hopefully someone with more expertise in this problem area can give a better answer.Thu, 18 Apr 2019 11:26:07 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?answer=46260#post-id-46260Comment by Iguananaut for <p>You can check what ring each ideal is in like <code>I5.ring()</code>. In this case I get <code>Symbolic Ring</code>. Presumably it converts to this because Sage treats <code>sqrt(2)</code> as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like <code>x</code> and <code>y</code> that are in your ring on <code>RR</code>. (In this case I feel like it <em>should</em> be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the <code>.ideal</code> method on your ring like <code>R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])</code>. This ensures that each of the generators can be converted to an element of your ring. I get:</p>
<pre><code>sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
</code></pre>
<p>And so on.</p>
<p>Unfortunately when I try to take the intersection I get an exception:</p>
<pre><code>TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</code></pre>
<p>If I try things like:</p>
<pre><code>sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
</code></pre>
<p>I get:</p>
<pre><code>NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
</code></pre>
<p>which is strange because the <a href="https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38">Singular docs</a> seem to say so.</p>
<p>I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives <em>an</em> answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:</p>
<pre><code>sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
</code></pre>
<p>Hopefully someone with more expertise in this problem area can give a better answer.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46318#post-id-46318What do you mean by "I tried to do the same thing using python"? Sage is just a Python library so I'd be curious what you tried and why it didn't work.Tue, 23 Apr 2019 06:29:58 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46318#post-id-46318Comment by Legh for <p>You can check what ring each ideal is in like <code>I5.ring()</code>. In this case I get <code>Symbolic Ring</code>. Presumably it converts to this because Sage treats <code>sqrt(2)</code> as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like <code>x</code> and <code>y</code> that are in your ring on <code>RR</code>. (In this case I feel like it <em>should</em> be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the <code>.ideal</code> method on your ring like <code>R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])</code>. This ensures that each of the generators can be converted to an element of your ring. I get:</p>
<pre><code>sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
</code></pre>
<p>And so on.</p>
<p>Unfortunately when I try to take the intersection I get an exception:</p>
<pre><code>TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</code></pre>
<p>If I try things like:</p>
<pre><code>sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
</code></pre>
<p>I get:</p>
<pre><code>NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
</code></pre>
<p>which is strange because the <a href="https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38">Singular docs</a> seem to say so.</p>
<p>I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives <em>an</em> answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:</p>
<pre><code>sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
</code></pre>
<p>Hopefully someone with more expertise in this problem area can give a better answer.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46279#post-id-46279Thanks, I actually finished the task I needed this for using something else, so now this just a curiosity to me. You are right $\mathbb{Q}$ extended by $\sqrt{2}$ could give a useful answer, but since this is not vital to me anymore I don't have a reason to try. I'll just leave the post here to see if someone has an answer to this problem, if possible. To be honest at this point I'm not sure anymore there is one, since this morning I tried to do the same thing using python and didn't work out. Thanks again.Fri, 19 Apr 2019 13:01:15 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46279#post-id-46279Comment by Iguananaut for <p>You can check what ring each ideal is in like <code>I5.ring()</code>. In this case I get <code>Symbolic Ring</code>. Presumably it converts to this because Sage treats <code>sqrt(2)</code> as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like <code>x</code> and <code>y</code> that are in your ring on <code>RR</code>. (In this case I feel like it <em>should</em> be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the <code>.ideal</code> method on your ring like <code>R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])</code>. This ensures that each of the generators can be converted to an element of your ring. I get:</p>
<pre><code>sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
</code></pre>
<p>And so on.</p>
<p>Unfortunately when I try to take the intersection I get an exception:</p>
<pre><code>TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</code></pre>
<p>If I try things like:</p>
<pre><code>sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
</code></pre>
<p>I get:</p>
<pre><code>NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
</code></pre>
<p>which is strange because the <a href="https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38">Singular docs</a> seem to say so.</p>
<p>I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives <em>an</em> answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:</p>
<pre><code>sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
</code></pre>
<p>Hopefully someone with more expertise in this problem area can give a better answer.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46278#post-id-46278See updated answer, in case it's of any use.Fri, 19 Apr 2019 09:56:41 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46278#post-id-46278Comment by Legh for <p>You can check what ring each ideal is in like <code>I5.ring()</code>. In this case I get <code>Symbolic Ring</code>. Presumably it converts to this because Sage treats <code>sqrt(2)</code> as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like <code>x</code> and <code>y</code> that are in your ring on <code>RR</code>. (In this case I feel like it <em>should</em> be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the <code>.ideal</code> method on your ring like <code>R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])</code>. This ensures that each of the generators can be converted to an element of your ring. I get:</p>
<pre><code>sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
</code></pre>
<p>And so on.</p>
<p>Unfortunately when I try to take the intersection I get an exception:</p>
<pre><code>TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</code></pre>
<p>If I try things like:</p>
<pre><code>sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
</code></pre>
<p>I get:</p>
<pre><code>NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
</code></pre>
<p>which is strange because the <a href="https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38">Singular docs</a> seem to say so.</p>
<p>I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives <em>an</em> answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:</p>
<pre><code>sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
</code></pre>
<p>Hopefully someone with more expertise in this problem area can give a better answer.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46272#post-id-46272No, I can't. Thanks for the concern but I'd like to solve the problem, not go around it. I'm sure there is a way to work with intersections and Groebner basis of ideals over the Real numbers fieldThu, 18 Apr 2019 13:49:10 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46272#post-id-46272Comment by John Palmieri for <p>You can check what ring each ideal is in like <code>I5.ring()</code>. In this case I get <code>Symbolic Ring</code>. Presumably it converts to this because Sage treats <code>sqrt(2)</code> as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like <code>x</code> and <code>y</code> that are in your ring on <code>RR</code>. (In this case I feel like it <em>should</em> be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the <code>.ideal</code> method on your ring like <code>R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])</code>. This ensures that each of the generators can be converted to an element of your ring. I get:</p>
<pre><code>sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
</code></pre>
<p>And so on.</p>
<p>Unfortunately when I try to take the intersection I get an exception:</p>
<pre><code>TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</code></pre>
<p>If I try things like:</p>
<pre><code>sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
</code></pre>
<p>I get:</p>
<pre><code>NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
</code></pre>
<p>which is strange because the <a href="https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38">Singular docs</a> seem to say so.</p>
<p>I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives <em>an</em> answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:</p>
<pre><code>sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
</code></pre>
<p>Hopefully someone with more expertise in this problem area can give a better answer.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46269#post-id-46269Working over the rationals (QQ) works, but of course then you don't have $\sqrt{2}$. Can you for now get away with working over QQ and replacing the last four ideals with $(x^2-1/2)$ and $(y^2-1/2)$?Thu, 18 Apr 2019 12:36:36 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46269#post-id-46269Comment by Legh for <p>You can check what ring each ideal is in like <code>I5.ring()</code>. In this case I get <code>Symbolic Ring</code>. Presumably it converts to this because Sage treats <code>sqrt(2)</code> as an exact symbolic expression and does not presume to convert it to something less precise even if you use it in an expression with variables like <code>x</code> and <code>y</code> that are in your ring on <code>RR</code>. (In this case I feel like it <em>should</em> be able to do just what you clearly mean, but I'm not expert-enough on this to know if there's really a better way to do this unambiguously). One way (of several) to fix this would be to use the <code>.ideal</code> method on your ring like <code>R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])</code>. This ensures that each of the generators can be converted to an element of your ring. I get:</p>
<pre><code>sage: I5 = R.ideal([x-1/sqrt(2),y-1/sqrt(2)])
sage: I5
Ideal (x - 0.707106781186548, y - 0.707106781186548) of Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
</code></pre>
<p>And so on.</p>
<p>Unfortunately when I try to take the intersection I get an exception:</p>
<pre><code>TypeError: Cannot call Singular function 'intersect' with ring parameter of type '<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>'
</code></pre>
<p>If I try things like:</p>
<pre><code>sage: R.<x,y>=PolynomialRing(RR,order='lex',implementation='singular')
</code></pre>
<p>I get:</p>
<pre><code>NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
</code></pre>
<p>which is strange because the <a href="https://www.singular.uni-kl.de/Manual/4-0-3/sing_28.htm#SEC38">Singular docs</a> seem to say so.</p>
<p>I'm not an algebraicist or even a mathematician at all so I'm in over my head, but maybe you can try using a number field ( $\mathbb{Q}$ extended by $\sqrt 2$)? It certainly gives <em>an</em> answer which AFAICT should be just as applicable if $ x $ and $ y $ are real. I'm just not sure if it's the one you're looking for. Perhaps it would help if you gave more details about the specific problem you're trying to solve:</p>
<pre><code>sage: F.<sqrt2> = NumberField(x^2 - 1/2)
sage: F
Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: R.<x,y> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 1/2
sage: I = R.ideal([(x^2+y^2-1),(x*y),(y^3-y)])
sage: I5 = R.ideal([x-1/sqrt2,y-1/sqrt2])
sage: I6 = R.ideal([x+1/sqrt2,y-1/sqrt2])
sage: I7 = R.ideal([x+1/sqrt2,y+1/sqrt2])
sage: I8 = R.ideal([x-1/sqrt2,y+1/sqrt2])
sage: I.intersection(I5, I6, I7, I8)
Ideal (2*y^5 - 3*y^3 + y, 2*x*y^3 - x*y, x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Number Field in sqrt2 with defining polynomial x^2 - 2
</code></pre>
<p>Hopefully someone with more expertise in this problem area can give a better answer.</p>
https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46268#post-id-46268Thanks for your answer, i see what is happening with the $\sqrt{2}$, hope someone can help me solve the intersection problem.Thu, 18 Apr 2019 12:21:51 -0500https://ask.sagemath.org/question/46258/intersection-of-polynomial-ideals-over-mathbbr/?comment=46268#post-id-46268