Ask Your Question

# 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.

edit retag close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

Use p.subs({x:x**2}) rather than p.subs(x=x**2).

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2021-11-08 11:30:20 +0200

Seen: 164 times

Last updated: Nov 09 '21