Interesting... Just to confirm: in the above I have been using SageMath
Version 7.1 on Ubuntu 14.04 (sorry, I should have probably stated this way
back when I posted the question). So it seems like it is a Sage 7.0+
problem!

On 3 May 2016 at 16:23, Kevin Buzzard <[email protected]> wrote:

> Hi Misja. Your silly code works fine for me on ubuntu 14.04 with sage
> version 6.4.1 (I get zeroes), but I can reproduce your random '1' with sage
> 7.0.0. I can confirm that after the bad code has run once on 7.0.0, David's
> suggestion of clearing the modular symbols cache does not fix the problem
> -- I still get a 1.
>
> Kevin
>
>
> $ sage
> ┌────────────────────────────────────────────────────────────────────┐
> │ Sage Version 6.4.1, Release Date: 2014-11-23                       │
> │ Type "notebook()" for the browser-based notebook interface.        │
> │ Type "help()" for help.                                            │
> └────────────────────────────────────────────────────────────────────┘
> sage: %cpaste
> Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
> :G=DirichletGroup(80);
> :for chi in G:
> :
>  
> D=ModularSymbols(chi,2,-1).cuspidal_subspace().new_subspace().decomposition();
> :    for f in D:
> :        elt=f.q_eigenform(10,'alpha')[3];
> :        if not elt.parent()==QQ:
> :            K=elt.parent().absolute_field('b');
> :            if chi==G[22]:
> :                fact=K.factor(2);
> :                for P,e in fact:
> :                    res_field=K.residue_field(P);
> :                    print res_field(elt);
> :<EOF>
> 0
> 0
> 0
> 0
> sage:
>
>
> On Thursday, 28 April 2016 15:09:59 UTC+1, Misja wrote:
>>
>> When understand the specific reason why my code is not working properly,
>> I managed to pin it down to the following mysterious behaviour of
>> q_eigenform.
>>
>> First run the following code in sage.
>>
>> G=DirichletGroup(80);
>> chi=G[22];
>>
>> D=ModularSymbols(chi,2,-1).cuspidal_subspace().new_subspace().decomposition();
>> for f in D:
>>     elt=f.q_eigenform(10,'alpha')[3];
>>     N=elt.parent().absolute_field('a');
>>     fact=N.factor(2);
>>     for P,e in fact:
>>         res_field=N.residue_field(P);
>>         print res_field(elt);
>>
>>
>> It will print
>>
>> 0
>> 0
>> 0
>> 0
>>
>> which, I think, is the 'right' answer.
>>
>>
>> Now *close* your sage session entirely. Open a new session and then run
>> the following *silly* code:
>>
>> G=DirichletGroup(80);
>> for chi in G:
>>
>> D=ModularSymbols(chi,2,-1).cuspidal_subspace().new_subspace().decomposition();
>>     for f in D:
>>         elt=f.q_eigenform(10,'alpha')[3];
>>         if not elt.parent()==QQ:
>>             K=elt.parent().absolute_field('b');
>>             if chi==G[22]:
>>                 fact=K.factor(2);
>>                 for P,e in fact:
>>                     res_field=K.residue_field(P);
>>                     print res_field(elt);
>>
>>
>> It will print:
>>
>> 0
>> 0
>> 1
>> 0
>>
>> As far as I understand the theory, this cannot happen. If you let sage
>> print the alpha^3 coefficient of you see that in both cases it picks a
>> different q_eigenform in f, the Galois conjugacy class of newforms.
>> Although this can be a bit annoying, in theory it is fine. But I am pretty
>> sure that when your reduce this coefficient modulo some prime P, any two
>> elements of the same Galois conjugacy class can differ at most by some
>> automorphism of the residue field (and obviously 1 and 0 do not satisfy
>> this criterion).
>>
>>
>> To make matters worse: if you run a single sage session and you run the
>> 'good' code first and the 'bad' code second, then suddenly the 'bad' code
>> is fixed and printing only 0s. If you run the 'bad' code first and the
>> 'good' code second, then they are both 'bad' and the 'good' code suddenly
>> prints 0,0,1,0 as well.
>>
>> By trying I found out that this is because somehow  q_eigenform picks the
>> same q_eigenform as whichever code that ran first and somehow these choices
>> are not compatible! I don't know the inner workings of q_eigenform, but
>> this behaviour seems strange to me.
>>
>> Can anyone explain what is going on here? Is it a bug?
>>
>> Thanks!
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/OMjVE6YasdU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to