Group Abstract Group Abstract

Message Boards Message Boards

0
|
3K Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Using JacobiSymbol vs KroneckerSymbol

Posted 2 years ago

Hello all,

from my understanding, both JacobiSymbol(n,m) and KroneckerSymbol(n,m) return the same values when their arguments are integer, even though JacobiSymbol is about 6 X faster (and even though, mathematically, the Jacobi symbol should only be defined for odd positive m).

nn=1000;

a=Table[KroneckerSymbol[ n,m], {n, -nn, nn},{m,-nn,nn}]; // AbsoluteTiming

b=Table[JacobiSymbol[ n,m], {n, -nn, nn},{m,-nn,nn}]; // AbsoluteTiming

a==b (* True *)

So, is it safe to use JacobiSymbol instead of KroneckerSymbol?

Thank you in advance.

POSTED BY: Paolo Xausa
3 Replies
POSTED BY: Mariusz Iwaniuk
Posted 2 years ago

Yes, thank you, but JacobiSymbol[2,4] (for example) works and returns the correct value:

JacobiSymbol[2,4] == KroneckerSymbol[2,4]

I can't find any difference between the two functions (with the added bonus that JacobiSymbol is faster).

POSTED BY: Paolo Xausa

From help pages of KroneckerSymbol:

KroneckerSymbol is the generalization of the Jacobi symbol for all integers

  jacobi[n_, m_] := KroneckerSymbol[n, m] /; (OddQ[m] && Positive[m]);
  Table[jacobi[2, m], {m, 1, 9}]

  (*{1, jacobi[2, 2], -1, jacobi[2, 4], -1, jacobi[2, 6], 1, jacobi[2, 8], 1}*)

Regards M.I.

POSTED BY: Mariusz Iwaniuk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard