What does Gosper_term ?
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/f_n$.
Let's take the provided examples:
- If f(n)=n then n.gosper_term(n) returns b(n)=1/2(n^2 - n)/n and if g(n)=f(n)b(n) then we indeed have f(n)=g(n+1)-g(n).
- If f(n)=nfactorial(n) then (nfactorial(n)).gosper_term(n) returns b(n)=1/n and if if g(n)=f(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 f(n).gosper_term(n) returns b(n) such that if g(n)=f(n)*b(n) then g(n+1)-g(n)=f(n)?
It looks like a bug. Please report at https://github.com/sagemath/sage/issues
Btw, if you have access to Maple (from within Sage), you can also use a more advanced Zeilberger's algorithm.