[GAP Forum] arithmetic in C
Max Horn
max at quendi.de
Tue Mar 20 08:59:21 GMT 2012
Dear Wolfgang,
I am not sure if you perhaps already got a private reply to your email. If not, maybe the following will help you.
Am 14.03.2012 um 09:05 schrieb Wolfgang Lindner:
> dear group,
>
> I know how to calculate with Rationals, ZmodnZ, Integers etc.
> But I could not find infos in the help-index of GAP
> how to do calculations in the complex field C
> (I know about gaussionInteger).
Short answer: Use "Cyclotomics" or one of its subfields. Make sure to read the GAP manual on them and on abelian number fields:
<http://www.gap-system.org/Manuals/doc/htm/ref/CHAP018.htm>
<http://www.gap-system.org/Manuals/doc/htm/ref/CHAP058.htm>
The following might also be of interest:
<http://www.gap-system.org/Manuals/doc/htm/ref/CHAP056.htm>
<http://www.gap-system.org/Manuals/doc/htm/ref/CHAP065.htm>
Long answer: It is essentially impossible to compute with the "full set" of complex numbers (or real numbers) on a computer; in particular, not every real (and hence not every complex) number is computable (see e.g. <http://en.wikipedia.org/wiki/Computable_number>).
But for the vast majority of cases (at least in my personal experience), one doesn't really need the full set of real or complex numbers; rather, one only needs to deal with a few select numbers, such as "square root of 2" or "pi". GAP allows you to work with the former: One can construct abelian extension fields of the rational numbers in GAP, which all are subfields of the "field of cyclotomic numbers". So the following works:
gap> Sqrt(-1);
E(4)
gap> Sqrt(2);
E(8)-E(8)^3
However, this does not allow you to work with pi directly, as that lives in a transcendental extension. There are some tricks to deal with that to a certain extent. Note that pi and similar transcendentals seem not to be really necessary to do group theory, which is probably why they are not supported as such.
> I would like to work in C[X] etc.
gap> R:=PolynomialRing(Cyclotomics, "x");
Cyclotomics[x]
gap> x:=R.1;
x
gap> f:=x^2-x+1;
x^2-x+1
Cheers,
Max
More information about the Forum
mailing list