Bill Allombert on Fri, 09 Jul 2004 22:52:25 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: complex arithmetic


On Mon, Jul 05, 2004 at 03:49:26PM -0400, Jacques Le Normand wrote:
> Hello,
> I'd like to do exact arithmetic in Q[e^(Pi*I/n)]. for example, in GAP I would 
> type "E(24) * E(24)" and it would output "E(12)"  (E(n) is e^(Pi*I/n) or 
> somesuch in GAP). This is fine; however, GAP is woefully slow, and I want to 
> use libPari, which is speedy. n is fixed before any computation starts. is 
> there any way of doing this in Pari? thanks

E(n) is e^(2*Pi*I/n) in GAP.

You can define E(n) by Mod(x,polcyclo(n)). However in PARI, you have to
take care of embedding yourself. One way to work around that is to
embed everything in a large cyclotomic field.
For example, if everything live in Q[e^(2*Pi*I/N)] for a suitable N,
you can do:
E(n)=Mod(x^(N/n),polcyclo(n))

For example
? N=24;
? E(24)^2==E(12)
%2 = 1
? E(6)^6
%3 = 1

More generally, PARI handle Q[exp(2*Pi*I/n)] as Q[X]/(P) where
P is is nth-cyclotomic polynomial (P=polcyclo(n) in GP notation).
The element A mod P of Q[X]/(P) is stored as Mod(A,P) with GP.
You can do computation with Mod(A,P) with +,-,*,/,^ as usual.

Cheers,
Bill.