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

2010-12-21 Thread John Cremona
On Dec 21, 1:38 am, rje ronevan...@gmail.com 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

[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 john.crem...@gmail.com wrote: On Dec 21, 1:38 am, rje ronevan...@gmail.com wrote: Thanks for the helpful response.  The appropriate code  for

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

[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 john.crem...@gmail.com wrote: On Dec 21, 1:38 am, rje ronevan...@gmail.com wrote: Thanks for the helpful response.  The appropriate code  for computing Gamma(n).ncusps() is

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 vbraun.n...@gmail.com 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

[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

[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 Braunvbraun.n...@gmail.com 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

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 jason-s...@creativetrax.com wrote: On 12/21/10 11:36 AM, Robert Bradshaw wrote: On Tue, Dec 21, 2010 at 4:16 AM, Volker Braunvbraun.n...@gmail.com  wrote: No, it's because your loop is over 1 rather than 1000. Sharp eyes! :) So, to

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 jhpalmier...@gmail.com wrote: On Dec 19, 7:01 pm, Alex Raichev tortoise.s...@gmail.com 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

[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

[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