[sage-support] list of inequivalent cusps for the principal congruence subgroup Gamma(N)

2010-12-21 Thread rje
In ticket 10506, John Cremona wrote the following in reference to Gamma(n): "Note that the next job is to add a method to return a set of inequivalent cusps. The default implementation is stupidly slow (as proved by the fact that the old default for ncusps() was to find all the cusps and count them

[sage-support] Re: G.are_equivalent_cusps

2010-12-21 Thread victor
I wrote the following function, which does the job. Function below takes as input a positive integer N and outputs two objects: the first output is a list [g_i] of hyperbolic elements in Gamma0(N) which generate the abelianized (Gamma0(N)_hyp)_ab of the quotient Gamma0(N)_hyp of Gamma0(N) by the su

Re: [sage-support] Re: factor() behaving badly

2010-12-21 Thread Robert Bradshaw
On Sun, Dec 19, 2010 at 9:39 PM, John H Palmieri wrote: > On Dec 19, 7:01 pm, Alex Raichev wrote: >> Hi all: >> >> I get differently formatted answers using factor() multiple times on >> the same polynomial.  I wouldn't call it a bug, but it sure is >> annoying when doctesting. >> >> Alex >> >> -

Re: [sage-support] Re: PY_TYPE_CHECK or isinstance?

2010-12-21 Thread Robert Bradshaw
On Tue, Dec 21, 2010 at 10:29 AM, Jason Grout wrote: > On 12/21/10 11:36 AM, Robert Bradshaw wrote: >> >> On Tue, Dec 21, 2010 at 4:16 AM, Volker Braun >>  wrote: No, it's because your loop is over 1 rather than 1000. >>> >>> Sharp eyes! :) >>> So, to summarize, with the improved Cyt

[sage-support] Re: PY_TYPE_CHECK or isinstance?

2010-12-21 Thread Jason Grout
On 12/21/10 11:36 AM, Robert Bradshaw wrote: On Tue, Dec 21, 2010 at 4:16 AM, Volker Braun wrote: No, it's because your loop is over 1 rather than 1000. Sharp eyes! :) So, to summarize, with the improved Cython one should always use isinstance as it will be optimized to be at least as fas

[sage-support] G.are_equivalent_cusps

2010-12-21 Thread victor
Let m be a modular symbol for the congruence subgroup G=Gamma0(N) for some N. If one assumes m is cuspidal, there exist elements g in G such that m is equivalent to the symbol {0,g(0)}. How can I compute one such g with sage? If possible, I'd like to find g with as small coefficients as possible.

Re: [sage-support] Re: PY_TYPE_CHECK or isinstance?

2010-12-21 Thread Robert Bradshaw
On Tue, Dec 21, 2010 at 4:16 AM, Volker Braun wrote: >> No, it's because your loop is over 1 rather than 1000. > > Sharp eyes! :) > So, to summarize, with the improved Cython one should always use isinstance > as it will be optimized to be at least as fast. Yes, as long as the rhs is known by

[sage-support] Re: counting cusps for the principal congruence subgroup

2010-12-21 Thread rje
Your product formula is a good idea. It's faster than my summation formula. On Dec 21, 3:40 am, John Cremona wrote: > On Dec 21, 1:38 am, rje wrote: > > > Thanks for the helpful response.  The appropriate code  for computing > > Gamma(n).ncusps() is > > > n=self.level() > > if n<=2: > >      

Re: [sage-support] Re: PY_TYPE_CHECK or isinstance?

2010-12-21 Thread Volker Braun
> No, it's because your loop is over 1 rather than 1000. Sharp eyes! :) So, to summarize, with the improved Cython one should always use isinstance as it will be optimized to be at least as fast. I guess we should remove the PY_TYPE_CHECK macro from Sage altogether and replace every occurre

[sage-support] Re: counting cusps for the principal congruence subgroup

2010-12-21 Thread John Cremona
There's now a patch at #10506 (http://trac.sagemath.org/sage_trac/ ticket/10506) ready for review. John Cremona On Dec 21, 11:40 am, John Cremona wrote: > On Dec 21, 1:38 am, rje wrote: > > > Thanks for the helpful response.  The appropriate code  for computing > > Gamma(n).ncusps() is > > > n

[sage-support] Re: counting cusps for the principal congruence subgroup

2010-12-21 Thread John Cremona
On Dec 21, 1:38 am, rje wrote: > 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 t