special-functions/gamma.ss
;;; PLT Scheme Science Collection
;;; special-functions/gamma.ss
;;; Copyright (c) 2004 M. Douglas Williams
;;;
;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public
;;; License as published by the Free Software Foundation; either
;;; version 2.1 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;; Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this library; if not, write to the Free
;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;; 02111-1307 USA.
;;;
;;; -------------------------------------------------------------------
;;;
;;; This is the module for the gamma, psi, and zeta special functions.
;;; They are provided as a single module to avoid circular module
;;; definitions.
;;;
;;; Version Date      Description
;;; 1.0.0   09/20/04  Marked as ready for Release 1.0.  Includes all of
;;;                   the gamma, psi, and zeta special functions for
;;;                   Release 1.0.  Added contracts for functions.
;;;                   (Doug Williams)
;;; 1.1.0  02/09/06   Added incomplete gamma functions.  (Doug Williams)

(module gamma mzscheme
  
  (require (lib "contract.ss"))
  
  (provide/contract
   ;; Gamma functions
   (gamma
    (-> real? real?))
   (lngamma
    (-> real? real?))
   (lngamma-sgn
    (-> real? (values real? (integer-in -1 1))))
   (gammainv
    (-> real? real?))
   (gammastar
    (-> (>/c 0.0) real?))
   (fact
    (-> natural-number/c (>=/c 1.0)))
   (lnfact
    (-> natural-number/c (>=/c 0.0)))
   (double-fact
    (-> natural-number/c (>=/c 1.0)))
   (lndouble-fact
    (-> natural-number/c (>=/c 0.0)))
   (choose
    (-> natural-number/c natural-number/c (>=/c 1.0)))
   (lnchoose
    (-> natural-number/c natural-number/c (>=/c 0.0)))
   ;; Incomplete Gamma functions
   (gamma-inc-Q
    (-> (>/c 0.0) (>=/c 0.0) real?))
   (gamma-inc-P
    (-> (>/c 0.0) (>=/c 0.0) real?))
   (gamma-inc
    (-> real? (>=/c 0.0) real?))
   ;; Psi functions
   (psi-int
    (-> natural-number/c real?))
   (psi
    (-> real? real?))
   (psi-1piy
    (-> real? real?))
   (psi-1-int
    (-> natural-number/c real?))
   (psi-1
    (-> real? real?))
   (psi-n
    (-> natural-number/c real? real?))
   ;; Zeta Functions
   (zeta-int
    (-> integer? real?))
   (zeta
    (-> real? real?))
   (zetam1-int
    (-> integer? real?))
   (zetam1
    (-> real? real?))
   (hzeta
    (-> (>/c 1.0) (>/c 0.0) real?))
   (eta-int
    (-> integer? real?))
   (eta
    (-> real? real?)))
  
  (require "../machine.ss")
  (require "../math.ss")
  (require "../chebyshev.ss")
  (require "error.ss")
  (require "exponential-integral.ss")
  
  (require (lib "include.ss"))
  
  (include "gamma-imp.ss")
  (include "gamma-inc-imp.ss")
  (include "psi-imp.ss")
  (include "zeta-imp.ss")
  
)