Hypergeometric sum



I was reading sage-support list archives this weekend and I noticed this post:

http://groups.google.si/group/sage-support/browse_thread/thread/f1e45fd258d3724c#

It is about the sum

  Sum[Binomial[n, k]/Binomial[2 n, k]/k! (2 x)^k, {k, 0, n}]

or equivalent sum

  sum((2^k*binomial(n,k)*x^k)/(k!*binomial(2*n,k)),k,0,inf)

(I changes the upper bound to inf, this is ok because of binomial(n,k)).

When n in a positive integer, maxima gives a wrong result:

(%i1) sum(binomial(n, k)/binomial(2*n, k)/k!*(2*x)^k, k, 0, inf)$
(%i2) simplify_sum(%);
Is  n   positive, negative, or zero? pos;
Is  x   zero or nonzero? nonzero;
(%o2) (gamma(-(2*n-1)/2)*bessel_i(-(2*n+1)/2,x)*x^(n+1/2)*%e^x)/(sqrt(2)*4^(n/2))

The answer comes from

(%i3) ratsimp(hgfred([-n],[-2*n],2*x));
Is  x   zero or nonzero? nonzero;
(%o3) (gamma(-(2*n-1)/2)*bessel_i(-(2*n+1)/2,x)*x^(n+1/2)*%e^x)/(sqrt(2)*4^(n/2))

I have a patch which gives correct result when n is declared integer:

(%i4) declare(n, integer)$
(%i5) simplify_sum(%o1);
Is  n   positive, negative, or zero? pos;
(%o5) -gen_laguerre(n,-2*n-1,2*x)/binomial(2*n,n)
(%i6) ratsimp(hgfred([-n],[-2*n],2*x));
Is  n   positive, negative, or zero? pos;
(%o6) -gen_laguerre(n,-2*n-1,2*x)/binomial(2*n,n)

Which is I think correct.

Should I commit this patch?

Index: hyp.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/hyp.lisp,v
retrieving revision 1.91
diff -r1.91 hyp.lisp
2400,2403c2400,2409
< 	   (let ((z (div var 2)))
< 	     (mul (power '$%e z)
< 		  (bestrig (add a (inv 2))
< 			   (div (mul z z) 4)))))
---
> 	   ;;
> 	   ;; If n is a negative integer, we use laguerre polynomial.
> 	   (if (and (maxima-integerp a)
> 		    (eq (asksign a) '$negative))
> 	       (let ((n (m- a)))
> 		 (mul -1 (inv (mbinom (m+ n n) n)) (lagpol n (m- c 1) var)))
> 	       (let ((z (div var 2)))
> 		 (mul (power '$%e z)
> 		      (bestrig (add a (inv 2))
> 			       (div (mul z z) 4))))))

-- 
Andrej