unexpected behavior of simplify_sum



Hi,

I have the following test, with a sum depending on b2.
For general b2 simplify_sum gives an incorrect value.

Andre

------- test-simplify_sum-1.max -----------

display2d : false;

F(d,a1,k1,a2,k2,b2,l2) := block(

     [res:1],

     res : res/(b2-l2)!,
     res : res/l2!,
     res : res*(-1)^l2,

     res : res*(b2+l2+d-2)!,
     res : res/(l2+d-2)!,

     res : res*(k2+l2+d-2)!,
     res : res/(k2+l2+d-1+k1)!,

     return(res)

);

load("simplify_sum");

s:sum(F(d,1,1,1,1,b2,l2),l2,0,b2);
h : simplify_sum(s);
h : factor(minfactorial(h));

s:sum(F(d,1,1,1,1,2,l2),l2,0,2);
h : simplify_sum(s);
h : factor(minfactorial(h));

------- test-simplify_sum-1.max -----------

------- test-simplify_sum-1.txt -----------

Maxima 5.19.2 http://maxima.sourceforge.net
Using Lisp SBCL 1.0.40-1.fc14
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)                   batch(test-simplify_sum-1.max)

batching /home/user/progs/test-simplify_sum-1.max
(%i2)                          display2d : false
(%o2) false
(%i3) F(d,a1,k1,a2,k2,b2,l2):=block([res:1],res:res/(b2-l2)!,res:res/l2!,
         res:res*(-1)^l2,res:res*(-2+d+l2+b2)!,res:res/(-2+d+l2)!,
         res:res*(-2+d+l2+k2)!,res:res/(k1-1+d+l2+k2)!,return(res))
(%o3) F(d,a1,k1,a2,k2,b2,l2):=block([res:1],res:res/(b2-l2)!,res:res/l2!,
         res:res*(-1)^l2,res:res*(-2+d+l2+b2)!,res:res/(-2+d+l2)!,
         res:res*(-2+d+l2+k2)!,res:res/(k1-1+d+l2+k2)!,return(res))
(%i4) load("simplify_sum")
(%o4) 
"/home/user/opt/maxima/share/maxima/5.19.2/share/contrib/solve_rec/simplify_sum.mac"
(%i5) s:sum(F(d,1,1,1,1,b2,l2),l2,0,b2)
(%o5) 
'sum((-1)^l2*(l2+d-1)!*(l2+d+b2-2)!/((b2-l2)!*l2!*(l2+d-2)!*(l2+d+1)!),
            l2,0,b2)
(%i6) h:simplify_sum(s)
(%o6) 0
(%i7) h:factor(minfactorial(h))
(%o7) 0
(%i8) s:sum(F(d,1,1,1,1,2,l2),l2,0,2)
(%o8) (d+1)!*(d+2)!/(2*d!*(d+3)!)-d!*(d+1)!/((d-1)!*(d+2)!)
                                  +(d-1)!*d!/(2*(d-2)!*(d+1)!)
(%i9) h:simplify_sum(s)
(%o9) (d+1)!*(d+2)!/(2*d!*(d+3)!)-d!*(d+1)!/((d-1)!*(d+2)!)
                                  +(d-1)!*d!/(2*(d-2)!*(d+1)!)
(%i10) h:factor(minfactorial(h))
(%o10) -2/((d+1)*(d+2)*(d+3))
(%o10) "/home/user/progs/test-simplify_sum-1.max"

------- test-simplify_sum-1.txt -----------