Gaussian Sum

Author

Eric W. Weisstein
September 6, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheoreticFunctions/GaussianSum.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/GaussianSum.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Definition

GaussianSum[p_,q_,opts___?OptionQ]:=Sum[Exp[-Pi I (r^2)p/q],{r,0,q-1},opts]

Sum

V7

GaussianSum[p,q]

GaussianSum[p,q,Assumptions->GCD[p,q]==1]

GaussianSum[-2,q]

GaussianSum[-2,q,Assumptions->Mod[q,r]==0]//InputForm

Sum[E^(((2*I)*Pi*r^2)/q), {r, 0, -1 + q}]//InputForm

Subtract@@@Table[{GaussianSum[-2,q],Piecewise[{
{(I+1)Sqrt[q],Mod[q,4]==0},
{Sqrt[q],Mod[q,4]==1},
{0,Mod[q,4]==2},
{I Sqrt[q],Mod[q,4]==3}}]},{q,0,20}]//Factor//RootReduce//Union

Examples

GaussianSum[-2,q]

s1=Table[GaussianSum[-2,q],{q,20}]//FullSimplify//ComplexExpand

s2=Table[Switch[Mod[q,4],
0,(I+1)(Sqrt[q]),
1,(Sqrt[q]),
2,0,
3,I (Sqrt[q])],{q,20}]

s1==s2