On Nov 24, 5:55 pm, Julie <[email protected]> wrote: > I have a generating function programmed with two variables, for which > I wish to find the coefficients of each polynomial in the series > expansion, i.e. coefficiecnt of xy, x^2y, x^2y^2,... > > For example, using a simple function such as > f(x,y)=1/(2-x*y) > g(x,y)=f(x,y).series(x,4) > [results in g(x,y) = 1/8*x^2*y^2+1/4*x*y+1/2] > > I have found a way of obtaining the coefficients of x using: > u(x,y).coefficients() > or > u(x,y).coefficient(x^2) to give the coefficient of x^2 alone as y^2 > for example > > Is there a way to extend this argument to find the coefficients of > multivariate polynomials, e.g.x^2y^2? > I have tried u(x,y).coefficient(x^2*y^2), but thus gives an incorrect > answer of 0 (should be 1/8) > And u(x,y).coefficents() which simply lists coefficients of various > powers of x > > Thanks, > Julie
For example: sage: f(x,y)=1/(2-x*y) sage: g(x,y)=f(x,y).series(x,4) sage: g(x,y).polynomial(SR).coefficients() [1/16, 1/8, 1/4, 1/2] sage: g(x,y).polynomial(SR).coefficient([2,2]) 1/8 Andrzej Chrzeszczyk -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
