I have further added some code to simpgamma to expand expressions like
gamma(n*z) and gamma(z+n) with n an integer. The expansion depends on a flag
$gammaexpand. Especially specint gives with this code not in all cases but often
a much more simple result.
Here are examples:
(%i25) gamma(2*z);
(%o25) 2^(2*z-1)*gamma(z)*gamma(z+1/2)/sqrt(%pi)
(%i26) gamma(z+1);
(%o26) z*gamma(z)
(%i27) gamma(z-1);
(%o27) -gamma(z)/(1-z)
(%i28) gamma(z+1)/gamma(z);
(%o28) z
An example with three Gamma functions which we get in results of specint. In
this case the Gamma functions vanish completely:
(%i29) factor(gamma(2*k)/gamma(k)/gamma((2*k+1)/2));
(%o29) 2^(2*k)/(2*sqrt(%pi))
Here is the code added to simpgamma:
((and $gammaexpand
(mtimesp j)
(integerp (cadr j))
(> (cadr j) 0))
;; Expand for multiple arguments:
;; gamma(n*z) and n a positive integer
(let ((n (cadr j))
(z (cons '(mtimes) (cddr j))))
(mul
(power n (add (mul n z) (div -1 2)))
(power (mul 2 '$%pi) (div (sub 1 n) 2))
(let ((index (gensumindex)))
(dosum
($gamma (add z (div index n)))
index 0 (sub n 1) nil)))))
((and $gammaexpand
(mplusp j)
(integerp (cadr j)))
;; gamma(z+n) or gamma(z-n) and n a positive integer
(let ((n (cadr j))
(z (cons '(mplus) (cddr j))))
(cond
((> n 0)
(mul ($pochhammer z n) ($gamma z)))
((< n 0)
(setq n (- n))
(div
(mul (power -1 n) ($gamma z))
($pochhammer (sub 1 z) n))))))
Dieter Kaiser