## Gamma(n) = (n-1)!

Librairie C++ de calcul formel/ C++ symbolic computation library

lukamar
Messages : 294
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

### Gamma(n) = (n-1)!

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.

parisse
Messages : 5082
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

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

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.

lukamar
Messages : 294
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

### 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.

parisse
Messages : 5082
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

### 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.