# Valuation error when composing power series

I'm trying to work with power series with coefficients in a ring consisting of elements $f/g$, where $f$ is a polynomial in several variables over the integers and g is a polynomial in one of those variables with unit constant coefficient. Ultimately, I'd like to be able to do all of the following:

• Compose power series over this ring
• Invert single-variable power series over this ring whose degree-1 coefficients are units
• Reduce the coefficients of a power series modulo some ideal of the ring

I thought I would do this by starting with the Laurent series over $\mathbf{Z}$ in the variable that occurs in the denominator, constructing a polynomial ring over this by adjoining the other variables, and letting my power series take coefficients in this ring. But I'm getting an error I don't understand when I try to compose series. The following example illustrates the problem:

M1.<b> = LaurentSeriesRing(ZZ)
M.<a,c> = PolynomialRing(M1)
R.<t1,t2> = PowerSeriesRing(M)
X = t1 + t2 + O(t1,t2)^3
R1.<t> = PowerSeriesRing(M)
f = X(t,t^2); f


This returns the type error Substitution defined only for elements of positive valuation, unless self has infinite precision despite the fact that replacing the last line by t.valuation() or (t^2).valuation() returns 1 or 2, respectively.

The problem seems to result from a combination of factors. If I replace the second line with either

M.<a,c> = PolynomialRing(ZZ)


or

M.<a> = PolynomialRing(M1)


the error vanishes and the code returns the expected t + t^2 + O(t)^3. It also gives no error if I define R and R1 to be polynomial rings, rather than power series rings, over M (and correspondingly delete the big-O notation).

Any ideas about what is triggering the error, or another way to construct these power series?

edit retag close merge delete

Sort by ยป oldest newest most voted

Looking at the source of sage.rings.multi_power_series_ring_element.MPowerSeries.__call__ we find that Sage is parsing the arguments to X incorrectly. Namely it first tries to cast each argument to an element of X.parent() which is R. When doing this with t we would expect it to fail. There is no natural way in which t is an element of R, right? But according to Sage, there is:

sage: R(t)
b


I can only guess that it somehow finds a power series parent object (underlying R) which has a single generator, and maps to it. Furthermore:

sage: R(t).valuation()
0


This explains the error, and why the replacements succeed in removing the error: in those cases there is no power series parent object with a single generator underlying R which we can map t to:

sage: R(t)
....
TypeError: Cannot coerce input to polynomial ring.


In this case, X(t,t^2) evaluates correctly to X._subs_formal(t,t^2) which gives the result you want.

So a workaround is to call X._subs_formal(t,t^2) directly to avoid the faulty argument parsing.

This could also be reported as a bug. Maybe _subs_formal should be made public (with documentation).

more