# Bug in series expansion?

I'm trying to expand $(q + 1)/(q - 3)$ at $q=\infty$. This doesn't work:

sage: f=(q + 1)/(q - 3)
sage: f.series(q==infinity,3)
Order(-Infinity)


This also doesn't:

sage: f.subs(q==1/q).series(q==0,3).subs(q==1/q)
-1/2/q - 1/2


(the value is wrong, it should be 1 as $q$ goes to infinity, not $-1/2$).

This works:

sage: f.subs(q==1/q).simplify_rational().series(q==0,3).subs(q==1/q)
4/q + 12/q^2 + 1


But is not very friendly. Any ideas?

edit retag close merge delete

Sort by » oldest newest most voted

sage: var("q")
q
sage: f(q)=(q+1)/(q-3);f
q |--> (q + 1)/(q - 3)
sage: f.maxima_methods().powerseries(q,oo)
4*sum(3^(i1 - 1)/q^i1, i1, 0, +Infinity) - 1/3

more

That's not what had in mind (an infinite sum), but using your approach this does work:

sage: f.maxima_methods().taylor(q,oo,2)

4/q + 12/q^2 + 1

After playing with it a bit more, I realized that sage has this too:

sage: f.taylor(q,oo,2)
4/q + 12/q^2 + 1


So I consider the case closed (except for that fact that series should have done the same?)