Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Substituting vars of PowerSeries over RR

What is the intended way to substitute variables of PowerSeries (or equivalently LaurentSeries) over RR? The following code does not produce the correct result:

sage: P.<x> = PowerSeriesRing(RR)
sage: p = x**2+2*x+3
sage: p.subs(x=x**2)
3.00000000000000 + 2.00000000000000*x + 1.00000000000000*x^2

In ZZ, the previous example works correctly:

sage: P.<x> = PowerSeriesRing(ZZ)
sage: p = x**2+2*x+3
sage: p.subs(x=x**2)
3 + 2*x^2 + x^4

Working with PolynomialRings over RR also seems to work correctly, I do however need to work with negative exponents (i.e., LaurentSeries) and therefore cannot easily convert my expressions to polynomials before substituting.