id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
17524 polynomial for relative number field elements Martin von Gagern "Consider the following field extensions:
{{{
sage: K. = QQ.extension([x^2 + x + 1, x^2 + 1])
sage: z3 + z4 + z3*z4
(z4 + 1)*z3 + z4
sage: (z3 + z4 + z3*z4).polynomial()
-3*x^3 - 5*x^2 - 13*x - 7
}}}
This comes as a surprise. Relative number field elements share the documentation for that method with absolute number field elements, and that documentation simply reads:
{{{
Return the underlying polynomial corresponding to this number field element.
}}}
It is accompanied by an example which is using an absolute number field. According to that documentation, I'd expect `(z4 + 1)*x + z4`, since the field in `z3` is the outer one and the one in `z4` is the inner one. Instead, the element is apparently described as a polynomial in the power basis `(z3 - z4)`. It took me quite a bit of reading source code (the `_repr_` method in particular) to figure out that what I had expected is actually possible, but the method for this is called `lift` not `polynomial`.
I think that at the very least, the documentation of `polynomial()` should be extended and clarified, to document the behavior for nested number fields. If the behavior I observed is in fact intended. If not, it might make sense to make `polynomial` equivalent to `lift` in that case, and perhaps even deprecate the latter in the long run.
For some applications it might be even more useful if there were a method to recursively turn the element into a multivariate polynomial, with the number field generator names as variable names. But if you prefer, I can suggest that in a separate ticket, once the rest of this one here has been resolved." defect new minor sage-6.5 number fields Jakob Kroeker N/A