You could also use the coeff() method, like s = series(...) coeffs = [s.coeff(x, n) for n in range(10)]
I think in SymPy 0.7.1 or earlier, you have to use just coeff(x**n), which won't work for n == 0. Aaron Meurer On Wed, Sep 12, 2012 at 8:32 PM, Nikolas Tezak <[email protected]> wrote: > Hmm, I might be missing something, but it seems to me that that is not > addressing the particular point I asked about, namely that the current > behavior of the n=None lazy term generation does not yield 0 whenever there > is no contribution at a particular order. > > On Sep 13, 2012, at 11:15 AM, Chris Smith wrote: > >> On Thu, Sep 13, 2012 at 6:52 AM, nikolas <[email protected]> wrote: >>> Follow-up: I think I have found a way that works. >>> I guess if one is interested in expanding about 0, one can simply do >>>>>> f = x + 5 * x**3 >>>>>> coeffs = reversed(series(f, x, 0, n = 4).as_poly(x).all_coeffs()) >>>>>> list(coeffs) >>> [0, 1, 0, 5] >>> >>> So, to expand about x0!= 0, I can substitute x->x0 + x1 and expand in orders >>> of x1. >>> If this is a bad way to do it, please let me know! >> >> I wrote about this in the docstring of Expr.series, I believe. Try >> "help(Expr.series)". >> >> -- >> 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. >> > > -- > 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. > -- 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.
