To evaluate a hypergeometric sum $$\sum_{n=1}^{N}f(n)$$ where $f(n+1)/f(n)$ is a rational fraction in $n$, it is useful to express $f(n)$ in the form $g(n+1)-g(n)$ and thus be able to construct a telescopic sum.
The Gosper algorithm allows this in some cases.
So, I am looking for a command that, given f(n) as an input returns g(n).
I thought gosper_term would do this based on the documentation
However, it seems that this command rather returns $g_n/a_n$.
Let's take the provided examples:
- If a(n)=n then n.gosper_term(n) returns b(n)=1/2(n^2 - n)/n and if g(n)=a(n)b(n) then we indeed have f(n)=g(n+1)-g(n).
- If a(n)=nfactorial(n) then (nfactorial(n)).gosper_term(n) returns b(n)=1/n and if if g(n)=a(n)*b(n) then we indeed have f(n)=g(n+1)-g(n).
- I tried f(h)=h4^h/((2h-1)^2(4h+1)(4h+3))binomial(2h,h)/binomial(4h,2h) and got the same conclusion.
Question. Can someone confirm that my intuition on a few examples is correct, i.e., that a(n).gosper_term(n) returns b(n) such that if f(n)=a(n)*b(n) then f(n+1)-f(n)=a(n)?