On Thu, Sep 13, 2012 at 6:27 AM, nikolas <[email protected]> wrote: > Hey guys, > > for a series expansion of some function f(x) about some point x0 up to order > n+1, I would like to easily generate the sequence of all coefficients. > I.e. if we have > > f(x) = a0 + a1 * (x-x0) + a2 * (x-x0)**2 + ... + an (x-x0)**n + O((x-x0)**n) > > is there a straightforward way to obtain a generator for the sequence a0, > a1, a2, ... an that includes the non-zero terms?
Part of the problem of including this in general is that in general the exponents need not be integers and if you got a list of coefficients, how would you know what terms they went with. >>> series(sqrt(x)/(x+sin(x)), x) 1/(2*x**(1/2)) + x**(3/2)/24 + x**(7/2)/720 - x**(11/2)/120960 + O(x**6) Above, the powers are -1/2+2*i for i in range(n). If one had a series object then one of its methods might be "coeffs" and such a method might first return (-1/2, 2) -- the first exponent and the step size -- followed by the coefficients, 1/2, 1/24, 1/720, -1/120960. But that seems a little complicated. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
