Ticket #3961 (closed defect: fixed)

Opened 3 months ago

Last modified 3 months ago

[with patch, positive review] bug in ell_finite_field.abelian_group()

Reported by: cremona Assigned to: cremona
Priority: minor Milestone: sage-3.1.2
Component: number theory Keywords: elliptic curve finite field
Cc: AlexGhitza

Description

This works in 3.1.1:

sage: p=10^4+7; p       
10007
sage: F.<i>=GF(p^2)
sage: E = EllipticCurve([0,0,0,i,i+3]); E
Elliptic Curve defined by y^2  = x^3 + i*x + (i+3) over Finite Field in i of size 10007^2
sage: E.abelian_group()

(Multiplicative Abelian Group isomorphic to C100130006,
 ((8287*i + 5423 : 9131*i + 6741 : 1),))

but this does not:

sage: K.<i> = QuadraticField(-1)
sage: P=K.factor(p)[0][0]; P
Fractional ideal (10007)
sage: E = EllipticCurve([0,0,0,i,i+3]); E
Elliptic Curve defined by y^2  = x^3 + i*x + (i+3) over Number Field in i with defining polynomial x^2 + 1            
sage: Emod = E.change_ring(K.ring_of_integers().residue_field(P)); Emod
Elliptic Curve defined by y^2  = x^3 + ibar*x + (ibar+3) over Residue field in ibar of Fractional ideal (10007)
sage: Emod.abelian_group()
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)

/home/john/sage-3.1.final/<ipython console> in <module>()

/home/john/sage-3.1.final/local/lib/python2.5/site-packages/sage/schemes/elliptic_curves/ell_finite_field.py in abelian_group(self, debug)
   1121                 if debug: print "n1a=",n1a
   1122                 a = None
-> 1123                 for m in (N//n1).divisors():
   1124                     try:
   1125                         a = generic.bsgs(m*P1a,m*Q,(0,(n1b//m)-1),operation='+')

UnboundLocalError: local variable 'N' referenced before assignment

That's a bug in code I wrote, and I will fix it. But it's a mystery why it only arises when the same (abstract) finite field is defined as a quotient field of ZZ[i].

Attachments

sage-trac3926.patch (4.2 kB) - added by cremona on 08/27/2008 02:55:13 AM.

Change History

08/27/2008 02:55:13 AM changed by cremona

  • attachment sage-trac3926.patch added.

08/27/2008 02:57:00 AM changed by cremona

  • keywords changed from elliptic curve fineite field to elliptic curve finite field.
  • component changed from algebra to number theory.
  • summary changed from bug in ell_finite_field.abelian_group() to [with patch, needs review] bug in ell_finite_field.abelian_group().

The attached patch fixes the bug (and at the same time slightly improves the debug output, and also introduces a small speedup). The bug was in the line now number 1135.

The apparent inconsistency noted at the end of the bug report is bogus: the default generator for GF(10007^2) is not sqrt(-1) so the two curves are actually different.

Patch is based on 3.1.1, and all doctests in sage.schemes.elliptic_curves pass.

08/27/2008 03:15:12 AM changed by AlexGhitza

  • cc set to AlexGhitza.

08/28/2008 09:07:05 PM changed by AlexGhitza

  • summary changed from [with patch, needs review] bug in ell_finite_field.abelian_group() to [with patch, positive review] bug in ell_finite_field.abelian_group().

The patch indeed fixes the bug, and there is a small speed gain.

08/28/2008 11:29:53 PM changed by mabshoff

  • status changed from new to closed.
  • resolution set to fixed.

Merged in Sage 3.1.2.alpha2