Ask Your Question

Revision history [back]

The output of L_L.series(s, 2*n+2) is erroneous because of the division by s^2, which causes some trouble at s=0. You have to simplify the expression of L_L, via simplify_full(), prior to the call to series. Then you will get a correct result:

sage: L_L = L_L.simplify_full()
sage: L_L.series(s, 2*n+2)
3/2 + (-3/4)*s + 5/16*s^2 + (-29/240)*s^3 + 263/5760*s^4 + (-4157/241920)*s^5 + Order(s^6)
sage: taylor(L_L, s, 0, 2*n+2)
93881/14515200*s^6 - 4157/241920*s^5 + 263/5760*s^4 - 29/240*s^3 + 5/16*s^2 - 3/4*s + 3/2

The output of L_L.series(s, 2*n+2) is erroneous because of the division by s^2, which causes some trouble at s=0. You have to simplify the expression of L_L, via simplify_full(), prior to the call to series. Then you will get a correct result:

sage: L_L = L_L.simplify_full()
sage: L_L.series(s, 2*n+2)
3/2 + (-3/4)*s + 5/16*s^2 + (-29/240)*s^3 + 263/5760*s^4 + (-4157/241920)*s^5 + Order(s^6)
sage: taylor(L_L, s, 0, 2*n+2)
93881/14515200*s^6 - 4157/241920*s^5 + 263/5760*s^4 - 29/240*s^3 + 5/16*s^2 - 3/4*s + 3/2

On general grounds, it is usually preferable to simplify an expression before manipulating it.