Sage: Ticket #8251: bad interaction between unique? RationalField() and (pickled) Jones databse
https://trac.sagemath.org/ticket/8251
<p>
It's possible to get a traceback for some dumb reason in some cases when computing the torsion subgroup of an elliptic curve:
</p>
<pre class="wiki">...
Traceback (most recent call last): for K in J.unramified_outside([i],3):
File "", line 1, in <module>
File "/tmp/tmpSAW9n5/___code___.py", line 6, in <module>
T=E.torsion_subgroup()
File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py", line 3515, in torsion_subgroup
self.__torsion_subgroup = ell_torsion.EllipticCurveTorsionSubgroup(self, algorithm)
File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_torsion.py", line 159, in __init__
if self.__K is RationalField() and algorithm in pari_torsion_algorithms:
File "/usr/local/sage2/local/lib/python2.6/site-packages/sage/rings/rational_field.py", line 208, in __init__
self._assign_names(('x',),normalize=False) # ???
File "parent_gens.pyx", line 327, in sage.structure.parent_gens.ParentWithGens._assign_names (sage/structure/parent_gens.c:2854)
File "category_object.pyx", line 336, in sage.structure.category_object.CategoryObject._assign_names (sage/structure/category_object.c:3286)
ValueError: variable names cannot be changed after object creation.
</pre><p>
The above is caused by running this script:
</p>
<pre class="wiki">J=JonesDatabase()
P=Primes()
for E in cremona_optimal_curves([0..50]):
T=E.torsion_subgroup()
i=E.conductor()
if i.is_prime():
for K in J.unramified_outside([i],3):
F=E.base_extend(K)
T_1=F.torsion_subgroup()
if T != T_1:
E.label();
K.is_galois();
T;
T_1;
else:
j=2
while j < i :
if j.is_prime():
n=i/j
if n.is_integral():
for K in J.unramified_outside([j],3):
F=E.base_extend(K)
T_1=F.torsion_subgroup()
if T != T_1:
E.label();
K.is_galois();
T;
T_1;
j=P.next(j)
</pre>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/8251
Trac 1.1.6cremonaSat, 13 Feb 2010 18:07:32 GMT
https://trac.sagemath.org/ticket/8251#comment:1
https://trac.sagemath.org/ticket/8251#comment:1
<p>
This may be related to <a class="closed ticket" href="https://trac.sagemath.org/ticket/7930" title="defect: strange bug for elliptic curves over number fields (closed: fixed)">#7930</a>. In both cases, a sequence of elliptic curves and number fields and reduction mod primes is carried out, and something is getting confused about all the finite fields which getting created.
</p>
<p>
It would be a great help if we could simplify the script which causes this. There's an outer look through curves and an inner loop through certain fields, depending on the curve, and then the torsion of the curve over that field is computed. I'll try to do that.
</p>
TicketcremonaFri, 25 Jun 2010 07:38:42 GMTcc set
https://trac.sagemath.org/ticket/8251#comment:2
https://trac.sagemath.org/ticket/8251#comment:2
<ul>
<li><strong>cc</strong>
<em>robertwb</em> <em>was</em> added
</li>
</ul>
<p>
This error has (a) nothing to do with elliptic curve code and (b) nothing to do with number fields at all!
</p>
<p>
It is arising because in several places in Sage source code the field of rational numbers is referred to as <code>RationalField()</code> instead of as QQ. This should not matter, since the <code>RationalField()</code> call is supposed to return the unique object of its class, which is pre-assigned to QQ, but apparently sometimes it does go through the process of running the code in <code>RationalField.__init__()</code>. That code contains the mysterious line
</p>
<pre class="wiki"> self._assign_names(('x',),normalize=False) # ???
</pre><p>
-- note that some one (not me) has added those ??? -- I cannot see any reason for assigning any "names" to QQ. It is this call to the _assign_names() function which sometimes raises the error. I do not know why it only happens sometimes.
</p>
<p>
It might therefore be a good idea to change the title of this ticket. I will ask other people for their opinion. Robert? (You added the ???) William? (You added the assign_names line!)
</p>
<p>
I would like to try commenting out that line and testing the entire Sage library.
</p>
TicketrobertwbFri, 25 Jun 2010 20:49:54 GMT
https://trac.sagemath.org/ticket/8251#comment:3
https://trac.sagemath.org/ticket/8251#comment:3
<p>
Easier to reproduce.
</p>
<pre class="wiki">sage: RationalField()
Rational Field
sage: list(JonesDatabase().unramified_outside([3], 3))
[Number Field in a with defining polynomial x^3 - 3*x + 1, Number Field in a with defining polynomial x^3 - 3]
sage: RationalField()
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (436, 0))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/sekhon/<ipython console> in <module>()
/Applications/sage/local/lib/python2.6/site-packages/sage/rings/rational_field.pyc in __init__(self)
212 print id(self)
213 ParentWithGens.__init__(self, self, category = Fields())
--> 214 self._assign_names(('x',),normalize=False) # ???
215 self._populate_coercion_lists_(element_constructor=rational.Rational, init_no_parent=True)
216
/Applications/sage/local/lib/python2.6/site-packages/sage/structure/parent_gens.so in sage.structure.parent_gens.ParentWithGens._assign_names (sage/structure/parent_gens.c:2869)()
/Applications/sage/local/lib/python2.6/site-packages/sage/structure/category_object.so in sage.structure.category_object.CategoryObject._assign_names (sage/structure/category_object.c:3287)()
ValueError: variable names cannot be changed after object creation.
</pre>
TicketrobertwbFri, 25 Jun 2010 21:01:59 GMTowner, component, summary changed
https://trac.sagemath.org/ticket/8251#comment:4
https://trac.sagemath.org/ticket/8251#comment:4
<ul>
<li><strong>owner</strong>
changed from <em>cremona</em> to <em>nthiery</em>
</li>
<li><strong>component</strong>
changed from <em>elliptic curves</em> to <em>categories</em>
</li>
<li><strong>summary</strong>
changed from <em>traceback when computing E.torsion_subgroup() for an elliptic curve E</em> to <em>bad interaction between unique? RationalField() and (pickled) Jones databse</em>
</li>
</ul>
TicketwjpSat, 08 Jan 2011 21:51:23 GMT
https://trac.sagemath.org/ticket/8251#comment:5
https://trac.sagemath.org/ticket/8251#comment:5
<p>
Even easier to reproduce:
</p>
<pre class="wiki">RationalField()
x = load(SAGE_ROOT + "/data/jones/jones.sobj")
RationalField()
</pre>
TicketwjpSat, 08 Jan 2011 21:58:21 GMT
https://trac.sagemath.org/ticket/8251#comment:6
https://trac.sagemath.org/ticket/8251#comment:6
<p>
As far as I can tell, <code>jones.sobj</code> contains a <code>RationalField</code> with <code>_names</code> equal to <code>'x'</code>, while in current versions of sage, <code>QQ._names</code> equals <code>('x',)</code>.
</p>
TicketwjpSun, 09 Jan 2011 06:34:47 GMT
https://trac.sagemath.org/ticket/8251#comment:7
https://trac.sagemath.org/ticket/8251#comment:7
<p>
As suggested by William, I've converted the pickle <code>data/jones/jones.sobj</code> to be less dependent on the version of Sage by storing the polynomials as lists of python ints rather than as actual polynomials. This solves the problem encountered in this ticket, and also prevents similar things in the future.
</p>
<p>
I'll try to create a new jones spkg soon, but for now I'm attaching the sage patch and the updated <code>data/jones/jones.sobj</code>.
</p>
<p>
There was also a new polynomial on John Jones' webpage, so the contents of this new sobj are slightly different than the previous version of the database.
</p>
TicketwjpSun, 09 Jan 2011 06:35:10 GMTattachment set
https://trac.sagemath.org/ticket/8251
https://trac.sagemath.org/ticket/8251
<ul>
<li><strong>attachment</strong>
set to <em>8251_Jones_pickle.patch</em>
</li>
</ul>
TicketwjpSun, 09 Jan 2011 06:35:27 GMTattachment set
https://trac.sagemath.org/ticket/8251
https://trac.sagemath.org/ticket/8251
<ul>
<li><strong>attachment</strong>
set to <em>jones.sobj</em>
</li>
</ul>
TicketwjpSun, 09 Jan 2011 23:00:38 GMT
https://trac.sagemath.org/ticket/8251#comment:8
https://trac.sagemath.org/ticket/8251#comment:8
<p>
It would also be possible to fix unpickling the old sobj (and any other potentially broken old pickles) by creating an empty <code>RationalField.__setstate__(state)</code>.
</p>
TicketjdemeyerTue, 13 Aug 2013 15:34:36 GMTmilestone changed
https://trac.sagemath.org/ticket/8251#comment:9
https://trac.sagemath.org/ticket/8251#comment:9
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.11</em> to <em>sage-5.12</em>
</li>
</ul>
Ticketvbraun_spamThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/8251#comment:10
https://trac.sagemath.org/ticket/8251#comment:10
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
Ticketvbraun_spamTue, 06 May 2014 15:19:32 GMTmilestone changed
https://trac.sagemath.org/ticket/8251#comment:11
https://trac.sagemath.org/ticket/8251#comment:11
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
Ticketvbraun_spamSun, 10 Aug 2014 16:51:03 GMTmilestone changed
https://trac.sagemath.org/ticket/8251#comment:12
https://trac.sagemath.org/ticket/8251#comment:12
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.3</em> to <em>sage-6.4</em>
</li>
</ul>
Ticket