# multivariable taylor series Anonymous

I know how to generate a multivairiable Taylor series and extract its coefficients. What I want to do is to extract all the terms where the exponents of the individual variables satisfy certain requirements.

So for instance, my function is f(x,y)=(1/(1-xy))(1/(1-xy^2))(1/(1-xy^3))(1-x*y^4))

What I want is all terms in the Taylor series such that the exponent on x is at most 10 and the exponent on y is at most 20. Ideas?

edit retag close merge delete

Sort by » oldest newest most voted

You can do this by leaving the Symbolic Ring and play with genuine polynomials:

sage: var('x y')
(x, y)
sage: f(x,y)=(1/(1-x*y))*(1/(1-x*y^2))*(1/(1-x*y^3))*(1-x*y^4)
sage: T = f.taylor((x,0), (y,0), 30).polynomial(QQ) ; T
x^15*y^15 + 2*x^14*y^16 + 2*x^13*y^17 + 2*x^12*y^18 + 2*x^11*y^19 + 2*x^10*y^20 + x^14*y^15 + x^13*y^16 + x^12*y^17 + x^11*y^18 + x^10*y^19 - x^9*y^20 - x^8*y^21 - x^7*y^22 + x^14*y^14 + 2*x^13*y^15 + 2*x^12*y^16 + 2*x^11*y^17 + 2*x^10*y^18 + x^9*y^19 + x^13*y^14 + x^12*y^15 + x^11*y^16 + x^10*y^17 + x^9*y^18 - x^8*y^19 - x^7*y^20 + x^13*y^13 + 2*x^12*y^14 + 2*x^11*y^15 + 2*x^10*y^16 + 2*x^9*y^17 + x^12*y^13 + x^11*y^14 + x^10*y^15 + x^9*y^16 - x^7*y^18 - x^6*y^19 + x^12*y^12 + 2*x^11*y^13 + 2*x^10*y^14 + 2*x^9*y^15 + 2*x^8*y^16 + x^11*y^12 + x^10*y^13 + x^9*y^14 + x^8*y^15 - x^7*y^16 - x^6*y^17 + x^11*y^11 + 2*x^10*y^12 + 2*x^9*y^13 + 2*x^8*y^14 + x^7*y^15 + x^10*y^11 + x^9*y^12 + x^8*y^13 + x^7*y^14 - x^6*y^15 - x^5*y^16 + x^10*y^10 + 2*x^9*y^11 + 2*x^8*y^12 + 2*x^7*y^13 + x^9*y^10 + x^8*y^11 + x^7*y^12 - x^5*y^14 + x^9*y^9 + 2*x^8*y^10 + 2*x^7*y^11 + 2*x^6*y^12 + x^8*y^9 + x^7*y^10 + x^6*y^11 - x^5*y^12 - x^4*y^13 + x^8*y^8 + 2*x^7*y^9 + 2*x^6*y^10 + x^5*y^11 + x^7*y^8 + x^6*y^9 + x^5*y^10 - x^4*y^11 + x^7*y^7 + 2*x^6*y^8 + 2*x^5*y^9 + x^6*y^7 + x^5*y^8 - x^3*y^10 + x^6*y^6 + 2*x^5*y^7 + 2*x^4*y^8 + x^5*y^6 + x^4*y^7 - x^3*y^8 + x^5*y^5 + 2*x^4*y^6 + x^3*y^7 + x^4*y^5 + x^3*y^6 - x^2*y^7 + x^4*y^4 + 2 ...
more

This is the best I can think of:

for t in f.taylor((x,0), (y,0), 30).iterator():
if t.degree(x) <= 10 and t.degree(y) <= 20:
print t

more