On Wed, Jun 03, 2026 at 11:06:07PM +0200, Kurt Pagani wrote:
> addendum
>
> Shifting doesn't work either because of the preceding evals (k->k-1), so one
> might sum from 1..n and add eval(x,k,0). If a<0? Splitting and adding x(0)?
>
>
> a:=low segment s
> b:=high segment s
>
> if a=0 then
> eval(u::F, k, 1 + b) - eval(u::F, k, 1) + eval(x,k,0)
> else
> if a>0 then eval(u::F, k, 1 + b) - eval(u::F, k, a)
> -- else?
AFAICS there are two possible reasons for division by 0. One is
due to result from Gosper method. Namely in your case Gosper
method returns:
2 k + 2
-------
3
which after substitution is turned into 2*k/3. The result from
innersum is then 2*k/3*x1 where x1 is the input function shifted
by -1. Evaluating that for k = 0 gives 0/0 expression which leads
to division by 0. In principle result from Gosper method may have
zero at arbitrary point, so the correct method to discover this
kind of trouble is to look at numerator of result from Gosper
method, evaluate it a lower and upper bound and check for zeros.
But there is another possible trouble: evaluating input function
at upper or lower bound may also lead to division by 0. Input
may have pole at bound, in such case division by 0 is unavoidable.
But another case is when already input contains trouble similar to
the first case. That is rational part of input is supposed to
cancel with factorial or binomial part. AFAICS we need better
version of 'eval' to transform input (cancel zeros) first and
only evaluate after transformation.
--
Waldek Hebisch