Revision 795 branches/replacement/src/linad99/dfgammp.cpp
dfgammp.cpp (revision 795)  

4  4 
* Author: David Fournier 
5  5 
* Copyright (c) 2009 ADMB Foundation 
6  6 
*/ 
7  
8 
/** 

9 
* \file 

10 
* This file deals with the Incomplete Gamma Functions 

11 
* of variable types. All supporting mathematical functions 

12 
* required to compute the Inmomplete Gamma Function 

13 
* are included. They being: gamma function, log gamma, 

14 
* and some polynomial evaluation functions. 

15 
*/ 

16  
7  17 
#if defined(USE_LAPLACE) 
8  18 
# include <df1b2fun.h> 
9  19 
#else 
10  20 
# include <fvar.hpp> 
11  21 
#endif 
12 
#define ITMAX 100 

13 
#define EPS 1.0e9 

14 
//#define EPS 3.0e7 

15 
#define FPMIN 1.0e30 

16  22  
17  23 
double get_values(double x,double y,int print_switch); 
18  24 
dvariable igam(const dvariable & _a, const dvariable & _x); 
19  25 
dvariable igamc(const dvariable & _a, const dvariable & _x); 
20 
extern int mtherr(char* s,int n);


26 
extern int mtherr(char* s,int n); 

21  27  
22  28 
namespace Cephes 
23  29 
{ 
...  ...  
44  50 
dvariable polevl(const dvariable & x, const void *_coef, int N); 
45  51 
dvariable p1evl(const dvariable & x, const void *_coef, int N); 
46  52  
47  
48  
49  53 
/** 
50  54 
* \ingroup gammafunc 
51  55 
* Stirling's formula (approximation to large factorials) 
...  ...  
78  82 
/** 
79  83 
* \ingroup gammafunc 
80  84 
* Polynomial evaluation 
81 
* \param x \f$x\f$ 

85 
* \param x \f$x\f$ the point to be evaluated


82  86 
* \param _coef The coefficents of the polynomial 
83  87 
* \param N \f$N\f$ The degree of the polynomial 
84  88 
* \return The polynomial evaluated at \f$x\f$ 
...  ...  
109  113 
* \ingroup gammafunc 
110  114 
* Polynomial evaluation when leading coefficent is 1 
111  115 
* (i.e. leading term is \f$x^N\f$) 
112 
* \param x \f$x\f$ 

116 
* \param x \f$x\f$ the point to be evaluated


113  117 
* \param _coef The coefficents of the polynomial 
114  118 
* \param N \f$N\f$ The degree of the polynomial 
115  119 
* \return The polynomial evaluated at \f$x\f$ 
...  ...  
135  139  
136  140 
return (ans); 
137  141 
} 
138 
} // Cephes namespace 

142 
} // End Cephes namespace


139  143  
140  
141  144 
/** 
142  145 
* \ingroup gammafunc 
143 
* Gamma Function 

146 
* Gamma Function \f$\Gamma(x)\f$


144  147 
* \param xx1 \f$x\f$ 
145 
* \return The Gamma Function \f$\Gamma(x)\f$


148 
* \return The Gamma Function 

146  149 
* 
147  150 
* \n\n Cephes Math Library Release 2.1: December, 1988 
148  151 
* Copyright 1984, 1987, 1988 by Stephen L. Moshier 
...  ...  
282  285 
return (z / ((1.0 + 0.5772156649015329 * x) * x)); 
283  286 
} 
284  287  
285 
// 

286  
287  
288  288 
/** 
289  289 
* \ingroup gammafunc 
290 
* Loggamma function 

290 
* Loggamma function \f$\ln(\Gamma(x))\f$


291  291 
* \param xx \f$x\f$ 
292  292 
* \return natural log of the absolute 
293 
* value of the gamma function \f$\ln(\Gamma(x))\f$


293 
* value of the gamma function 

294  294 
* 
295  295 
* \n\n Cephes Math Library Release 2.1: December, 1988 
296  296 
* Copyright 1984, 1987, 1988 by Stephen L. Moshier 
...  ...  
424  424 
return (q); 
Also available in: Unified diff