Hi,

I have been working for some weeks on implementing generating functions in 
Sympy, mostly in the new submodule sympy.concrete.guess. The currently 
submitted version of my function guess_generating_function (which should be 
imported with the shorter alias ggf) now is able to detect six types of 
generating functions. I took the definition of these variants at 
https://oeis.org/wiki/Generating_functions.

However I don't use myself all these variants equally and I would be happy 
if someone could have a quick look at the examples below in order to be 
sure all results are consistent with the definitions from the previous 
link. For instance, I have the feeling that I don't understand l.g.f. 
(logarithmic generating function) exactly the same way as some contributors 
in the OEIS (online encyclopedia of integer sequences) though I think that 
these contributors call l.g.f. what I would have called h.l.g.f. but maybe 
I am wrong myself.

Here is the output of my function in some examples:

>>> from sympy.concrete.guess import guess_generating_function as ggf
>>> from sympy import fibonacci, lucas, factorial
>>> ggf([k+1 for k in range(12)])
{'egf': (x + 1)*exp(x),
 'hlgf': 1/(-x + 1),
 'lgdegf': (x + 2)/(x + 1),
 'lgdogf': 2/(-x + 1),
 'lgf': 1/(x + 1),
 'ogf': 1/(x**2 - 2*x + 1)}

>>> ggf([factorial(k) for k in range(12)])
{'egf': 1/(-x + 1), 'lgdegf': 1/(-x + 1)}

>>> ggf([1 for k in range(12)])
{'lgdogf': 1/(-x + 1), 'ogf': 1/(-x + 1)}

>>> ggf([(-1)**k for k in range(12)])
{'lgdogf': -1/(x + 1), 'ogf': 1/(x + 1)}

>>> ggf([(k+1)*(-1)**k for k in range(12)])
{'egf': (x - 1)*exp(-x),
 'hlgf': 1/(x + 1),
 'lgdegf': (x - 2)/(-x + 1),
 'lgdogf': -2/(x + 1),
 'lgf': 1/(-x + 1),
 'ogf': 1/(x**2 + 2*x + 1)}

>>> ggf([(k+1)**2 for k in range(12)])
{'egf': (x**2 + 3*x + 1)*exp(x),
 'hlgf': 1/(x**2 - 2*x + 1),
 'lgdegf': (x**2 + 5*x + 4)/(x**2 + 3*x + 1),
 'lgdogf': (2*x + 4)/(-x**2 + 1),
 'lgf': 1/(x**2 + 2*x + 1),
 'ogf': (x + 1)/(-x**3 + 3*x**2 - 3*x + 1)}

-- 
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/a0506a91-04ad-4dc7-94a9-19add2a35d3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to