i have generated elliptic curve of modulus. want list few points on (doesn't matter are, need 1 or two) , hoping do:
e.points()
however due size of curve generates error:
overflowerror: range() result has many items
i attempted list first 4 calling such:
e.points()[:4]
however generated same error
is there way can make list few points? maybe sage function?
since did not include code reproduce situation, take example curve sage documentation:
sage: e = ellipticcurve(gf(101),[23,34])
generating random points
you can repeatedly use random_element
or random_point
choose points @ random:
sage: e.random_point() (99 : 92 : 1) sage: e.random_point() (27 : 80 : 1)
this simplest way obtain few arbitrary points on curve. random_element
works in many places in sage.
intersecting lines
it has defining polynomial
sage: p = e.defining_polynomial(); p -x^3 + y^2*z - 23*x*z^2 - 34*z^3
which homogeneous in x,y,z
. 1 way find some points on curve intersecting straight lines. example, intersect line y=0
, use z=1
choose representatives (thus omitting representatives @ z==0
) using
sage: p(y=0,z=1).univariate_polynomial().roots(multiplicities=false) [77]
so @ point know (77 : 0 : 1)
point on curve. can automate things, intersecting different lines until have reached desired number of points:
sage: res = [] sage: y = 0 sage: while len(res) < 4: ....: x in p(y=y,z=1).univariate_polynomial().roots(multiplicities=false): ....: res.append(e((x, y, 1))) ....: y += 1 ....: sage: res[:4] [(77 : 0 : 1), (68 : 1 : 1), (23 : 2 : 1), (91 : 4 : 1)]
adapting points()
you can have @ how points()
method implemented. type e.points??
, see uses internal method called _points_via_group_structure
. looking @ source of (using e._points_via_group_structure??
or link repo), can see how implemented, , adapt yield smaller result. in particular can see role range
plays here, , use smaller range instead.