1 | initial version |

I was thinking I should add an answer of my own since it's too long for a comment. I did some digging into the github library files and got the following comment:

```
# when gens() calls mwrank it passes the command-line
# parameter "-p 100" which helps curves with large
# coefficients and 2-torsion and is otherwise harmless.
# This is pending a more intelligent handling of mwrank
# options in gens() (which is nontrivial since gens() needs
# to parse the output from mwrank and this is seriously
# affected by what parameters the user passes!).
# In fact it would be much better to avoid the mwrank console at
# all for gens() and just use the library. This is in
# progress (see trac #1949).
```

on lines 1907-1916 of this. So in effect, there is currently no code yet for taking the generators directly from the Cremona Database.

I have very limited knowledge in programming and coding but based on my experimentation so far, this is what I got on SAGE in terms of trying to get the code from the generators in the database: D = CremonaDatabase() x = EllipticCurve(); N = x.conductor(); y = str(N); z = len(y); a = x.cremona_label()[z:]; a P = D.allgens(N)[a]; P R = P[0];

Then essentially P are the generators that we need, except that they are in the form of a nested list, ie. [[a,b,c],[d,e,f],...] as opposed to when using E.gens() and getting output as [(a : b : c),(d : e : f),...]

My workaround was to try and find some way of getting the [a,b,c] into (a/c:b/c:1) which is then suitable for computing height as well and the padic height matrix and the discriminant -> padic regulator. Unfortunately, after much trying, I realised that I can't manually input coordinates and obtain their height! This might be best put forth as another question but I'm happy to leave this here and if anybody has any ideas on how this can be done, do comment. Thanks.

2 | No.2 Revision |

I was thinking I should add an answer of my own since it's too long for a comment. I did some digging into the github library files and got the following comment:

~~ ~~# when gens() calls mwrank it passes the command-line
~~ ~~# parameter "-p 100" which helps curves with large
~~ ~~# coefficients and 2-torsion and is otherwise harmless.
~~ ~~# This is pending a more intelligent handling of mwrank
~~ ~~# options in gens() (which is nontrivial since gens() needs
~~ ~~# to parse the output from mwrank and this is seriously
~~ ~~# affected by what parameters the user passes!).
~~ ~~# In fact it would be much better to avoid the mwrank console at
~~ ~~# all for gens() and just use the library. This is in
~~ ~~# progress (see trac #1949).

on lines 1907-1916 of this. So in effect, there is currently no code yet for taking the generators directly from the Cremona Database.

I have very limited knowledge in programming and coding but based on my experimentation so far, this is what I got on SAGE in terms of trying to get the code from the generators in the ~~database:
~~database:

```
D = CremonaDatabase()
x = EllipticCurve();
N = x.conductor();
y = str(N);
z = len(y);
a = x.cremona_label()[z:]; a
P = D.allgens(N)[a]; P
R =
```~~P[0];~~P[0];

Then essentially P are the generators that we need, except that they are in the form of a nested list, ie. [[a,b,c],[d,e,f],...] as opposed to when using E.gens() and getting output as [(a : b : c),(d : e : f),...]

My workaround was to try and find some way of getting the [a,b,c] into (a/c:b/c:1) which is then suitable for computing height as well and the padic height matrix and the discriminant -> padic regulator. Unfortunately, after much trying, I realised that I can't manually input coordinates and obtain their height! This might be best put forth as another question but I'm happy to leave this here and if anybody has any ideas on how this can be done, do comment. Thanks.

3 | No.3 Revision |

I was thinking I should add an answer of my own since it's too long for a comment. I did some digging into the github library files and got the following comment:

```
# when gens() calls mwrank it passes the command-line
# parameter "-p 100" which helps curves with large
# coefficients and 2-torsion and is otherwise harmless.
# This is pending a more intelligent handling of mwrank
# options in gens() (which is nontrivial since gens() needs
# to parse the output from mwrank and this is seriously
# affected by what parameters the user passes!).
# In fact it would be much better to avoid the mwrank console at
# all for gens() and just use the library. This is in
# progress (see trac #1949).
```

on lines 1907-1916 of this. So in effect, there is currently no code yet for taking the generators directly from the Cremona Database.

I have very limited knowledge in programming and coding but based on my experimentation so far, this is what I got on SAGE in terms of trying to get the code from the generators in the database:

```
D = CremonaDatabase()
x = EllipticCurve();
N = x.conductor();
y = str(N);
z = len(y);
a = x.cremona_label()[z:]; a
P = D.allgens(N)[a]; P
```~~R = P[0];
~~R0 = P[0]; R0
# R1 = P[1]; R1
Q0 = x(R0)
# Q1 = x(R1)
h = x.padic_height(p, prec)
h(Q0)
# h(Q1)

Then essentially P are the generators that we need, except that they are in the form of a nested list, ie. [[a,b,c],[d,e,f],...] as opposed to when using E.gens() and getting output as [(a : b : c),(d : e : f),...]

~~My workaround was to try and find some way of getting the [a,b,c] into (a/c:b/c:1) which is then suitable for computing height as well and ~~With this workaround, I can now obtain padic heights -> the padic height matrix and the discriminant -> padic regulator. ~~Unfortunately, after much trying, I realised that I can't manually input coordinates and obtain their height! This might be best put forth as another question ~~Of course this hasn't been written into a proper code yet but ~~I'm happy to leave this here and if anybody has any ideas on how this can be done, do comment. Thanks.~~

4 | No.4 Revision |

```
# when gens() calls mwrank it passes the command-line
# parameter "-p 100" which helps curves with large
# coefficients and 2-torsion and is otherwise harmless.
# This is pending a more intelligent handling of mwrank
# options in gens() (which is nontrivial since gens() needs
# to parse the output from mwrank and this is seriously
# affected by what parameters the user passes!).
# In fact it would be much better to avoid the mwrank console at
# all for gens() and just use the library. This is in
# progress (see trac #1949).
```

I have very limited knowledge in programming and coding but based on my experimentation so far, this is what I got on SAGE in terms of trying to get the code from the generators in the database:

```
D = CremonaDatabase()
x = EllipticCurve();
N = x.conductor();
y = str(N);
z = len(y);
a = x.cremona_label()[z:]; a
P = D.allgens(N)[a]; P
R0 = P[0]; R0
# R1 = P[1]; R1
Q0 = x(R0)
# Q1 = x(R1)
h = x.padic_height(p, prec)
h(Q0)
# h(Q1)
```

With this workaround, I can now obtain padic heights -> the padic height matrix and the discriminant -> padic regulator. Of course this hasn't been written into a proper code yet but it is a workaround.

EDIT: I thought I gave code-writing a try. Will this work?

```
def generator_database(self, height=None, check_hypotheses=True):
INPUT:
- ``algorithm`` - # str, (default: "pari")
- ``"pari"`` - # use the PARI C-library ellglobalred
# implementation of Tate's algorithm
- ``"mwrank"`` - # use Cremona's mwrank implementation
# of Tate's algorithm; can be faster if the curve has integer
# Coefficients (TODO: limited to small conductor until mwrank gets
# integer factorization)
- ``"gp"`` - # use the GP interpreter.
- ``"generic"`` - # use the general number field
# implementation
- ``"all"`` - # use all four implementations, verify
# that the results are the same (or raise an error), and output the
# common value.
OUTPUT:
- ``generators`` - # List of generators for the
# Mordell-Weil group modulo torsion stored in Cremona Database.
if algorithm == "pari":
try:
return self.__conductor_pari
except AttributeError:
self.__conductor_pari = Integer(self.pari_mincurve().ellglobalred()[0])
return self.__conductor_pari
elif algorithm == "gp":
try:
return self.__conductor_gp
except AttributeError:
self.__conductor_gp = Integer(gp.eval('ellglobalred(ellinit(%s,0))[1]'%list(self.a_invariants())))
return self.__conductor_gp
elif algorithm == "mwrank":
try:
return self.__conductor_mwrank
except AttributeError:
if self.is_integral():
self.__conductor_mwrank = Integer(self.mwrank_curve().conductor())
else:
self.__conductor_mwrank = Integer(self.minimal_model().mwrank_curve().conductor())
return self.__conductor_mwrank
elif algorithm == "generic":
try:
return self.__conductor_generic
except AttributeError:
self.__conductor_generic = sage.schemes.elliptic_curves.ell_number_field.EllipticCurve_number_field.conductor(self).gen()
return self.__conductor_generic
elif algorithm == "all":
N1 = self.conductor("pari")
N2 = self.conductor("mwrank")
N3 = self.conductor("gp")
N4 = self.conductor("generic")
if N1 != N2 or N2 != N3 or N2 != N4:
raise ArithmeticError, "PARI, mwrank, gp and Sage compute different conductors (%s,%s,%s,%3) for %s"%(N1, N2, N3, N4, self)
return N1
else:
raise RuntimeError, "algorithm '%s' is not known."%algorithm
rank = self.rank()
N = self.conductor()
y = str(N)
z = len(y)
a = self.cremona_label()[z:]
P = D.allgens(N)[a];
generators = []
for i in range(0,rank):
Ri = x(P[i]); Ri
generators = generators + [x(P[i])]
print generators
```

5 | No.5 Revision |

```
# when gens() calls mwrank it passes the command-line
# parameter "-p 100" which helps curves with large
# coefficients and 2-torsion and is otherwise harmless.
# This is pending a more intelligent handling of mwrank
# options in gens() (which is nontrivial since gens() needs
# to parse the output from mwrank and this is seriously
# affected by what parameters the user passes!).
# In fact it would be much better to avoid the mwrank console at
# all for gens() and just use the library. This is in
# progress (see trac #1949).
```

I have very limited knowledge in programming and coding but based on my experimentation so far, this is what I got on SAGE in terms of trying to get the code from the generators in the database:

```
D = CremonaDatabase()
x = EllipticCurve();
N = x.conductor();
y = str(N);
z = len(y);
a = x.cremona_label()[z:]; a
P = D.allgens(N)[a]; P
R0 = P[0]; R0
# R1 = P[1]; R1
Q0 = x(R0)
# Q1 = x(R1)
h = x.padic_height(p, prec)
h(Q0)
# h(Q1)
```

With this workaround, I can now obtain padic heights -> the padic height matrix and the discriminant -> padic regulator. Of course this hasn't been written into a proper code yet but it is a workaround.

EDIT: I thought I gave code-writing a try. Will this work?

```
def generator_database(self, height=None, check_hypotheses=True):
INPUT:
- ``algorithm`` - # str, (default: "pari")
- ``"pari"`` - # use the PARI C-library ellglobalred
# implementation of Tate's algorithm
- ``"mwrank"`` - # use Cremona's mwrank implementation
# of Tate's algorithm; can be faster if the curve has integer
# Coefficients (TODO: limited to small conductor until mwrank gets
# integer factorization)
- ``"gp"`` - # use the GP interpreter.
- ``"generic"`` - # use the general number field
# implementation
- ``"all"`` - # use all four implementations, verify
# that the results are the same (or raise an error), and output the
# common value.
OUTPUT:
- ``generators`` - # List of generators for the
# Mordell-Weil group modulo torsion stored in Cremona Database.
if algorithm == "pari":
try:
return self.__conductor_pari
except AttributeError:
self.__conductor_pari = Integer(self.pari_mincurve().ellglobalred()[0])
return self.__conductor_pari
elif algorithm == "gp":
try:
return self.__conductor_gp
except AttributeError:
self.__conductor_gp = Integer(gp.eval('ellglobalred(ellinit(%s,0))[1]'%list(self.a_invariants())))
return self.__conductor_gp
elif algorithm == "mwrank":
try:
return self.__conductor_mwrank
except AttributeError:
if self.is_integral():
self.__conductor_mwrank = Integer(self.mwrank_curve().conductor())
else:
self.__conductor_mwrank = Integer(self.minimal_model().mwrank_curve().conductor())
return self.__conductor_mwrank
elif algorithm == "generic":
try:
return self.__conductor_generic
except AttributeError:
self.__conductor_generic = sage.schemes.elliptic_curves.ell_number_field.EllipticCurve_number_field.conductor(self).gen()
return self.__conductor_generic
elif algorithm == "all":
N1 = self.conductor("pari")
N2 = self.conductor("mwrank")
N3 = self.conductor("gp")
N4 = self.conductor("generic")
if N1 != N2 or N2 != N3 or N2 != N4:
raise ArithmeticError, "PARI, mwrank, gp and Sage compute different conductors (%s,%s,%s,%3) for %s"%(N1, N2, N3, N4, self)
return N1
else:
raise RuntimeError, "algorithm '%s' is not known."%algorithm
rank = self.rank()
N = self.conductor()
y = str(N)
z = len(y)
a = self.cremona_label()[z:]
P = D.allgens(N)[a];
generators = []
for i in range(0,rank):
Ri = x(P[i]); Ri
generators = generators + [x(P[i])]
print generators
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.