[GAP Forum] arithmetic in C

Laurent Bartholdi laurent.bartholdi at gmail.com
Tue Mar 20 09:39:38 GMT 2012


Dear Wolfgang,
I reply only now to your question because I'm not on the "forum" mailing
list; it was kindly forwarded by Jakob.

It's very tricky to work with complex numbers in pure algebra; GAP
contains, since its latest release (4.5.2), support for floating-point
approximations of complex numbers, which I assume is what you want.

You'll have to compile the package "float", whose source is part of the
distribution but requires its own configuration (the usual ./configure &&
make in .../pkg/float; hopefully the process works smoothly, but if
something goes wrong please tell me).

Then you can access floating-point complex numbers within GAP; a sample
session is:

gap> LoadPackage("float");
true
gap> SetFloats(MPC,1000); # 1000 bits of precision
gap> r := PolynomialRing(MPC_PSEUDOFIELD,1); # 1 indeterminate
ℂ[z]

gap> r.1^5-1;

z^5-.1e1+.0e0i

gap> RootsFloat(last);

[ .309017e0+.951057e0ⅈ, -.809017e0+.587785e0ⅈ, -.809017e0-.587785e0ⅈ,
.1e1-.989853e-301ⅈ,
  .309017e0-.951057e0ⅈ ]
gap> last2^2;
z^10+(-.2e1+.0e0i)*z^5+.1e1+.0e0i

gap>


On Tue, Mar 20, 2012 at 10:28 AM, kroeker <kroeker at uni-math.gwdg.de> wrote:

> **
>
>
> -------- Original-Nachricht --------  Betreff: [GAP Forum] arithmetic in C  Datum:
> Wed, 14 Mar 2012 09:05:05 +0100  Von: Wolfgang Lindner
> <LindnerW at t-online.de> <LindnerW at t-online.de>  An: <forum at gap-system.org><forum at gap-system.org>  CC:
> forum-request at gap-system.org
>
> 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).
>
> I would like to work in C[X] etc.
>
> regards
> Wolfgang
>
>
> _______________________________________________
> Forum mailing listForum at mail.gap-system.orghttp://mail.gap-system.org/mailman/listinfo/forum
>
>


-- 
Prof. Dr. Laurent Bartholdi   \ laurent.bartholdi<at>gmail<dot>com
G.-A. Universität zu Göttingen \ Phone: +49 551 39 7826
Bunsenstraße 3-5                \ Secr: +49 551 39 7752
D-37073 Göttingen, Germany       \ Fax: +49 551 39 22674


More information about the Forum mailing list