etomica.math

## Class Gamma

• java.lang.Object
• etomica.math.Gamma

• ```public class Gamma
extends java.lang.Object```
This class calculates the incomplete gamma function and complementary incomplete gamma function. This is a Java translation of Algorithm 542: Incomplete Gamma Functions [S14] by W. Gautschi from ACM Transactions on Mathematical Software (TOMS) Volume 5 , Issue 4 (December 1979) Pages: 482 - 489 see http://www.netlib.org/toms/542 The original algorithm was "taylored to the accuracy requirements of the CDC 6500 computer." Little to no attempt has been made to re-optimize for Java, other than to use Double.{MAX,MIN}_VALUE in place of defined constants.
• ### Field Summary

Fields
Modifier and Type Field and Description
`protected static double` `AL10`
`protected static double` `ALPREC`
`protected static double` `BOT`
`protected static int` `BOTEXP`
`protected static double[]` `C`
`protected static double[]` `DBDEN`
`protected static double[]` `DBNUM`
`protected static double` `DC`
`protected double` `G`
`protected double` `GSTAR`
`protected int` `IFLGST`
`protected static float` `PREC`
`protected static double` `TOP`
`protected static int` `TOPEXP`
• ### Constructor Summary

Constructors
Constructor and Description
`Gamma()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`protected void` ```calcBoth(double A, double X)```
`double` ```calcGamma(double a, double x)```
Return the normalized complementary incomplete gamma function, (integral from t=x to t=inf of exp(-t)*t^(a-1)) / gamma(a) if a>0 or (integral from t=x to t=inf of exp(-t)*t^(a-1)) * exp(x)*x^(-a) if a<=0
`double` ```calcGammaStar(double a, double x)```
Return the normalized incomplete gamma function, (integral from t=0 to t=x of exp(-t)*t^(a-1)) / x^a if a>0 If a=0 and x=0, gammaStar is indeterminate and an exception is thrown.
`protected static double` `DLGA(double DX)`
`double` `getLastGamma()`
Return the normalized complementary incomplete gamma function from the last calculation.
`double` `getLastGammaStar()`
Return the normalized incomplete gamma function from the last calculation.
`static void` `main(java.lang.String[] args)`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### PREC

`protected static final float PREC`
Constant Field Values
• #### TOPEXP

`protected static final int TOPEXP`
• #### BOTEXP

`protected static final int BOTEXP`
• #### AL10

`protected static final double AL10`
• #### ALPREC

`protected static final double ALPREC`
• #### TOP

`protected static final double TOP`
• #### BOT

`protected static final double BOT`
• #### C

`protected static final double[] C`
• #### G

`protected double G`
• #### GSTAR

`protected double GSTAR`
• #### IFLGST

`protected int IFLGST`
• #### DBNUM

`protected static final double[] DBNUM`
• #### DBDEN

`protected static final double[] DBDEN`
• #### DC

`protected static final double DC`
• ### Constructor Detail

• #### Gamma

`public Gamma()`
• ### Method Detail

• #### calcGamma

```public double calcGamma(double a,
double x)```
Return the normalized complementary incomplete gamma function, (integral from t=x to t=inf of exp(-t)*t^(a-1)) / gamma(a) if a>0 or (integral from t=x to t=inf of exp(-t)*t^(a-1)) * exp(x)*x^(-a) if a<=0
• #### calcGammaStar

```public double calcGammaStar(double a,
double x)```
Return the normalized incomplete gamma function, (integral from t=0 to t=x of exp(-t)*t^(a-1)) / x^a if a>0 If a=0 and x=0, gammaStar is indeterminate and an exception is thrown. gammaStar approaches 1 as x approaches 0 while a=0.
• #### getLastGamma

`public double getLastGamma()`
Return the normalized complementary incomplete gamma function from the last calculation. This is useful if you called calcGammaStar, but now want gamma (gamma and gammaStar are both calculated).
• #### getLastGammaStar

`public double getLastGammaStar()`
Return the normalized incomplete gamma function from the last calculation. This is useful if you called calcGamma, but now want gammaStar (gamma and gammaStar are both calculated).
• #### calcBoth

```protected void calcBoth(double A,
double X)```
• #### DLGA

`protected static double DLGA(double DX)`
• #### main

`public static void main(java.lang.String[] args)`