                     /** Gamma function in B projections. **/

/*K: Euler Gamma function */
/*A: J Gottschalk */
/*S: University of Western Australia */
/*D: October 1984 */

/*U: This is an improvement over file XGammaV. If a variable, n say,
     is given the property Natp[n]:1 then the rules in XGammaV
     would rewrite this as (n-1)!. XGammaV checks the argument of
     the gamma function is a number to prevent this happening with 
     symbols. */
/* Contains rules for automatically reducing gamma functions of 
    integer and 1/2-integer arguments.
    Gamma[negative integer] is rewritten in terms of Gamma[0].
    The expressions are in terms of B projections. */
/*: SGammaVB
    sets any expression of the type exp/Gamma[0] to zero. It
    assumes exp is finite. */

/*P: XMSet is automatically loaded. */

If[~P[_XLoadonce[Loaded]],<XLoadonce]
Loadonce[XMSet]

SGammaVB : Gamma[0] -> 1/0

/* The first two definitions are for the reduction of terms such as
                                            Gamma[7/4] and Gamma[-14/3]. */
Gamma[$n_=$n>1         & Numbp[$n]] ::: B[Gamma[$n-1] ($n-1)]
Gamma[$n_=$n<0         & Numbp[$n]] ::: B[Gamma[$n+1]/$n]
Gamma[1]                             :  B[1]
Gamma[1/2]                           :  B[Sqrt[Pi]]
Gamma[-1/2]                          :  B[-2 Sqrt[Pi]]

/*B: There is a warning message included to correct a fault in XWarn */
Gamma[$n_=If[$n=0,Prh["Gamma[0] generated"]]] :: Gamma[$n]


_XGammaVB[Loaded] : 1

