[GAP Forum] Comparing real numbers

Frank Lübeck frank.luebeck at math.rwth-aachen.de
Tue Aug 22 17:36:37 BST 2017


On Mon, Aug 21, 2017 at 10:47:24AM -0400, Joey Iverson wrote:
> Dear GAP forum,
> 
> I was recently caught off guard by the following:
> 
> gap> Sqrt(2)<2;
> false
> 
> Now that I've read the manual more carefully, I don't think this is a
> malfunction. Instead, it looks like GAP will always report irrational
> cyclotomics to be larger than rationals.
> 
> Does anybody know of a workaround that compares real numbers with their
> usual ordering instead? Suppose we agree that E(n) = exp(2*pi*i/n).
> 
> As a last resort, I suppose I could run GAP inside of SAGE and get
> numerical approximations of everything, but I would like to avoid that if
> possible.
> 
> 
> Thanks for any advice!
> 
> Joey Iverson
> Research Associate
> University of Maryland, College Park

Dear Joey, dear Forum,

Comparisons of real cyclotomic numbers in the natural ordering of the reals
depend on the choice of embeddings of E(n) into the complex plane. 

The only way I know to decide if a real cyclotomic number is positive is
indeed by using numerical approximations. 

I have a small package 
    http://www.math.rwth-aachen.de/~Frank.Luebeck/gap/FUtil/
which can be used as a workaround. 
It contains a function 'HasPositiveRealPartCyc' which decides what its name
suggests. It uses numerical approximations and a simple interval arithmetic
and automatically enlarges precision if needed. The function assumes the
suggested embedding E(n) = exp(2*pi*i/n).


Best regards,
   Frank

-- 
///  Dr. Frank Lübeck, Lehrstuhl D für Mathematik, Pontdriesch 14/16,
\\\                    52062 Aachen, Germany
///  E-mail: Frank.Luebeck at Math.RWTH-Aachen.De
\\\  WWW:    http://www.math.rwth-aachen.de/~Frank.Luebeck/



More information about the Forum mailing list