Revision history [back]

The question amount to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
if not is_square(b):
return None
return sqrt(b)-c

E = EllipticCurve(GF(43),[2,8]);
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

The question amount to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if not is_square(b):
r[0]:
return r[1]-c
else:
return None
return sqrt(b)-c

E = EllipticCurve(GF(43),[2,8]);
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

The question amount to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if r[0]:
return r[1]-c
else:
return None

E = EllipticCurve(GF(43),[2,8]);
EllipticCurve(GF(43),[2,8])
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

The question amount amounts to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if r[0]:
return r[1]-c
else:
return None

E = EllipticCurve(GF(43),[2,8])
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

The question amounts to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if r[0]:
return r[1]-c
else:
return None

E = EllipticCurve(GF(43),[2,8])
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

P.S. The code above does not work if 2 is not invertible in the in the base ring (e.g., if it's a filed of characteristic 2) since it involves division by 2. Although, when a[0]=a[2]=0, we can avoid division and simply set c=0.

The question amounts to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if r[0]:
return r[1]-c
else:
return None

E = EllipticCurve(GF(43),[2,8])
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

P.S. The code above does not work if 2 is not invertible in the in the base ring (e.g., if it's a filed of characteristic 2) since it involves division by 2. Although, when a[0]=a[2]=0, we can avoid division and simply set c=0.

The question amounts to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R = E.base_ring()
x = R(x)
a = E.a_invariants()
c = (a[0]*x + a[2])/2
b = x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if r[0]:
return r[1]-c
else:
return None

E = EllipticCurve(GF(43),[2,8])
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. It is easy to verify that $21^2 = 1^3 + 2\cdot 1 + 8$ in GF(43).

P.S. The code above does not work if 2 is not invertible in the base ring (e.g., if it's a filed field of characteristic 2) since it involves division by 2. Although, when a[0]=a[2]=0, we can avoid division and simply set c=0.

The question amounts to substituting given $x$ in the elliptic curve equation, and solving the resulting quadratic equation for $y$. Here is a sample code:

def compute_y(E,x):
R R.<y> = E.base_ring()
x = R(x)
PolynomialRing(E.base_ring())
a = E.a_invariants()
c L = (y^2 + (a[0]*x + a[2])/2
b = x^3 a[2])*y - (x^3 + a[1]*x^2 + a[3]*x + a[4] + c^2
r = is_square(b,True)
if r[0]:
a[4])).roots()
return r[1]-c
else:
return None
{l[0] for l in L}

E = EllipticCurve(GF(43),[2,8])
print( compute_y(E,1) )


For a given curve and $x=1$, it computes $y=21$. that $y\in \{21,22\}$. It is easy to verify that $21^2 = 22^2 = 1^3 + 2\cdot 1 + 8$ and in GF(43).

P.S. The code above does not work if 2 is not invertible in the base ring (e.g., if it's a field of characteristic 2) since it involves division by 2. Although, when a[0]=a[2]=0, we can avoid division and simply set c=0.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://ask.sagemath.org/answers/56091/revisions/", "fetch_time": 1620361979000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2021-21/segments/1620243988774.96/warc/CC-MAIN-20210507025943-20210507055943-00601.warc.gz", "warc_record_offset": 105774620, "warc_record_length": 6547, "token_count": 1937, "char_count": 5315, "score": 3.5625, "int_score": 4, "crawl": "CC-MAIN-2021-21", "snapshot_type": "latest", "language": "en", "language_score": 0.6175395846366882, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00002-of-00064.parquet"}