1 | initial version |
I do not know which version of Sage you have, but for me (i am using the latest develop banch), there is no expand
method for such power series:
sage: R.<x, y> = PowerSeriesRing(QQ, default_prec = 20)
....: f = x^3 + x*y^2
....: j = f(x, f(x, f(x, f(x, f(x,y))))).expand()
AttributeError: 'MPowerSeriesRing_generic_with_category.element_class' object has no attribute 'expand'
You can simply write:
sage: R.<x, y> = PowerSeriesRing(QQ, default_prec = 20)
....: f = x^3 + x*y^2
....: j = f(x, f(x, f(x, f(x, f(x,y)))))
....: j
x^3 + x^7 + 2*x^11 + 5*x^15 + 14*x^19 + 16*x^17*y^2 + 8*x^15*y^4 + 26*x^23 + 48*x^21*y^2 + 40*x^19*y^4 + 16*x^17*y^6 + 4*x^15*y^8 + 44*x^27 + 112*x^25*y^2 + 120*x^23*y^4 + 64*x^21*y^6 + 16*x^19*y^8 + 69*x^31 + 240*x^29*y^2 + 360*x^27*y^4 + 304*x^25*y^6 + 156*x^23*y^8 + 48*x^21*y^10 + 8*x^19*y^12 + 94*x^35 + 416*x^33*y^2 + 784*x^31*y^4 + 832*x^29*y^6 + 560*x^27*y^8 + 256*x^25*y^10 + 80*x^23*y^12 + 16*x^21*y^14 + 2*x^19*y^16 + 114*x^39 + 640*x^37*y^2 + 1536*x^35*y^4 + 2048*x^33*y^6 + 1648*x^31*y^8 + 816*x^29*y^10 + 248*x^27*y^12 + 48*x^25*y^14 + 6*x^23*y^16 + 116*x^43 + 816*x^41*y^2 + 2520*x^39*y^4 + 4480*x^37*y^6 + 5040*x^35*y^8 + 3696*x^33*y^10 + 1736*x^31*y^12 + 480*x^29*y^14 + 60*x^27*y^16 + 94*x^47 + 800*x^45*y^2 + 3040*x^43*y^4 + 6800*x^41*y^6 + 9940*x^39*y^8 + 9968*x^37*y^10 + 7000*x^35*y^12 + 3440*x^33*y^14 + 1150*x^31*y^16 + 240*x^29*y^18 + 24*x^27*y^20 + 60*x^51 + 608*x^49*y^2 + 2784*x^47*y^4 + 7600*x^45*y^6 + 13740*x^43*y^8 + 17280*x^41*y^10 + 15456*x^39*y^12 + 9888*x^37*y^14 + 4500*x^35*y^16 + 1440*x^33*y^18 + 320*x^31*y^20 + 48*x^29*y^22 + 4*x^27*y^24 + 28*x^55 + 336*x^53*y^2 + 1848*x^51*y^4 + 6160*x^49*y^6 + 13860*x^47*y^8 + 22176*x^45*y^10 + 25872*x^43*y^12 + 22176*x^41*y^14 + 13860*x^39*y^16 + 6160*x^37*y^18 + 1848*x^35*y^20 + 336*x^33*y^22 + 28*x^31*y^24 + 8*x^59 + 112*x^57*y^2 + 728*x^55*y^4 + 2912*x^53*y^6 + 8008*x^51*y^8 + 16016*x^49*y^10 + 24024*x^47*y^12 + 27456*x^45*y^14 + 24024*x^43*y^16 + 16016*x^41*y^18 + 8008*x^39*y^20 + 2912*x^37*y^22 + 728*x^35*y^24 + 112*x^33*y^26 + 8*x^31*y^28 + x^63 + 16*x^61*y^2 + 120*x^59*y^4 + 560*x^57*y^6 + 1820*x^55*y^8 + 4368*x^53*y^10 + 8008*x^51*y^12 + 11440*x^49*y^14 + 12870*x^47*y^16 + 11440*x^45*y^18 + 8008*x^43*y^20 + 4368*x^41*y^22 + 1820*x^39*y^24 + 560*x^37*y^26 + 120*x^35*y^28 + 16*x^33*y^30 + x^31*y^32
Now, if you want to set y
to zero, you can do:
sage: j(x,0)
x^3 + x^7 + 2*x^11 + 5*x^15 + 14*x^19 + 26*x^23 + 44*x^27 + 69*x^31 + 94*x^35 + 114*x^39 + 116*x^43 + 94*x^47 + 60*x^51 + 28*x^55 + 8*x^59 + x^63
Or,
sage: j.substitute(y=0)
x^3 + x^7 + 2*x^11 + 5*x^15 + 14*x^19 + 26*x^23 + 44*x^27 + 69*x^31 + 94*x^35 + 114*x^39 + 116*x^43 + 94*x^47 + 60*x^51 + 28*x^55 + 8*x^59 + x^63