Thanks for the helpful response.  The appropriate code  for computing
Gamma(n).ncusps() is

n=self.level()
if n<=2:
        return[None,1,3][n]
return ZZ(sum([moebius(d)*(n/d)^2/ZZ(2) for d in n.divisors()]))

But can I impose on someone who knows the ticketing procedure
to get this implemented?  Thanks.
***************************************************************************************************

On Dec 20, 9:21 am, John Cremona <john.crem...@gmail.com> wrote:
> You are right, and you can see the reason like this:
>
> sage: G = Gamma(5)
> sage: G.ncusps??
>
> shows that the code is a one-liner
>
> return ZZ(len(self.cusps()))
>
> i.e. a complete set of cusps is computed (to see how, do G.cusps??),
> while for the other groups a formula is used, e.g.
>
> sage: G = Gamma0(5)
> sage: G.ncusps??
>
> shows the code
>
>         n = self.level()
>         return sum([arith.euler_phi(arith.gcd(d,n//d)) for d in
> n.divisors()])
>
> and
>
> sage: G = Gamma1(5)
> sage: G.ncusps??
>
> shows the code
>
>         n = self.level()
>         if n <= 4:
>             return [None, 1, 2, 2, 3][n]
>         return ZZ(sum([phi(d)*phi(n/d)/ZZ(2) for d in n.divisors()]))
>
> Why don't you open a ticket to improve this by implementing a suitabel
> formula for the principal congruence subgroups?
>
> John Cremona
>
> On Dec 19, 10:51 pm, rje <ronevan...@gmail.com> wrote:
>
>
>
> > Sage is slow in computing the number of
> > cusps for Gamma(n).
>
> > Look, for example, at the disparity in times below.
>
> > sage: time Gamma(5).ncusps()
> > CPU times: user 52.02 s, sys: 0.24 s, total: 52.26 s
> > Wall time: 52.29 s
> > 12
>
> > sage: time Gamma0(5).ncusps()
> > CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> > Wall time: 0.00 s
> > 2
>
> > sage: time Gamma1(5).ncusps()
> > CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
> > Wall time: 0.00 s
> > 4- Hide quoted text -
>
> - Show quoted text -

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to