The design choice made for p-adics and power series is that O(p^n) and O(x^n) behave similarly to zero in comparisons. All of
a.is_zero()
not a
a == a.parent().zero()
not (a != a.parent().zero()
answer True for O(p^n) or O(x^n)
sage: a = O(2^3)
sage: a.is_zero()
True
sage: a.is_zero() and not a and a == a.parent().zero() and not (a != a.parent().zero())
True
sage: R.<x> = PowerSeriesRing(QQ)
sage: a = O(x^3)
sage: a.is_zero() and not a and a == a.parent().zero() and not (a != a.parent().zero())
True
As a consequence, the generic implementation of uni-variate and multi-variate polynomials are broken on those rings (as it does remove terms whose coefficients are zero).
The design choice made for p-adics and power series is that
O(p^n)
andO(x^n)
behave similarly to zero in comparisons. All ofa.is_zero()
not a
a == a.parent().zero()
not (a != a.parent().zero()
answerTrue
forO(p^n)
orO(x^n)
As a consequence, the generic implementation of uni-variate and multi-variate polynomials are broken on those rings (as it does remove terms whose coefficients are zero).
Depends on #34000
Component: algebra
Issue created by migration from https://trac.sagemath.org/ticket/34024