ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 20 Dec 2017 08:44:55 -0600working with coefficients of formal serieshttp://ask.sagemath.org/question/40256/working-with-coefficients-of-formal-series/ I want to define a truncated series or polynomial of arbitrary degree and then work algebraically with the polynomial to solve for various quantities in terms of the coefficients. When I write something like
i,n,z=var('i,n,z')
c=function('c')
p=z^(-4)+sum(c(i)/z^i,i,0,2)
p
this returns
(z^2*c(0) + z*c(1) + c(2))/z^2 + 1/z^4
But if I try to define an arbitrary polynomial of this type
p(n)=z^(-2n) + sum(c(i)/z^i,i,0,2n-2)
p(2)
returns
z^4 + sum(z^(-i)*c(i), i, 0, 2)
What is the crucial difference here?
I had a similar problem when working with truncated power series over the ring `PowerSeriesRing(SR)`. I want to manipulate these expressions algebraically as elements of a ring then ask for info about certain coefficients. But working with formal sums and substituting values of n returns power series coefficients, e.g. the following expression as the coefficient of z^-4 (after some computations...f and g are symbolic functions)
1/4*(sum(z^i*f(i), i, 1, 3)*sum(z^i*g(i), i, 1, 3) + 2)^2 + sum(z^i*f(i), i, 1, 3)*sum(z^i*g(i), i, 1, 3)
How do I get sage to work with the series and also give info about the coefficients, i.e. multiply series expressions but then expand them out in z? I've tried `expand()` in this setting with mixed success.charleslebarronWed, 20 Dec 2017 08:44:55 -0600http://ask.sagemath.org/question/40256/