There are much more efficient tools in sympy/polys/ring_series.py that
could in principle replace series but are more limited in the expressions
they support.
For example, this function is the reciprocal of a polynomial. Introducing
this polynomial (called g) and calling rs_series_inversion yields the
answer at once (683772*t**783):
from sympy import *
from sympy.polys.ring_series import rs_series_inversion
R, t = ring('t', QQ)
g = (1-t) * (1-t**5) * (1-t**10) * (1-t**25) * (1-t**50) * (1-t**100)
rs_series_inversion(g, t, 784)
Well, it took a bit of time, measured with timeit at 654ms. But that's
nothing compared to series which took 28.8 seconds.
To get the specific coefficient, one can use
rs_series_inversion(g, t, 784).coeff(t**783)
On Friday, February 16, 2018 at 8:50:46 PM UTC-5, Chris Smith wrote:
>
> Just out of curiosity, do we have anything to generate the coefficients of
> terms of a rational function's Taylors series? I read the wiki (
> https://en.wikipedia.org/wiki/Rational_function) on the "method of
> generating functions" but that seems to be pretty significant computation
> for this particular problem. I was able to compute the term with the series
> (as Belkiss indicated) but is there a better way?
>
> On Monday, February 12, 2018 at 2:09:05 AM UTC-6, Kalevi Suominen wrote:
>>
>>
>>
>> On Monday, February 12, 2018 at 9:56:16 AM UTC+2, Belkiss Anane wrote:
>>>
>>> Hello! I have SymPy on my computer but it crashed and I'm using someone
>>> else's to do some math problems. Unfortunately, the online SymPy times out
>>> really fast. Can someone run these commands for me please?
>>>
>>> from sympy import *
>>> t = Symbol('t')
>>> f = 1 / ((1-t) * (1-t**5) * (1-t**10) * (1-t**25) * (1-t**50) * (1-t**100))
>>> f.series(t,0,784)
>>>
>>>
>>> I am just looking for the coefficient of t**783!
>>>
>>>
>>> Thank you very much, you'll be saving my night!
>>>
>>>
>> I get 683772⋅t^783, but I have not checked that for correctness.
>>
>> Kalevi Suominen
>>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/dfd49285-8ab1-4176-9522-7e1a3c4277bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.