> > In [41]: (x/sin(x)).series(x, 0, 8) > > Out[41]: 1 + x**2/6 + 7*x**4/360 + 31*x**6/15120 + O(x**7) > > > How do I take the output from series extract the coefficient and use > > it via poly1d ala taylor in mpmath? > >>> (x/sin(x)).series(x, 0, 8) 1 + x**2/6 + 7*x**4/360 + 31*x**6/15120 + O(x**7) >>> _.as_independent(p.getO()) (1 + x**2/6 + 7*x**4/360 + 31*x**6/15120, O(x**7)) >>> Poly(_[0]).all_coeffs() [31/15120, 0, 7/360, 0, 1/6, 0, 1] >>> list(reversed(_)) [1, 0, 1/6, 0, 7/360, 0, 31/15120]
I'm not sure what order you need them in...if you need them from leading to constant, just don't reverse the all_coeffs() result. -- 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.
