Ask Your Question
1

Substituting vars of PowerSeries over RR

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

david-berghaus gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-11-09 19:26:15 +0200

Max Alekseyev gravatar image

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

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

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

Seen: 60 times

Last updated: Nov 09 '21