GosperSummationMethod(E, V, R, P, Q)

sum.spad line 53 [edit on github]

Gosper's summation algorithm.

GospersMethod: (Q, V, () -> V) -> Union(Q, failed)

GospersMethod(b, n, new) returns a rational function rf(n) such that a(n) * rf(n) is the indefinite sum of a(n) with respect to upward difference on n, i.e. a(n+1) * rf(n+1) - a(n) * rf(n) = a(n), where b(n) = a(n)/a(n-1) is a rational function. Returns “failed” if no such rational function rf(n) exists. Note: new is a nullary function returning a new V every time. The condition on a(n) is that a(n)/a(n-1) is a rational function of n.