Odd doctest for Hecke modules

5 views
Skip to first unread message

Rob Beezer

unread,
Feb 5, 2011, 5:01:01 PM2/5/11
to sage-devel
I've finished a major overhaul of the matrix kernel routines, aiming
for greater reliability and easier maintenance. It has required
almost no changes outside of sage/matrix but I have one problemsome
doctest that now fails.

http://trac.sagemath.org/sage_trac/ticket/10746

Notice that current behavior at a 4.6.2.alpha3 command line is to give
a different result on a subsequent run (and then it stays the same,
giving the second result repeatedly). With my patches, I get a third
value, but the runs all give the same result.

Any advice or suggestions on what is happening here? I know there is
some randomness in these computations, so maybe this test needs more
precautions? By adjusting the "3" in the system_of_eigenvalues() call
you can get a longer list of values. Are any of these answers, wrong,
or are any right? I've tried to chase my way back to some of the
matrix code, but I'm a bit out of my element on this one.

Thanks in advance for any assistance.

Rob



** Essence of original doctest, sage/modular/hecke/module.py, ~ line
1545

sage: set_random_seed(0)

::

sage: ModularSymbols_clear_cache()

::

sage: M = ModularSymbols(62,2,sign=-1)

sage: S = M.cuspidal_submodule().new_submodule()

sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]

[[1, 1, 0], [1, -1, -alpha - 1]]



** 4.6.2.alpha3 command-line:

sage: set_random_seed(0)

sage: ModularSymbols_clear_cache()

sage: M = ModularSymbols(62,2,sign=-1)

sage: S = M.cuspidal_submodule().new_submodule()

sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]

[[1, 1, 0], [1, -1, -alpha - 1]]

sage: set_random_seed(0)

sage: ModularSymbols_clear_cache()

sage: M = ModularSymbols(62,2,sign=-1)

sage: S = M.cuspidal_submodule().new_submodule()

sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]

[[1, 1, 0], [1, -1, 1/2*alpha + 1/2]]


4.6.2.alpha3 w/ kernel patch, command-line:

sage: set_random_seed(0)

sage: ModularSymbols_clear_cache()

sage: M = ModularSymbols(62,2,sign=-1)

sage: S = M.cuspidal_submodule().new_submodule()

sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]

[[1, 1, 0], [1, -1, -1/2*alpha - 1/2]]

sage: set_random_seed(0)

sage: ModularSymbols_clear_cache()

sage: M = ModularSymbols(62,2,sign=-1)

sage: S = M.cuspidal_submodule().new_submodule()

sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]

[[1, 1, 0], [1, -1, -1/2*alpha - 1/2]]

Volker Braun

unread,
Feb 5, 2011, 7:11:47 PM2/5/11
to sage-...@googlegroups.com
I've seen randomized errors in the ModularSymbols stuff. I'm pretty sure that you are using linbox under the hood somewhere, which employs some probabilistic algorithms. It seems like we are setting the random seed to a fixed value, but linbox has a bad habit of re-seeding the rng and/or using unitialized memory. Also, the results that Sage presents you are (mostly) stable because Sage caches the result. Unfortunately I haven't gotten to the core of the linbox issues yet.


William Stein

unread,
Feb 5, 2011, 9:39:04 PM2/5/11
to sage-...@googlegroups.com

This is not enough information to decide whether or not the output is
correct. Can you run the following line immediately after the above
line in each case:

sage: [A.system_of_eigenvalues(3)[0].parent() for A in S.decomposition()]
[Rational Field, Number Field in alpha with defining polynomial x^2 + 4*x + 1]

It's important to number what the defining polynomial of the number
field is in each case.

William

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

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Rob Beezer

unread,
Feb 6, 2011, 12:49:38 AM2/6/11
to sage-devel
William, Volker,

Thanks for the replies. Kernels for the rationals go to IML and for
number fields they go to PARI. Does either of those rely on linbox?

Here's the requested output - three different number fields are
evident. Thanks for the help.

Rob

** Stock 4.6.2.alpha3, second output repeats thereafter

sage: set_random_seed(0)
sage: ModularSymbols_clear_cache()
sage: M = ModularSymbols(62,2,sign=-1)
sage: S = M.cuspidal_submodule().new_submodule()
sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]
[[1, 1, 0], [1, -1, -alpha - 1]]
sage: [A.system_of_eigenvalues(3)[0].parent() for A in
S.decomposition()]
[Rational Field, Number Field in alpha with defining polynomial x^2 +
4*x + 1]

sage: set_random_seed(0)
sage: ModularSymbols_clear_cache()
sage: M = ModularSymbols(62,2,sign=-1)
sage: S = M.cuspidal_submodule().new_submodule()
sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]
[[1, 1, 0], [1, -1, 1/2*alpha + 1/2]]
sage: [A.system_of_eigenvalues(3)[0].parent() for A in
S.decomposition()]
[Rational Field, Number Field in alpha with defining polynomial x^2 -
2*x - 11]


** 4.6.2.alpha3 + patches at #10746, identical output each run

sage: set_random_seed(0)
sage: ModularSymbols_clear_cache()
sage: M = ModularSymbols(62,2,sign=-1)
sage: S = M.cuspidal_submodule().new_submodule()
sage: [A.system_of_eigenvalues(3) for A in S.decomposition()]
[[1, 1, 0], [1, -1, -1/2*alpha - 1/2]]
sage: [A.system_of_eigenvalues(3)[0].parent() for A in
S.decomposition()]
[Rational Field, Number Field in alpha with defining polynomial x^2 +
6*x - 3]

koffie

unread,
Feb 6, 2011, 5:42:26 AM2/6/11
to sage-devel



On Feb 6, 6:49 am, Rob Beezer <goo...@beezer.cotse.net> wrote:
> William, Volker,
>
> Thanks for the replies.  Kernels for the rationals go to IML and for
> number fields they go to PARI.  Does either of those rely on linbox?
>
> Here's the requested output - three different number fields are
> evident.  Thanks for the help.
>
> Rob
>

The defining polynomials of the number fields might be different, but
the numberfields themselves are actually isomorphic. The squarefree
part of the discriminant of the polynomial is 3 in all cases so the
numberfield obtained is just adjoining the square root of 3. The code
below shows that the three awnsers generated by the code are at least
up to isomorphims the same:

K.<x>=QQ[]
for a,f in [(-x-1,x^2 + 4*x + 1),(1/2*x+1/2,x^2 - 2*x - 11),
(-1/2*x-1/2,x^2 + 6*x - 3)]:
f.discriminant().squarefree_part()
K.<b>=QQ.extension(f)
K(a).minpoly()

3
x^2 - 2*x - 2
3
x^2 - 2*x - 2
3
x^2 - 2*x - 2

William Stein

unread,
Feb 6, 2011, 11:01:26 PM2/6/11
to sage-...@googlegroups.com
On Sun, Feb 6, 2011 at 2:42 AM, koffie <m.derick...@gmail.com> wrote:
>
>
>
> On Feb 6, 6:49 am, Rob Beezer <goo...@beezer.cotse.net> wrote:
>> William, Volker,
>>
>> Thanks for the replies.  Kernels for the rationals go to IML and for
>> number fields they go to PARI.  Does either of those rely on linbox?

No, neither uses Linbox. IML and PARI are totally independent from IML.

M.derickx, thanks for confirming that the output are isomorphic, so
this is an acceptable change.

>>
>> Here's the requested output - three different number fields are
>> evident.  Thanks for the help.
>>
>> Rob
>>
>
> The defining polynomials of the number fields might be different, but
> the numberfields themselves are actually isomorphic. The squarefree
> part of the discriminant of the polynomial is 3 in all cases so the
> numberfield obtained is just adjoining the square root of 3. The code
> below shows that the three awnsers generated by the code are at least
> up to isomorphims the same:
>
> K.<x>=QQ[]
> for a,f in [(-x-1,x^2 + 4*x + 1),(1/2*x+1/2,x^2 - 2*x - 11),
> (-1/2*x-1/2,x^2 + 6*x - 3)]:
>    f.discriminant().squarefree_part()
>    K.<b>=QQ.extension(f)
>    K(a).minpoly()
>
> 3
> x^2 - 2*x - 2
> 3
> x^2 - 2*x - 2
> 3
> x^2 - 2*x - 2
>

William Stein

unread,
Feb 6, 2011, 11:01:47 PM2/6/11
to sage-...@googlegroups.com
On Sun, Feb 6, 2011 at 8:01 PM, William Stein <wst...@gmail.com> wrote:
> On Sun, Feb 6, 2011 at 2:42 AM, koffie <m.derick...@gmail.com> wrote:
>>
>>
>>
>> On Feb 6, 6:49 am, Rob Beezer <goo...@beezer.cotse.net> wrote:
>>> William, Volker,
>>>
>>> Thanks for the replies.  Kernels for the rationals go to IML and for
>>> number fields they go to PARI.  Does either of those rely on linbox?
>
> No, neither uses Linbox.  IML and PARI are totally independent from IML.

I mean "from Linbox".

Rob Beezer

unread,
Feb 6, 2011, 11:17:16 PM2/6/11
to sage-devel
On Feb 6, 8:01 pm, William Stein <wst...@gmail.com> wrote:
> M.derickx, thanks for confirming that the output are isomorphic, so
> this is an acceptable change.

Maarten and William,

Thanks for the help with this one!

Rob
Reply all
Reply to author
Forward
0 new messages