Two days ago I was trying to expand in series a lot of functions… so I ask myself, Could it be done in SAGE? It should be possible… but, How? 😛
So I ask on google group.
Solution by Andrzej Chrzeszczyk
sage: var('r'); sage: f=2*r/sinh(2*r) sage: f.taylor(r,0,5) 14/45*r^4 - 2/3*r^2 + 1 sage: maxima(f).powerseries('r',0) -4*r*'sum((2^(2*i2-1)-1)*2^(2*i2-1)*bern(2*i2)*r^(2*i2-1)/ (2*i2)!,i2,0,inf)
This solution uses a power series expansion from maxima… really nice feature! Isn’t it?
Ah… and this expansion is around .
If one would like the asymptotic expansion ,
sage: maxima(f).powerseries('r',infinity) -4*r*'sum((2^(2*i3-1)-1)*2^(2*i3-1)*bern(2*i3)*r^(2*i3-1)/ (2*i3)!,i3,0,inf)
However, note that this expansion coincides with the previous one, i.e., it’s the function itself. It couldn’t be that perfect. 😉
Solution by Francois Maltey
Use the Taylor command of SAGE,
sage: taylor (2*x/sinh(2*x), x, 0, 10) -292/13365*x^10 + 254/4725*x^8 - 124/945*x^6 + 14/45*x^4 - 2/3*x^2 + 1
sage: taylor (2*1/x/((exp(2/x)-exp(-2/x))/2), x, 0, 12) 4*e^(-10/x)/x + 4*e^(-6/x)/x + 4*e^(-2/x)/x
Thank you guys!
Enjoy!
Dox