Johannes M"uller writes :
Second: I'm in need of a function returning the (rounded) modulus of a
cyclotomic, e.g. something like AbsVal(1+E(4)) giving something about
1414/1000. Is there something I haven't found? (gap3r4p0)
to which Alexander Hulpke responds :
No. At the moment, GAP's implementation of field extensions is a purely
algebraic one. There is no way to extend valuation information from the
ground field to the extension.
It would be possible to write a function 'AbsVal' in the GAP language, that
would utilize the canonical embedding E(n)->exp(2\pi i/n) and get an
approximation of the value by numerical evaluation.
I wrote a function that takes a (real) element in Q(E(n)) and gives an
approximate rational of it. Modifying the code for nonreal elements should
be striaght forward, but I didn't need it. As Alexander commented, the code
is both crude and slow; but for what I was doing it worked reasonably well --
(my application involves generating postscipt graphics from objects calculated
in GAP, so round off errors and the like are not at all critical).
Here's what I wrote :
# Taylor series approximation for cos(r) cos:=r->Sum([0..8],i->(((-1)^i)/Factorial(2*i))*r^(2*i) ); # rationalize r; basically you express r as a sum of cosines using its # expansion in the cyclotomics, and then approximate each cosine term # with above series. Rat:=function(r) local n,cofs,i,j,twopi,res; twopi:=710/113; n:=NofCyc(r); cofs:=CoeffsCyc(r,n); res:=cofs[1]; for i in [2..n] do if cofs[i]<>0 then res:=res+2*cofs[i]*cos(twopi*(i-1)/n); j:=CoeffsCyc(E(n)^(i-1)+E(n)^-(i-1),n); cofs:=cofs-cofs[i]*j; fi; od; return Int(1000*res); end;
some examples :
gap> a1:=1+E(4); 1+E(4) gap> a2:=a1*GaloisCyc(a1,-1); # you get the absolute value using 2 gap> b0:=Rat(ER(2)); 1414 gap> b0^2; 1999396 # close enough! gap> b0:=Rat(ER(5)); 2236 gap> b0^2; 4999696
Jacob Hirbawi <JcbHrb@CERF.net>