Re: Converting a symbolic expression to a power series and substituting another power series

106 views
Skip to first unread message

Volker Braun

unread,
Jan 14, 2013, 7:28:00 AM1/14/13
to sage-s...@googlegroups.com
Reusing variable names is generally a recipe for confusion:

R.<x1,x2>=PowerSeriesRing(SR)
P.<x1,x2>=PolynomialRing(QQ)

Now R and P have variables that print as "x1" and "x2", but of course they are still different variables. Now compare

sage: f   
x1*x2 + O(x1, x2)^3
sage: f[2]    # the degree-2 part in the power series variables
x1*x2

sage: f2
x1*x2 + O(x1, x2)^3
sage: f2[0]    # the degree-0 part in the power series variables
x1*x2


marco nijmeijer

unread,
Jan 14, 2013, 4:39:00 PM1/14/13
to sage-s...@googlegroups.com
Thank you. That is a  good point although I still do not see how it solves the issue. Suppose I define f_symb as

f_symb
(t1,t2)=t1*t2

to avoid the confusion of using identical variable-names meaning different things, what would I have to do to convert f_symb to f such that I can do the substitution? Help is much appreciated.

Volker Braun

unread,
Jan 14, 2013, 5:09:00 PM1/14/13
to sage-s...@googlegroups.com
You can't substitute power series into the symbolic ring, since power series are not objects of the symbolic ring. It just doesn't make sense in general.

You can substitute power series into polynomials; This also makes mathematical sense:

sage: f_symb
(t1, t2) |--> t1*t2
sage: f_symb.polynomial(QQ)
t1*t2
sage: _.parent()
Multivariate Polynomial Ring in t1, t2 over Rational Field
sage: f_symb.polynomial(QQ).subs(t1=x1, t2=x2)
x1*x2

marco nijmeijer

unread,
Jan 17, 2013, 5:06:54 PM1/17/13
to sage-s...@googlegroups.com
Thank you, that takes me  a step further. If I formulate the solution for my self I would say: take the symbolic expression, turn it into a polynomial by the method 'polynomial', then turn it into a power series by the proper substitution. That solves my original problem. It is nice to talk to someone about these things!

Hopefully I am allowed to ask a next question regarding dealing with power series. Suppose I have a power series in x1 and x2: f=x1*x2+O(x^3). If I substitute x1=y^2 and x2=y^2 I turn this into a power series in y: g(y) =y^4+O(y^6).  Doing this in Sage in the following way:

R.<x1,x2>=PowerSeriesRing(SR)
Y
.<y>=PowerSeriesRing(SR)

f
= x1*x2+R.O(3)

g
=f.substitute(x1=y^2,x2=y^2);g
O(y^3)

does not work. Is there a way to make Sage understand that O(x^2)  becomes O(y^6) under the substitution x=y^2 (and in general under similar substitutions)?

Reply all
Reply to author
Forward
0 new messages