Simplification and equality testing are *exact* operations as they work by distinctly specifying the roots of a minimal polynomial. Two algebraic numbers are distinct if their minimal polynomials are distinct. If their minimal polynomials are equal, then they can only be equal if they are the same in a small set of distinct roots, which can be exactly distinguished by calculating the smallest distance between roots (this is AlgebraicNumber.prec). I'm not sure what you mean by nonrigorous numerical approximations.
The worst-case scenario would be if the minimal polynomial had two roots that were too close for the root-finding procedure to distinguish. If this happens in practice though, because of the restriction of polynomial coefficients to integers, you'd be dealing with a very, very complex polynomial, and at that point you'd have more problems (it's likely that + and * would exhaust system memory or at least take a *very* long time to process). It's also not guaranteed that the composed_sum and composed_product will always return the correct answer. Not because the calculation is approximate (it's not) but because it's possible that there could be bugs in my implementation. If you find a bug please let me know on the github repo. On Thursday, July 14, 2016 at 2:16:42 AM UTC+12, Fredrik Johansson wrote: > > > > On Wednesday, July 13, 2016 at 2:21:18 AM UTC+2, Alireza Nejati wrote: >> >> Ever wanted to do exact arithmetic, geometry, and so on? Well now you can: >> >> https://github.com/anj1/AlgebraicNumbers.jl >> > > Looks nice, though it appears that equality testing and simplification > uses nonrigorous numerical approximations. We want to have an > implementation of the field of algebraic numbers in Nemo, with interval > arithmetic in the underlying comparisons to guarantee correctness. The > necessary tools should be available already (including certified complex > root isolation), modulo some wrapping. SageMath has an implementation of > algebraic numbers (QQbar) that works similarly. > > Fredrik >
