Sage computes Jacobi sums incorrectly

75 views
Skip to first unread message

rje

unread,
Jun 24, 2009, 7:00:45 AM6/24/09
to sage-support
Curiously, Gauss sums are defined in the reference manual

http://www.sagemath.org/doc/reference/sage/modular/dirichlet.html

but Jacobi sums are not. Maybe that accounts for the following
problem: "jacobi_sum()" incorrectly computes Jacobi sums J(Y, Z) when
exactly one of the characters Y, Z is trivial.

Example:

sage: G=DirichletGroup(5); X=G.list(); Y=X[0]; Z=X[1]; #
Y is trivial and Z is quartic

sage: sum([Y(x)*Z(1-x) for x in IntegerModRing(5)])
-1
# The value -1 above is the correct value of the Jacobi sum J(Y, Z).


sage: Y.jacobi_sum(Z); Z.jacobi_sum(Y)
0
0
#The 0 values above are incorrect values of J(Y, Z).

Remark: Since unlike Gauss sums mod p, Jacobi sums mod p never
involve p-th roots of unity, the following is also a bit curious:

sage: parent(Z.jacobi_sum(Z))
Cyclotomic Field of order 20 and degree 8

rje

David Joyner

unread,
Jun 24, 2009, 7:35:02 AM6/24/09
to sage-s...@googlegroups.com
An easy fix:

In the code change

# If exactly one is trivial, return 0
else:
return 0

to

# If exactly one is trivial, return -1
else:
return -1

(Some docstrings need changing too.)

At first I thought it should be 0 in this case because I
confused "trivial character" with "identically equal to 1".

This is http://trac.sagemath.org/sage_trac/ticket/6393
I'll post a patch soon.

I don't understand why

sage: parent(Z.jacobi_sum(Z))
Cyclotomic Field of order 20 and degree 8

is incorrect though.

rje

unread,
Jun 24, 2009, 9:15:28 AM6/24/09
to sage-support


On Jun 24, 4:35 am, David Joyner <wdjoy...@gmail.com> wrote:
...

> At first I thought it should be 0 in this case because I
> confused "trivial character" with "identically equal to 1".

That makes it surprising that T.jacobi_sum(T) was correctly defined to
be p-2
(instead of p) for the trivial character T mod p.


> I don't understand why
>
> sage: parent(Z.jacobi_sum(Z))
> Cyclotomic Field of order 20 and degree 8
>
> is incorrect though.

EVERY Jacobi sum over GF(5) lies in a much smaller cyclotomic field,
namely the field of Gaussian integers. That's because each term of the
defining sum is a Gaussian integer. For example:

sage: parent(Z(3))
Cyclotomic Field of order 4 and degree 2

rje

David Joyner

unread,
Jun 24, 2009, 10:43:15 AM6/24/09
to sage-s...@googlegroups.com
On Wed, Jun 24, 2009 at 9:15 AM, rje<rev...@ucsd.edu> wrote:
>
>
>
> On Jun 24, 4:35 am, David Joyner <wdjoy...@gmail.com> wrote:
> ...
>
>> At first I thought it should be 0 in this case because I
>> confused "trivial character" with "identically equal to 1".
>
> That makes it surprising that T.jacobi_sum(T) was correctly defined to
> be p-2
> (instead of p) for the trivial character T mod p.


I may be mistaken in my vague recollection. I didn't write the code
but thought I remembered reading it over at one point.


>
>
>> I don't understand why
>>
>> sage: parent(Z.jacobi_sum(Z))
>> Cyclotomic Field of order 20 and degree 8
>>
>> is incorrect though.
>
> EVERY Jacobi sum over GF(5) lies in a much smaller cyclotomic field,
> namely the field of Gaussian integers. That's because each term of the
> defining sum is a Gaussian integer.   For example:
>
> sage: parent(Z(3))
> Cyclotomic Field of order 4 and degree 2


This makes sense but (a) it seems that the parent might come
from the coercion of some of the terms in the sum (which end up canceling)
so IMHO the output is not wrong, (b) there might be a way to determine
the smallest field in which Y.jacobi_sum(Z) lies but I don't know what it is,
(c) one could argue that, in any case, that issue deserves a separate ticket
(and patch).

I just posted a patch to #6393, which needs review.

>
> rje
>
> >
>
Reply all
Reply to author
Forward
0 new messages