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?
With the current implementation of series, I get:

>>> f = x + 5 * x**3
>>> coeffs = series(f, x, 0, n = None)
>>> for c in coeffs:
>>>     print str(c) + ", ",
x, 5 * x**3,

It would be nice to add a flag, e.g. include_nozero=True such that
>>> f = x + 5 * x**3
>>> coeffs = series(f, x, 0, n = None)
>>> for c in coeffs:
>>>     print str(c) + " + ",
0, x, 0, 5 * x**3,

Then I could simply divide each term by (x-x0)**k to get the actual 
coefficient...
Is there some other way to achieve this functionality easily? It would seem 
that under the hood the machinery to do all this would already be in 
place...
Thanks!

Nikolas



-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/SEjUGpqC0CsJ.
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.

Reply via email to