Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What is the expectation?

Default precision has an other sense here... For instance:

sage: R.<q>=LaurentSeriesRing(QQ, default_prec=10)
sage: R(q^100)
q^100
sage: R(q^100)/R(1+q)
q^100 - q^101 + q^102 - q^103 + q^104 - q^105 + q^106 - q^107 + q^108 - q^109 + O(q^110)
sage: R(q^-100)/R(1+q)
q^-100 - q^-99 + q^-98 - q^-97 + q^-96 - q^-95 + q^-94 - q^-93 + q^-92 - q^-91 + O(q^-90)

The word default precision tells just how many significant terms should be computed and shown. It is not about an ideal, computations may show O(q^110) . Which is not O(q^10).

The initialization of an element of the ring is an other story, and sage assume the user knows what makes sense, and what not.

So q^2 + O(q) simply makes no sense. The error ValueError: prec (= -1) must be non-negative is telling enough. Same for q^2017 + O(q) where the error is of course ValueError: prec (= -2016) must be non-negative.