Page 1 sur 1

Gamma(n) = (n-1)!

Publié : lun. juil. 08, 2019 10:47 am
par lukamar
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.

Re: Gamma(n) = (n-1)!

Publié : lun. juil. 08, 2019 7:13 pm
par parisse
The following change would do it:

Code : Tout sélectionner

diff usual.cc usual.cc~
7985,7986d7984
<     if (is_assumed_integer(x,contextptr))
<       return gammatofactorial(x,contextptr);
I don't know if this might have side effects.

Re: Gamma(n) = (n-1)!

Publié : lun. juil. 08, 2019 8:20 pm
par lukamar
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)!

Publié : mar. juil. 09, 2019 6:01 am
par parisse
I think I will give it a try. If there are side effects, then I'll add a user command for gammatofactorial.