;;; PLT Scheme Science Collection
;;; special-functions/gamma.ss
;;; Copyright (c) 2004-2007 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
;;; 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)
;;; 2.0.0  11/17/07   Added unchecked versions of functions and getting
;;;                   ready for PLT Scheme V4.0.  (Doug Williams)

(module gamma mzscheme
  (require (lib "contract.ss"))
   ;; Gamma functons
   (rename gamma unchecked-gamma)
   (rename lngamma unchecked-lngamma)
   (rename lngamma-sgn unchecked-lngamma-sgn)
   (rename gammainv unchecked-gammainv)
   (rename gamma* unchecked-gamma*)
   (rename gammastar unchecked-gammastar)
   (rename fact unchecked-fact)
   (rename lnfact unchecked-lnfact)
   (rename double-fact unchecked-double-fact)
   (rename lndouble-fact unchecked-lndouble-fact)
   (rename choose unchecked-choose)
   (rename lnchoose unchecked-lnchoose)
   ;; Incomplete Gamma functions
   (rename gamma-inc-Q unchecked-gamma-inc-Q)
   (rename gamma-inc-P unchecked-gamma-inc-P)
   (rename gamma-inc unchecked-gamma-inc)
   ;; Psi functions
   (rename psi-int unchecked-psi-int)
   (rename psi unchecked-psi)
   (rename psi-1piy unchecked-psi-1piy)
   (rename psi-1-int unchecked-psi-1-int)
   (rename psi-1 unchecked-psi-1)
   (rename psi-n unchecked-psi-n)
   ;; Zeta functions
   (rename zeta-int unchecked-zeta-int)
   (rename zeta unchecked-zeta)
   (rename zetam1-int unchecked-zetam1-int)
   (rename zetam1 unchecked-zetam1)
   (rename hzeta unchecked-hzeta)
   (rename eta-int unchecked-eta-int)
   (rename eta unchecked-eta))
   ;; Gamma functions
    (-> real? real?))
    (-> real? real?))
    (-> real? (values real? (integer-in -1 1))))
    (-> real? real?))
    (-> (>/c 0.0) real?))
    (-> (>/c 0.0) real?))
    (-> natural-number/c (>=/c 1.0)))
    (-> natural-number/c (>=/c 0.0)))
    (-> natural-number/c (>=/c 1.0)))
    (-> natural-number/c (>=/c 0.0)))
    (-> natural-number/c natural-number/c (>=/c 1.0)))
    (-> natural-number/c natural-number/c (>=/c 0.0)))
   ;; Incomplete Gamma functions
    (-> (>/c 0.0) (>=/c 0.0) real?))
    (-> (>/c 0.0) (>=/c 0.0) real?))
    (-> real? (>=/c 0.0) real?))
   ;; Psi functions
    (-> natural-number/c real?))
    (-> real? real?))
    (-> real? real?))
    (-> natural-number/c real?))
    (-> real? real?))
    (-> natural-number/c real? real?))
   ;; Zeta Functions
    (-> integer? real?))
    (-> real? real?))
    (-> integer? real?))
    (-> real? real?))
    (-> (>/c 1.0) (>/c 0.0) real?))
    (-> integer? real?))
    (-> 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")