Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You 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 seem to say so.

Hopefully someone with more expertise in this problem area can give a better answer.

You 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 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, 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.

You 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 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, 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.