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, 09 Aug 2019 15:08:57 +0200Define the affine variety $X = V (y − x^2, y − x + 1)$.https://ask.sagemath.org/question/47429/define-the-affine-variety-x-v-y-x2-y-x-1/Define the affine variety
(a) $X = V (y − x^2, y − x + 1)$.
(b) Find all the rational points on X.
What I got in the examples is that we can use the code
sage: x,y,z = PolynomialRing(GF(5), 3, 'xyz').gens()
sage: C = Curve(y^2*z^7 - x^9 - x*z^8); C
sage: C.rational_points()
To get rational points over Finite Field of size 5. To calculate over rational we can replace $GF(5)$ by QQ but to get a finite result we have to have the intersection.
Later I also used:
sage: R.<x,y> = PolynomialRing(QQ)
sage: R
sage: I = R.ideal(y-x^2,y-x+1)
sage: I.variety()
But didn't get my result.Thu, 08 Aug 2019 01:14:35 +0200https://ask.sagemath.org/question/47429/define-the-affine-variety-x-v-y-x2-y-x-1/Comment by ortollj for <p>Define the affine variety
(a) $X = V (y − x^2, y − x + 1)$.
(b) Find all the rational points on X.</p>
<p>What I got in the examples is that we can use the code</p>
<p>sage: x,y,z = PolynomialRing(GF(5), 3, 'xyz').gens()</p>
<p>sage: C = Curve(y^2<em>z^7 - x^9 - x</em>z^8); C</p>
<p>sage: C.rational_points()</p>
<p>To get rational points over Finite Field of size 5. To calculate over rational we can replace $GF(5)$ by QQ but to get a finite result we have to have the intersection.</p>
<p>Later I also used:</p>
<p>sage: R.<x,y> = PolynomialRing(QQ)</p>
<p>sage: R</p>
<p>sage: I = R.ideal(y-x^2,y-x+1)</p>
<p>sage: I.variety()</p>
<p>But didn't get my result.</p>
https://ask.sagemath.org/question/47429/define-the-affine-variety-x-v-y-x2-y-x-1/?comment=47446#post-id-47446I do not have sufficient knowledge, to answer this question, I will delete my answer .
as I deleted my answer (it has also deleted your comment) you'll have to re-ask your question about:
R.<x,y> = PolynomialRing(QQ)
show(R)
I = R.ideal(y-x^2,y-x+1)
show(I.variety())
Sorry Arnab.Fri, 09 Aug 2019 09:13:38 +0200https://ask.sagemath.org/question/47429/define-the-affine-variety-x-v-y-x2-y-x-1/?comment=47446#post-id-47446Answer by rburing for <p>Define the affine variety
(a) $X = V (y − x^2, y − x + 1)$.
(b) Find all the rational points on X.</p>
<p>What I got in the examples is that we can use the code</p>
<p>sage: x,y,z = PolynomialRing(GF(5), 3, 'xyz').gens()</p>
<p>sage: C = Curve(y^2<em>z^7 - x^9 - x</em>z^8); C</p>
<p>sage: C.rational_points()</p>
<p>To get rational points over Finite Field of size 5. To calculate over rational we can replace $GF(5)$ by QQ but to get a finite result we have to have the intersection.</p>
<p>Later I also used:</p>
<p>sage: R.<x,y> = PolynomialRing(QQ)</p>
<p>sage: R</p>
<p>sage: I = R.ideal(y-x^2,y-x+1)</p>
<p>sage: I.variety()</p>
<p>But didn't get my result.</p>
https://ask.sagemath.org/question/47429/define-the-affine-variety-x-v-y-x2-y-x-1/?answer=47450#post-id-47450The first example you cite is about points on a curve. Your variety is the intersection of two curves ($y = x^2$ and $y = x - 1$), which is a finite set of points (and not a curve), so you cannot use the same technique.
I assume by "affine variety" you mean affine variety defined over $\mathbb{Q}$, and by "rational points" you mean points defined over $\mathbb{Q}$. In that case, what you did later is correct:
sage: R.<x,y> = PolynomialRing(QQ)
sage: I = R.ideal(y-x^2,y-x+1)
sage: I.variety()
[]
This tells you that the set of points in the variety *which are defined over $\mathbb{Q}$* (i.e. which have coordinates in $\mathbb{Q}$) is empty. You can also try to find (numerically) points defined over $\mathbb{R}$:
sage: I.variety(RR)
[]
Again it is an empty set, because the two curves don't intersect when drawn in $\mathbb{R}^2$. You can try to find (numerically) points defined over $\mathbb{C}$:
sage: I.variety(CC)
[{y: -0.500000000000000 - 0.866025403784439*I, x: 0.500000000000000 - 0.866025403784439*I},
{y: -0.500000000000000 + 0.866025403784439*I, x: 0.500000000000000 + 0.866025403784439*I}]
Here we find two points in $\mathbb{C}^2$. If you are looking for exact answers, you can also try to find points defined over $\bar{\mathbb{Q}}$ (the algebraic closure of $\mathbb{Q}$):
sage: I.variety(QQbar)
[{y: -0.50000000000000000? - 0.866025403784439?*I, x: 0.50000000000000000? - 0.866025403784439?*I},
{y: -0.50000000000000000? + 0.866025403784439?*I, x: 0.50000000000000000? + 0.866025403784439?*I}]
The result looks numerical, but Sage knows exactly what these points are, and you can do exact arithmetic with them. In this case you can also express them as radicals:
sage: [(P[x].radical_expression(), P[y].radical_expression()) for P in I.variety(QQbar)]
[(-1/2*I*sqrt(3) + 1/2, -1/2*I*sqrt(3) - 1/2),
(1/2*I*sqrt(3) + 1/2, 1/2*I*sqrt(3) - 1/2)]
This is similar to what you would get if you asked Sage to solve the equations symbolically:
sage: solve(map(SR, I.gens()), map(SR, R.gens()))
[[x == -1/2*I*sqrt(3) + 1/2, y == -1/2*I*sqrt(3) - 1/2], [x == 1/2*I*sqrt(3) + 1/2, y == 1/2*I*sqrt(3) - 1/2]]Fri, 09 Aug 2019 15:08:57 +0200https://ask.sagemath.org/question/47429/define-the-affine-variety-x-v-y-x2-y-x-1/?answer=47450#post-id-47450