#10546: implement a custom cusps() method for principal congruence subgroups
Gamma(N)
-----------------------------+----------------------------------------------
   Reporter:  rje            |       Owner:  John Cremona                       
                                 
       Type:  enhancement    |      Status:  new                                
                                 
   Priority:  minor          |   Milestone:  sage-4.6.2                         
                                 
  Component:  modular forms  |    Keywords:  inequivalent cusps, principal 
congruence subgroup, Gamma(n), cusps()
     Author:  rje            |    Upstream:  N/A                                
                                 
   Reviewer:                 |      Merged:                                     
                                 
Work_issues:                 |  
-----------------------------+----------------------------------------------
 The command "Gamma(n).cusps()" computes a complete list of inequivalent
 cusps for the congruence subgroup
 Gamma(n), but it is very slow.
 For example, look at the time required just for n=8:
 ----------------------------------------------------
 sage: time Gamma(8).cusps()

 CPU times: user 1086.11 s, sys: 5.60 s, total: 1091.71 s
 Wall time: 1092.30 s

 [Infinity, 0, 1, 2, 3, 4, 5, 6, 7, -1/2, -1/3, -1/4, -1/5, -1/6, 2/3, 3/4,
 4/5, 5/6, 5/3, 11/6, 8/3, 11/3, 14/3, -3/8]
 ---------------------------------------------------------
 I've defined a function f(n) below that returns a complete list of
 inequivalent cusps for the group Gamma(n) (n>2). The elements of the list
 are in so-called "reduced_cusp form".  The cusp 1/n in the list is the one
 equivalent to Infinity.  Please use f(n) to make a patch for
 Gamma(n).cusps(), n>2.

 ------------------------------------------------------------
  def f(n):

     C=[0..n-1]

     n1=integer_floor((n-1)/2)

     n0=integer_floor(n/2)

     for r in [1..n1]:

          if gcd(r,n)==1:

              C.append(r/n)

          if n0==n/2 and gcd(r,n0)==1:

              C.append(r/n0)

     for s in [2..n1]:

          for r in [1..n]:

               if gcd([s,r,n])==1:

                   m=r

                   while gcd(m,s)>1:

                        m=m+n

                   C.append(m/s)

     return(C)
 --------------------------------------------------

 Here is an example for n=8:
 --------------------------------------------------
 sage: time f(8)

 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
 Wall time: 0.00 s

 [0, 1, 2, 3, 4, 5, 6, 7, 1/8, 1/4, 3/8, 3/4, 1/2, 3/2, 5/2, 7/2, 1/3, 2/3,
 11/3, 4/3, 5/3, 14/3, 7/3, 8/3]
 --------------------------------------------------
 The following gives an idea of the speed of f(n):
 --------------------------------------------------
 sage: time len(f(1260))

 CPU times: user 16.66 s, sys: 0.41 s, total: 17.07 s
 Wall time: 17.07 s

 497664
 ---------------------------------------------------
 The following checks the length 497664 of the list of inequivalent cusps:
 ---------------------------------------------------
 sage: prod([p**(2*e) - p**(2*e-2) for (p,e) in 1260.factor()])//2

 497664
 --------------------------------------------------

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10546>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to