Ticket #11220: trac_11220-apply_only_this.patch

File trac_11220-apply_only_this.patch, 8.7 KB (added by was, 2 years ago)

apply only this patch -- adds more documentation.

  • sage/schemes/elliptic_curves/cm.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com> and Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1303483826 -3600
    # Node ID 93b0f6e107a3dddf3b750d3365b6e57b485ec5cc
    # Parent  380fa8eae288e260a5cbd827500df9f7e0fabb41
    #11220: implement CM j-invariants and orders for quadratic fields
    * * *
    #11220 - j-invariants of CM curves over degree 2 fields.
    
    diff --git a/sage/schemes/elliptic_curves/cm.py b/sage/schemes/elliptic_curves/cm.py
    a b  
    2626 
    2727from sage.interfaces.all import magma 
    2828from sage.rings.all import (Integer, 
    29                             RationalField, 
     29                            QQ, 
    3030                            IntegerRing, 
    3131                            is_fundamental_discriminant, 
    3232                            PolynomialRing) 
     
    150150 
    151151    INPUT: 
    152152     
    153     - ``K`` -- a number field (currently only implemented for `K=\QQ`) 
     153    - ``K`` -- a number field (currently only implemented for `K` of degree at most 2) 
    154154 
    155155    OUTPUT: 
    156156     
     
    158158 
    159159    .. note:: 
    160160 
    161        This is currently only implemented for the rationals.  David 
    162        Kohel has large tables for other fields, but they are not in 
    163        Sage yet. 
     161       This is currently only implemented for the rationals and 
     162       quadratic fields.  David Kohel has large tables for other 
     163       functions, but they are not in Sage yet. 
    164164 
    165165    EXAMPLE:: 
    166166     
    167167        sage: cm_j_invariants(QQ) 
    168168        [0, 54000, -12288000, 1728, 287496, -3375, 16581375, 8000, -32768, -884736, -884736000, -147197952000, -262537412640768000] 
    169169 
    170     :: 
     170    Over imaginary quadratic fields there are no more than over `QQ`:: 
    171171     
    172         sage: cm_j_invariants(QuadraticField(-1, 'i')) 
     172        sage: cm_j_invariants(QuadraticField(-1, 'i'))  
     173        [0, 54000, -12288000, 1728, 287496, -3375, 16581375, 8000, -32768, -884736, -884736000, -147197952000, -262537412640768000] 
     174 
     175    Over real quadratic fields there may be more:: 
     176     
     177        sage: cm_j_invariants(QuadraticField(5, 'a'))   
     178        [0, 54000, -12288000, 1728, 287496, -3375, 16581375, 8000, -32768, -884736, -884736000, -147197952000, -262537412640768000, 282880*a + 632000, -282880*a + 632000, 95178240*a + 212846400, -95178240*a + 212846400, 85995/2*a - 191025/2, -85995/2*a - 191025/2, 16554983445/2*a + 37018076625/2, -16554983445/2*a + 37018076625/2, 26378240*a - 58982400, -26378240*a - 58982400, 95673435586560*a - 213932305612800, -95673435586560*a - 213932305612800, 184068066743177379840*a - 411588709724712960000, -184068066743177379840*a - 411588709724712960000] 
     179 
     180    Over fields of higher degree this is not yet implemented:: 
     181     
     182        sage: K.<a> = NumberField(x^3-2) 
     183        sage: cm_j_invariants(K) 
    173184        Traceback (most recent call last): 
    174185        ... 
    175         NotImplementedError: Enumeration of CM j-invariants over Number Field in i with defining polynomial x^2 + 1 not yet implemented 
     186        NotImplementedError: Enumeration of CM j-invariants over fields of degree 3 not yet implemented 
    176187 
    177188    """ 
    178     if K == RationalField(): 
     189    if K == QQ: 
    179190        return [Integer(x) for x in [0, 54000, -12288000, 1728, \ 
    180191                               287496, -3375, 16581375, 8000, \ 
    181192                               -32768,  -884736, -884736000,\ 
    182193                               -147197952000, -262537412640768000]] 
     194 
    183195    else: 
    184         raise NotImplementedError, "Enumeration of CM j-invariants over %s not yet implemented"%K 
    185  
     196        return [j for D,f,j in cm_j_invariants_and_orders(K)] 
    186197 
    187198def cm_j_invariants_and_orders(K): 
    188199    r""" 
     
    190201 
    191202    INPUT: 
    192203 
    193     - ``K`` -- a number field (currently only implemented for `K=\QQ`) 
     204    - ``K`` -- a number field (currently only implemented for `K` of degree at most 2) 
    194205 
    195206    OUTPUT: 
    196207 
    197208    (list) A list of 3-tuples `(D,f,j)` where `j` is a CM 
    198     `j`-invariant with quadratic fundamental discriminant `D` and 
    199     conductor `f` 
     209    `j`-invariant in `K` with quadratic fundamental discriminant `D` 
     210    and conductor `f`. 
    200211 
    201212    EXAMPLE:: 
    202213     
    203214        sage: cm_j_invariants_and_orders(QQ) 
    204         [(-3, 3, -12288000), (-3, 2, 54000), (-3, 1, 0), (-4, 2, 287496), (-4, 1, 1728), (-7, 2, 16581375), (-7, 1, -3375), (-8, 1, 8000), (-11, 1, -32768), (-19, 1, -884736), (-43, 1, -884736000), (-67, 1, -147197952000), (-163, 1, -262537412640768000)] 
     215        [(-3, 1, 0), (-3, 2, 54000), (-3, 3, -12288000), (-4, 1, 1728), (-4, 2, 287496), (-7, 1, -3375), (-7, 2, 16581375), (-8, 1, 8000), (-11, 1, -32768), (-19, 1, -884736), (-43, 1, -884736000), (-67, 1, -147197952000), (-163, 1, -262537412640768000)] 
    205216 
    206     :: 
     217    Over an imaginary quadratic field there are no more than over `QQ`:: 
     218 
     219        sage: cm_j_invariants_and_orders(QuadraticField(-1, 'i'))  
     220        [(-3, 1, 0), (-3, 2, 54000), (-3, 3, -12288000), (-4, 1, 1728), (-4, 2, 287496), (-7, 1, -3375), (-7, 2, 16581375), (-8, 1, 8000), (-11, 1, -32768), (-19, 1, -884736), (-43, 1, -884736000), (-67, 1, -147197952000), (-163, 1, -262537412640768000)] 
     221 
     222    Over real quadratic fields there may be more:: 
     223        
     224        sage: cm_j_invariants_and_orders(QuadraticField(5,'a')) 
     225        [(-3, 1, 0), (-3, 2, 54000), (-3, 3, -12288000), (-4, 1, 1728), (-4, 2, 287496), (-7, 1, -3375), (-7, 2, 16581375), (-8, 1, 8000), (-11, 1, -32768), (-19, 1, -884736), (-43, 1, -884736000), (-67, 1, -147197952000), (-163, 1, -262537412640768000), (-20, 1, 282880*a + 632000), (-20, 1, -282880*a + 632000), (-40, 1, 95178240*a + 212846400), (-40, 1, -95178240*a + 212846400), (-15, 1, 85995/2*a - 191025/2), (-15, 1, -85995/2*a - 191025/2), (-15, 2, 16554983445/2*a + 37018076625/2), (-15, 2, -16554983445/2*a + 37018076625/2), (-35, 1, 26378240*a - 58982400), (-35, 1, -26378240*a - 58982400), (-115, 1, 95673435586560*a - 213932305612800), (-115, 1, -95673435586560*a - 213932305612800), (-235, 1, 184068066743177379840*a - 411588709724712960000), (-235, 1, -184068066743177379840*a - 411588709724712960000)] 
     226 
     227        sage: [(D,f) for D,f,j in cm_j_invariants_and_orders(QuadraticField(5,'a')) if j not in QQ] 
     228        [(-20, 1), (-20, 1), (-40, 1), (-40, 1), (-15, 1), (-15, 1), (-15, 2), (-15, 2), (-35, 1), (-35, 1), (-115, 1), (-115, 1), (-235, 1), (-235, 1)] 
     229 
     230    Over fields of higher degree this is not yet implemented:: 
    207231     
    208         sage: cm_j_invariants_and_orders(QuadraticField(-1, 'i')) 
     232        sage: K.<a> = NumberField(x^3-2) 
     233        sage: cm_j_invariants_and_orders(K) 
    209234        Traceback (most recent call last): 
    210235        ... 
    211         NotImplementedError: Enumeration of CM j-invariants over Number Field in i with defining polynomial x^2 + 1 not yet implemented 
     236        NotImplementedError: Enumeration of CM j-invariants over fields of degree 3 not yet implemented 
     237 
    212238 
    213239    """ 
    214     if K == RationalField(): 
     240    if K == QQ: 
    215241        T = [ (0,-3, 1), (54000,-3,2), (-12288000, -3,3), (1728,-1, 1), \ 
    216242               (287496,-1, 2), (-3375,-7,1), (16581375, -7, 2), (8000,-2,1), \ 
    217243               (-32768, -11, 1),  (-884736, -19,1), (-884736000,-43,1),\ 
     
    219245               ] 
    220246        dis = lambda D:  Integer(D) if D%4 in [0,1] else Integer(4*D) 
    221247        T = [(dis(D),Integer(f),Integer(j)) for (j,D,f) in T] 
    222         T.sort() 
    223         T.reverse() 
    224248        return T 
    225     else: 
    226         raise NotImplementedError, "Enumeration of CM j-invariants over %s not yet implemented"%K 
    227249 
     250    if K.degree()==2: 
     251        # Below we use that the imaginary quadratic orders of class number 2 are the 
     252        # maximal orders in Q(sqrt(-d)) for d in 
     253        # [-5,-6,-10,-13,-15,-22,-35,-37,-51,-58,-91,-115,-123,-187,-235,-267,-403,-427] 
     254        # and the order of index 2 in Q(sqrt(-15)). [Reference: many 
     255        # places including J E Cremona, Abelian Varieties with Extra 
     256        # Twist, Cusp Forms, and Elliptic Curves Over Imaginary 
     257        # Quadratic Fields, Journal of the London Mathematical Society 
     258        # 45 (1992) 402-416.]      
     259 
     260        def data_for_discriminant(d): 
     261            D = d if d%4 == 1 else 4*d 
     262            for j in hilbert_class_polynomial(D).roots(K,multiplicities=False): 
     263                yield (Integer(D), Integer(1), j) 
     264            # the only non-maximal order of class number 2 is for d == -15 
     265            if d == -15: 
     266                for j in hilbert_class_polynomial(-60).roots(K,multiplicities=False): 
     267                    yield (Integer(-15), Integer(2), j) 
     268 
     269        # list the discriminants of class number 2: 
     270        dlist = [-5,-6,-10,-13,-15,-22,-35,-37,-51,-58,-91,-115,-123,-187,-235,-267,-403,-427] 
     271        return sum((list(data_for_discriminant(d)) for d in dlist), cm_j_invariants_and_orders(QQ)) 
     272 
     273    raise NotImplementedError, "Enumeration of CM j-invariants over fields of degree %s not yet implemented"%K.degree() 
     274    # If you want to implement this in general, see the remarks at trac 11220.