rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

simplify_sum leaking an arbitrary constant #3039

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:36:39 Created by nbruin on 2018-10-02 17:54:29 Original: https://sourceforge.net/p/maxima/bugs/3469


The following seems to be a problem with simplify_sum:

Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp SBCL 1.4.2-1.fc27
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load(simplify_sum);
(%o1)      /usr/share/maxima/5.41.0/share/solve_rec/simplify_sum.mac
(%i2) display2d:false;

(%o2) false
(%i3) simplify_sum(sum(factorial(l-1)*binomial(n,l), l, 3, n));

(%o3) %k[3]*n^2-%k[3]*n

It looks like the %k[3] constant is something that escapes from the linear recurrence solver or so.

Found in sage:

https://trac.sagemath.org/ticket/26375

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:36:40 Created by robert_dodier on 2019-02-07 06:48:57 Original: https://sourceforge.net/p/maxima/bugs/3469/#6621


rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:36:44 Created by robert_dodier on 2019-02-07 06:48:58 Original: https://sourceforge.net/p/maxima/bugs/3469/#c23c


The leaking %k[3] comes from the solve_rec function. After looking at it for a few minutes, my first guess is that simplify_sum has supplied only 2 initial conditions to solve_rec, but 3 are needed by solve_rec_ic1 in order to eliminate all three arbitrary constants which are introduced by hyper_poly (called from solve_rec).

So there is some interaction between solve_rec and simplify_sum, but at this point I think the problem is in simplify_sum.