[GAP Forum] Real field
Alexander Hulpke
hulpke at math.colostate.edu
Tue Aug 7 18:46:51 BST 2007
Dear Mathieu, Dear Forum,
> But the main problem is not there. I have my existing
> software for polyhedral computations of polytope defined over
> the rational numbers. I want to work with 600-cell, 120-cell
> whose vertices are defined over Q(Sqrt(5)) preferably without
> having to modify the code.
>
> The question is on the structure of GAP itself. Is it possible
> to redefine the ">" test so that it is the natural order
> of the real field, which is used, when comparing two elements
> of Q(Sqrt(5)) ?
In the current form alas no. The `<' comparison for cyclotomics is
handled in the kernel before it ever gets to the \< operation in the
library. Thus, short of rewriting the kernel you are stuck with the
code as-is. (The reason the comparison between cyclotomics does not
respect the real numbers is that this actually rather delicate to do
if you want to do it in full generality.)
You could get around this by creating new ``wrapper'' objects that
simply embed a cyclotomic but this will substantially increase memory
use and decrease arithmetic performance.
What I would do is (as annoying as it looks) to use your own function
for the comparison and replace < and > (i.e. <> and not <) with it.
(As your field is just Q(sqrt(5)) it is easy to get rational part and
ER(5)-part and use squaring to reduce to a rational comparison.)
What this unfortunately cannot resolve is if you are using other
peoples code (or library code) which should use the new ordering.
Sorry to not being able to offer a better solution.
Alexander
More information about the Forum
mailing list