Hello,
Giac does some simplifications of sin(n*pi) and cos(n*pi) after assume(n,integer). I propose a similar simplification for the gamma function, i.e. that Gamma(n) returns (n-1)! when n is a symbol assumed to be a positive integer. Something similar could also be done with the Beta function, as Beta(m,n)=(m-1)!*(n-1)!/(m+n-1)! for positive integers m and n.
Gamma(n) = (n-1)!
Modérateur : xcasadmin
Re: Gamma(n) = (n-1)!
The following change would do it:
I don't know if this might have side effects.
Code : Tout sélectionner
diff usual.cc usual.cc~
7985,7986d7984
< if (is_assumed_integer(x,contextptr))
< return gammatofactorial(x,contextptr);
Re: Gamma(n) = (n-1)!
Thanks for the code, it's really a simple solution, but I do not know about possible side effects either. Perhaps it's better to leave the simplification to individual commands than doing it automatically.
Re: Gamma(n) = (n-1)!
I think I will give it a try. If there are side effects, then I'll add a user command for gammatofactorial.