Dear GAP-Forum!
In ftp.math.rwth-aachen.de:/pub/incoming/ there is now a
file called 'approx.g' which implements GAP v3.4 functions
to compute rational approximations of cyclotomic field
elements.
The module is not meant to introduce numerical computation
into GAP --- rather it allows to find accurate rational
approximations cyclotomic field elements, embedded into
the complex numbers. Let E(n) mean exp(2 pi i/n) and
consider a cyclotomic field element z then
ApproxReCycSimple(z, absError)
computes a pair [a, b] of rationals such that
a <= Re(z) <= b and b - a < absError
for some positive rational absError. In fact, there
are three alternative methods of approximation:
Simple
finds *some* a, b (not necessarily with small numerator
or denominator)
Binary
finds a, b such that the denominators are powers of 2
(and are minimal under this condition)
SternBrocot
finds a, b such that the denominators are small (and
in case they represent principal terms of the associated
continued fraction series, are minimal)
For details refer to 'approx.g' and print out all lines
which contain the string #F (under UNIX: grep \#F approx.g).
In addition there is a simple function
StringDecimalRat(<rat>, <mantissaDigits>)
which returns a string for the 'scientific notation'
of the rational <rat> expressed with <mantissaDigits>
many digits after the decimal dot (e.g. "1.96883e5").
Again, the function is not meant to be numerical, but
it proved useful to me in that it often gives me an
impression of a number. (StringDecimalRat(6283/2000, 3)
yields "3.141e0".)
Have fun with it -- and don't forget to send me
the bug reports...
Sebastian.