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.Sat, 05 Nov 2016 12:55:55 +0100y-coordinate of a 4-torsion pointhttps://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/I want to find the `y`-coordinate of a 4-torsion point. I have the following code where I found the x-coordinate
E3=EllipticCurve([0,0,0,-3267,45630])
E=E3.division_polynomial(4);E
E.factor()
which gives
8*(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)*(x^2 + 15*x - 3042)*(x^2 - 30*x + 2817)*(x - 15)
Then I factor $x^2 - 30x + 2817$ in $\mathbb{Q}(\sqrt{-2})$ and I got $[(-36\sqrt{-2} + 15, 1), (36\sqrt{-2} + 15, 1)]$ which is my x-coordinate. How to get the y-coordinate? If I denote $\sqrt{-2}=B$, then I have $x=15\pm 36B$. And I substitute it into my elliptic curve gives
B = var('B')
y2=x^3-3267*x+45630;y2
y=y2.subs({x:15+36*B});y
Y=y.simplify_full();Y
YY=Y.subs({B^2:-2});YY
YYY=YY.subs({B^3:-2*B});YYY
which equals to $y^2=186624B-116640$. How to get the y-coordinate. By trying an error multiple times (using PARI-gp) I manage to get y-coordinate as $y=27a^3-135a-108aB$ with $a^4-5a^2-32=0$ and $B^2=-2$. But i got this by trying an error comparing LHs and RHS equation. Not straight away from $y^2=186624B-116640$. I tried the following but it did not work :
K.<a> = NumberField(x^4 -5*x^2-32); K
f = K.factor(186624*B-116640); fFri, 04 Nov 2016 03:01:35 +0100https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/Comment by slelievre for <p>I want to find the <code>y</code>-coordinate of a 4-torsion point. I have the following code where I found the x-coordinate</p>
<pre><code>E3=EllipticCurve([0,0,0,-3267,45630])
E=E3.division_polynomial(4);E
E.factor()
</code></pre>
<p>which gives</p>
<pre><code>8*(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)*(x^2 + 15*x - 3042)*(x^2 - 30*x + 2817)*(x - 15)
</code></pre>
<p>Then I factor $x^2 - 30x + 2817$ in $\mathbb{Q}(\sqrt{-2})$ and I got $[(-36\sqrt{-2} + 15, 1), (36\sqrt{-2} + 15, 1)]$ which is my x-coordinate. How to get the y-coordinate? If I denote $\sqrt{-2}=B$, then I have $x=15\pm 36B$. And I substitute it into my elliptic curve gives</p>
<pre><code>B = var('B')
y2=x^3-3267*x+45630;y2
y=y2.subs({x:15+36*B});y
Y=y.simplify_full();Y
YY=Y.subs({B^2:-2});YY
YYY=YY.subs({B^3:-2*B});YYY
</code></pre>
<p>which equals to $y^2=186624B-116640$. How to get the y-coordinate. By trying an error multiple times (using PARI-gp) I manage to get y-coordinate as $y=27a^3-135a-108aB$ with $a^4-5a^2-32=0$ and $B^2=-2$. But i got this by trying an error comparing LHs and RHS equation. Not straight away from $y^2=186624B-116640$. I tried the following but it did not work :</p>
<pre><code>K.<a> = NumberField(x^4 -5*x^2-32); K
f = K.factor(186624*B-116640); f
</code></pre>
https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?comment=35415#post-id-35415Can you edit your question and add the code for each step? For instance, when you write
> And I substitute it into my elliptic curve gives me `y^2 = 186624* B − 116640`.
What code do you use to get that?
Also, make sure someone can replicate the code in your question in a fresh Sage session.
For instance, your last line involves `B`, but you didn't provide code that defines it.Fri, 04 Nov 2016 09:19:17 +0100https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?comment=35415#post-id-35415Comment by Sha for <p>I want to find the <code>y</code>-coordinate of a 4-torsion point. I have the following code where I found the x-coordinate</p>
<pre><code>E3=EllipticCurve([0,0,0,-3267,45630])
E=E3.division_polynomial(4);E
E.factor()
</code></pre>
<p>which gives</p>
<pre><code>8*(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)*(x^2 + 15*x - 3042)*(x^2 - 30*x + 2817)*(x - 15)
</code></pre>
<p>Then I factor $x^2 - 30x + 2817$ in $\mathbb{Q}(\sqrt{-2})$ and I got $[(-36\sqrt{-2} + 15, 1), (36\sqrt{-2} + 15, 1)]$ which is my x-coordinate. How to get the y-coordinate? If I denote $\sqrt{-2}=B$, then I have $x=15\pm 36B$. And I substitute it into my elliptic curve gives</p>
<pre><code>B = var('B')
y2=x^3-3267*x+45630;y2
y=y2.subs({x:15+36*B});y
Y=y.simplify_full();Y
YY=Y.subs({B^2:-2});YY
YYY=YY.subs({B^3:-2*B});YYY
</code></pre>
<p>which equals to $y^2=186624B-116640$. How to get the y-coordinate. By trying an error multiple times (using PARI-gp) I manage to get y-coordinate as $y=27a^3-135a-108aB$ with $a^4-5a^2-32=0$ and $B^2=-2$. But i got this by trying an error comparing LHs and RHS equation. Not straight away from $y^2=186624B-116640$. I tried the following but it did not work :</p>
<pre><code>K.<a> = NumberField(x^4 -5*x^2-32); K
f = K.factor(186624*B-116640); f
</code></pre>
https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?comment=35418#post-id-35418@slelievre Sorry I will edit this. Thank you.Fri, 04 Nov 2016 11:44:16 +0100https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?comment=35418#post-id-35418Answer by slelievre for <p>I want to find the <code>y</code>-coordinate of a 4-torsion point. I have the following code where I found the x-coordinate</p>
<pre><code>E3=EllipticCurve([0,0,0,-3267,45630])
E=E3.division_polynomial(4);E
E.factor()
</code></pre>
<p>which gives</p>
<pre><code>8*(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)*(x^2 + 15*x - 3042)*(x^2 - 30*x + 2817)*(x - 15)
</code></pre>
<p>Then I factor $x^2 - 30x + 2817$ in $\mathbb{Q}(\sqrt{-2})$ and I got $[(-36\sqrt{-2} + 15, 1), (36\sqrt{-2} + 15, 1)]$ which is my x-coordinate. How to get the y-coordinate? If I denote $\sqrt{-2}=B$, then I have $x=15\pm 36B$. And I substitute it into my elliptic curve gives</p>
<pre><code>B = var('B')
y2=x^3-3267*x+45630;y2
y=y2.subs({x:15+36*B});y
Y=y.simplify_full();Y
YY=Y.subs({B^2:-2});YY
YYY=YY.subs({B^3:-2*B});YYY
</code></pre>
<p>which equals to $y^2=186624B-116640$. How to get the y-coordinate. By trying an error multiple times (using PARI-gp) I manage to get y-coordinate as $y=27a^3-135a-108aB$ with $a^4-5a^2-32=0$ and $B^2=-2$. But i got this by trying an error comparing LHs and RHS equation. Not straight away from $y^2=186624B-116640$. I tried the following but it did not work :</p>
<pre><code>K.<a> = NumberField(x^4 -5*x^2-32); K
f = K.factor(186624*B-116640); f
</code></pre>
https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?answer=35426#post-id-35426I would recommend to avoid Sage's symbolic ring for such computations.
The best here is to use algebraic numbers, which form the ring QQbar,
and to work with polynomials over that ring.
For reference here is the Sage version I am working with.
sage: version()
'SageMath version 7.3, Release Date: 2016-08-04'
This is one way you could work.
sage: E3 = EllipticCurve([0, 0, 0, -3267, 45630])
sage: E = E3.division_polynomial(4); E
8*x^9 - 156816*x^7 + 7665840*x^6 - 25044299280*x^4 + 1873623790224*x^3 - 35065596749040*x^2 - 258340569679368*x + 6648422400893520
sage: E.parent()
Univariate Polynomial Ring in x over Rational Field
Here is how this polynomial factors over QQ:
sage: E.factor()
(8) * (x - 15) * (x^2 - 30*x + 2817) * (x^2 + 15*x - 3042) * (x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)
The list of factors over QQ:
sage: list(E.factor())
[(x - 15, 1),
(x^2 - 30*x + 2817, 1),
(x^2 + 15*x - 3042, 1),
(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339, 1)]
Let us select one factor:
sage: p = E.factor()[1][0]; p
x^2 - 30*x + 2817
sage: p.parent()
Univariate Polynomial Ring in x over Rational Field
This factor lives in QQ[x]. Let us change to QQbar[x].
sage: P.<x> = QQbar[]
sage: p = P(p); p
x^2 - 30*x + 2817
sage: p.parent()
Univariate Polynomial Ring in x over Algebraic Field
Now this polynomial factors completely, and has two roots of multiplicity one.
sage: p.factor()
(x - 15.00000000000000? - 50.91168824543143?*I) * (x - 15.00000000000000? + 50.91168824543143?*I)
sage: p.roots()
[(15.00000000000000? - 50.91168824543143?*I, 1),
(15.00000000000000? + 50.91168824543143?*I, 1)]
Forgetting about multiplicities:
sage: roots = p.roots(multiplicities=False); roots
[15.00000000000000? - 50.91168824543143?*I,
15.00000000000000? + 50.91168824543143?*I]
Let us enter by hand the polynomial associated with E3.
sage: q = x^3 - 3267*x + 45630; q
x^3 - 3267*x + 45630
sage: q.parent()
Univariate Polynomial Ring in x over Algebraic Field
[Exercise: try to get hold of this polynomials starting from E3 instead of entering it by hand.]
Now for each root r of p, the corresponding y-value on E3 is sqrt(q(r)).
sage: for (x, y) in [(r, sqrt(q(r))) for r in roots]:
....: print 'xr = {} = {}'.format(x, x.radical_expression())
....: print 'yr = {} = {}\n'.format(y, y.radical_expression())
....:
xr = 15.00000000000000? - 50.91168824543143?*I = -36*I*sqrt(2) + 15
yr = 293.1820459230292? + 450.1063341607327?*I = 27*sqrt(256*I*sqrt(2) - 160)
xr = 15.00000000000000? + 50.91168824543143?*I = 36*I*sqrt(2) + 15
yr = 293.1820459230292? - 450.1063341607327?*I = 27*sqrt(-256*I*sqrt(2) - 160)
These are algebraic numbers and maybe their minimal polynomial is useful.
sage: for (x, y) in [(r, sqrt(q(r))) for r in roots]:
....: print 'xr has minpoly {}'.format(x.minpoly())
....: print 'yr has minpoly {}\n'.format(y.minpoly())
....:
xr has minpoly x^2 - 30*x + 2817
yr has minpoly x^4 + 233280*x^2 + 83261924352
xr has minpoly x^2 - 30*x + 2817
yr has minpoly x^4 + 233280*x^2 + 83261924352
Proably you want to play this game with all roots of E, not just of p.Fri, 04 Nov 2016 15:57:06 +0100https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?answer=35426#post-id-35426Comment by Sha for <div class="snippet"><p>I would recommend to avoid Sage's symbolic ring for such computations.</p>
<p>The best here is to use algebraic numbers, which form the ring QQbar,
and to work with polynomials over that ring.</p>
<p>For reference here is the Sage version I am working with.</p>
<pre><code>sage: version()
'SageMath version 7.3, Release Date: 2016-08-04'
</code></pre>
<p>This is one way you could work.</p>
<pre><code>sage: E3 = EllipticCurve([0, 0, 0, -3267, 45630])
sage: E = E3.division_polynomial(4); E
8*x^9 - 156816*x^7 + 7665840*x^6 - 25044299280*x^4 + 1873623790224*x^3 - 35065596749040*x^2 - 258340569679368*x + 6648422400893520
sage: E.parent()
Univariate Polynomial Ring in x over Rational Field
</code></pre>
<p>Here is how this polynomial factors over QQ:</p>
<pre><code>sage: E.factor()
(8) * (x - 15) * (x^2 - 30*x + 2817) * (x^2 + 15*x - 3042) * (x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339)
</code></pre>
<p>The list of factors over QQ:</p>
<pre><code>sage: list(E.factor())
[(x - 15, 1),
(x^2 - 30*x + 2817, 1),
(x^2 + 15*x - 3042, 1),
(x^4 + 30*x^3 - 18252*x^2 + 280530*x + 6465339, 1)]
</code></pre>
<p>Let us select one factor:</p>
<pre><code>sage: p = E.factor()[1][0]; p
x^2 - 30*x + 2817
sage: p.parent()
Univariate Polynomial Ring in x over Rational Field
</code></pre>
<p>This factor lives in QQ[x]. Let us change to QQbar[x].</p>
<pre><code>sage: P.<x> = QQbar[]
sage: p = P(p); p
x^2 - 30*x + 2817
sage: p.parent()
Univariate Polynomial Ring in x over Algebraic Field
</code></pre>
<p>Now this polynomial factors completely, and has two roots of multiplicity one.</p>
<pre><code>sage: p.factor()
(x - 15.00000000000000? - 50.91168824543143?*I) * (x - 15.00000000000000? + 50.91168824543143?*I)
sage: p.roots()
[(15.00000000000000? - 50.91168824543143?*I, 1),
(15.00000000000000? + 50.91168824543143?*I, 1)]
</code></pre>
<p>Forgetting about multiplicities:</p>
<pre><code>sage: roots = p.roots(multiplicities=False); roots
[15.00000000000000? - 50.91168824543143?*I,
15.00000000000000? + 50.91168824543143?*I]
</code></pre>
<p>Let us enter by hand the polynomial associated with E3.</p>
<pre><code>sage: q = x^3 - 3267*x + 45630; q
x^3 - 3267*x + 45630
sage: q.parent()
Univariate Polynomial Ring in x over Algebraic Field
</code></pre>
<p>[Exercise: try to get hold of this polynomials starting from E3 instead of entering it by hand.]</p>
<p>Now for each root r of p, the corresponding y-value on E3 is sqrt(q(r)).</p>
<pre><code>sage: for (x, y) in [(r, sqrt(q(r))) for r in roots]:
....: print 'xr = {} = {}'.format(x, x.radical_expression())
....: print 'yr = {} = {}\n'.format(y, y.radical_expression())
....:
xr = 15.00000000000000? - 50.91168824543143?*I = -36*I*sqrt(2) + 15
yr = 293.1820459230292? + 450.1063341607327?*I = 27*sqrt(256*I*sqrt(2) - 160)
xr = 15.00000000000000? + 50.91168824543143?*I = 36*I*sqrt(2) + 15
yr = 293.1820459230292? - 450.1063341607327?*I = 27*sqrt(-256*I*sqrt(2) - 160)
</code></pre>
<p>These are algebraic numbers and maybe their minimal polynomial is useful.</p>
<pre><code>sage: for (x, y) in [(r, sqrt(q(r))) for r in roots]:
....: print 'xr has minpoly {}'.format(x.minpoly())
....: print 'yr has minpoly {}\n'.format(y.minpoly())
....:
xr has minpoly x^2 - 30*x + 2817
yr has minpoly x^4 + 233280*x ...</code></pre><span class="expander"> <a>(more)</a></span></div>https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?comment=35454#post-id-35454Thank you so much Sir for your answer. This is perfect way for me to play around with the code to get what I am looking for as it is so detailed. Thank you again!Sat, 05 Nov 2016 12:55:55 +0100https://ask.sagemath.org/question/35410/y-coordinate-of-a-4-torsion-point/?comment=35454#post-id-35454