It seems that coeff() and ratcoef() have trouble
extracting coefficients from Taylor expansions
around infinity:
(%i119) taylor(1/x, x, inf, 1);
1
(%o119)/T/ - + . . .
x
(%i120) ratcoef(taylor(1/x, x, inf, 1), x, -1);
(%o120)/R/ 0
(%i121) coeff(taylor(1/x, x, inf, 1), x, -1);
(%o121)/R/ 0
A work-around is to get rid of the Taylor property, e.g., by wrapping the expression in subst(0, 0, ...).
Stavros Macrakis
2007-04-05
Logged In: YES
user_id=588346
Originator: NO
Yes, ratcoeff is a bit confused by taylor expansions at infinity:
qq: taylor(sum((i-3+100)*x^(i-3),i,0,5),x,inf,10)
=> 102*x^2+101*x+100+99/x+98/x^2+97/x^3 + ...
makelist(ratcoeff(qq,x,i),i,-3,4) =>
=> [0, 102, 101, 100, 99, 98, 97, 0]
In other words, it treats the 1/x^2 as the ratcoeff(...,x,2) term.
So the workaround is to negate the power... but of course that will become exactly wrong when the bug is fixed....
Robert Dodier
2007-06-29