Open ThomasBreuer opened 5 years ago
Pinging @hulpke
One naive solution to this is to force the denominator to have lead coefficient 1 (in the monomial case: with respect to whatever monomial order is convenient, e.g. the one used for storage / printing).
For rational coefficients, one could get "nicer" results (subjectively, at least) by changing numerator and denominator into products of a primitive integral polynomials times a coefficient; then one can cancel those coefficients. Alas, I don't quite see how to generalize that to arbitrary coefficients, so it might be better to go with the simpler approach above.
@fingolfin
It is intended insofar as rational functions were assumed to not require a PID that would allow for cancellation of common factors, thus no coefficient cancellation is attempted. This even has effects such as -x/(-x-1);
.
Presumably the way to clear this up would be to allow for optional cancellation, depending on the coefficient ring.
The following happens in the master branch as well as in released versions of GAP.
These results are of course correct, but is this behavior intended? I have examples where a rational function is constructed as a sum of many inverses of monomials, and where huge integer coefficients arise in numerator and denominator, which essentially cancel out.