Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hartmath.expression
Class HDoubleSpecial  view HDoubleSpecial download HDoubleSpecial.java

java.lang.Object
  extended bycom.hartmath.expression.HDoubleSpecial

public class HDoubleSpecial
extends java.lang.Object

The special function math library. This class cannot be subclassed or instantiated because all methods are static.

Version:
1.0

Field Summary
private static double[] ai02cs
           
private static double[] ai0cs
           
private static double[] ai12cs
           
private static double[] ai1cs
           
private static double[] aifcs
           
private static double[] aigcs
           
private static double[] aipcs
           
private static double[] am21cs
           
private static double[] am22cs
           
private static double[] ath1cs
           
private static double[] ath2cs
           
private static double[] bi0cs
           
private static double[] bi1cs
           
private static double[] bj0cs
           
private static double[] bj1cs
           
private static double[] bm0cs
           
private static double[] bm1cs
           
private static double[] bth0cs
           
private static double[] bth1cs
           
private static double[] by0cs
           
private static double[] by1cs
           
private static double logBetaCache_p
           
private static double logBetaCache_q
           
private static double logBetaCache_res
           
private static double logGamma_xBig
          The largest argument for which logGamma(x) is representable in the machine.
private static double logGammaCache_res
           
private static double logGammaCache_x
           
private static double LOGSQRT2PI
           
private static int MAX_ITERATIONS
           
private static double PRECISION
           
 
Constructor Summary
private HDoubleSpecial()
          Class Constructor.
 
Method Summary
static double airy(double x)
          Airy function.
private static double[] airyModPhase(double x)
          Airy modulus and phase.
static double besselFirstOne(double x)
          Bessel function of first kind, order one.
static double besselFirstZero(double x)
          Bessel function of first kind, order zero.
static double besselSecondOne(double x)
          Bessel function of second kind, order one.
static double besselSecondZero(double x)
          Bessel function of second kind, order zero.
static double beta(double p, double q)
          Beta function.
private static double betaFraction(double x, double p, double q)
          Evaluates of continued fraction part of incomplete beta function.
static double chebyshev(double x, double[] series)
          Evaluates a Chebyshev series.
static double complementaryError(double x)
          Complementary error function.
static double error(double x)
          Error function.
private static double expAiry(double x)
          Exponential scaled Airy function.
private static double expModBesselFirstOne(double x)
          Exponential scaled modified Bessel function of first kind, order one.
private static double expModBesselFirstZero(double x)
          Exponential scaled modified Bessel function of first kind, order zero.
static java.lang.String format(double d)
          This method formats a floating point number to a minimum of 12 characters, six decimal places, in decimal format, right aligned, without + signs on positive numbers.
static java.lang.String format(double d, int width)
          This method formats a floating point number to specified width, six decimal places, in decimal format, right aligned, without + signs on positive numbers.
static java.lang.String format(double d, int width, int precision)
          This method formats a floating point number to specified width, number of decimal places, in decimal format, right aligned, without + signs on positive numbers.
static java.lang.String format(double d, int width, int precision, boolean exponential)
          This method formats a floating point number to specified width, number of decimal places, in exponential or decimal format, right aligned, without + signs on positive numbers.
static java.lang.String format(double d, int width, int precision, boolean exponential, boolean alignLeft)
          This method formats a floating point number to a specified width, number of decimal places, in exponential or decimal format, aligned left or right, without + signs on positive numbers.
static java.lang.String format(double d, int width, int precision, boolean exponential, boolean alignLeft, boolean usePlus)
          This method formats a floating point number to a specified width, number of decimal places, in exponential or decimal format, aligned left or right, with or without + signs on positive numbers.
static java.lang.String format(double d, int width, int precision, boolean exponential, boolean alignLeft, boolean usePlus, char pad)
          This method formats a floating point number to a specified width, number of decimal places, in exponential or decimal format, aligned left or right, with or without + signs on positive numbers, and with a user-specified padding character used to fill out the number to the specified width.
static double gamma(double x)
          Gamma function.
private static double gammaFraction(double a, double x)
           
private static double gammaSeriesExpansion(double a, double x)
           
static double incompleteBeta(double x, double p, double q)
          Incomplete beta function.
static double incompleteGamma(double a, double x)
          Incomplete gamma function.
static double logBeta(double p, double q)
          The natural logarithm of the beta function.
static double logGamma(double x)
          The natural logarithm of the gamma function.
static double modBesselFirstOne(double x)
          Modified Bessel function of first kind, order one.
static double modBesselFirstZero(double x)
          Modified Bessel function of first kind, order zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ai0cs

private static final double[] ai0cs

ai02cs

private static final double[] ai02cs

ai1cs

private static final double[] ai1cs

ai12cs

private static final double[] ai12cs

aifcs

private static final double[] aifcs

aigcs

private static final double[] aigcs

aipcs

private static final double[] aipcs

am21cs

private static final double[] am21cs

ath1cs

private static final double[] ath1cs

am22cs

private static final double[] am22cs

ath2cs

private static final double[] ath2cs

bi0cs

private static final double[] bi0cs

bj0cs

private static final double[] bj0cs

bm0cs

private static final double[] bm0cs

bth0cs

private static final double[] bth0cs

by0cs

private static final double[] by0cs

bi1cs

private static final double[] bi1cs

bj1cs

private static final double[] bj1cs

bm1cs

private static final double[] bm1cs

bth1cs

private static final double[] bth1cs

by1cs

private static final double[] by1cs

LOGSQRT2PI

private static final double LOGSQRT2PI

logGamma_xBig

private static final double logGamma_xBig
The largest argument for which logGamma(x) is representable in the machine.

See Also:
Constant Field Values

logGammaCache_res

private static double logGammaCache_res

logGammaCache_x

private static double logGammaCache_x

MAX_ITERATIONS

private static final int MAX_ITERATIONS
See Also:
Constant Field Values

PRECISION

private static final double PRECISION
See Also:
Constant Field Values

logBetaCache_res

private static double logBetaCache_res

logBetaCache_p

private static double logBetaCache_p

logBetaCache_q

private static double logBetaCache_q
Constructor Detail

HDoubleSpecial

private HDoubleSpecial()
Class Constructor.

Method Detail

chebyshev

public static double chebyshev(double x,
                               double[] series)
Evaluates a Chebyshev series.


airy

public static double airy(double x)
Airy function. Based on the NETLIB Fortran function ai written by W. Fullerton.


airyModPhase

private static double[] airyModPhase(double x)
Airy modulus and phase. Based on the NETLIB Fortran subroutine r9aimp written by W. Fullerton.


expAiry

private static double expAiry(double x)
Exponential scaled Airy function. Based on the NETLIB Fortran function aie written by W. Fullerton.


besselFirstZero

public static double besselFirstZero(double x)
Bessel function of first kind, order zero. Based on the NETLIB Fortran function besj0 written by W. Fullerton.


modBesselFirstZero

public static double modBesselFirstZero(double x)
Modified Bessel function of first kind, order zero. Based on the NETLIB Fortran function besi0 written by W. Fullerton.


expModBesselFirstZero

private static double expModBesselFirstZero(double x)
Exponential scaled modified Bessel function of first kind, order zero. Based on the NETLIB Fortran function besi0e written by W. Fullerton.


besselFirstOne

public static double besselFirstOne(double x)
Bessel function of first kind, order one. Based on the NETLIB Fortran function besj1 written by W. Fullerton.


modBesselFirstOne

public static double modBesselFirstOne(double x)
Modified Bessel function of first kind, order one. Based on the NETLIB Fortran function besi1 written by W. Fullerton.


expModBesselFirstOne

private static double expModBesselFirstOne(double x)
Exponential scaled modified Bessel function of first kind, order one. Based on the NETLIB Fortran function besi1e written by W. Fullerton.


besselSecondZero

public static double besselSecondZero(double x)
Bessel function of second kind, order zero. Based on the NETLIB Fortran function besy0 written by W. Fullerton.


besselSecondOne

public static double besselSecondOne(double x)
Bessel function of second kind, order one. Based on the NETLIB Fortran function besy1 written by W. Fullerton.


gamma

public static double gamma(double x)
Gamma function. Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
Applied Mathematics Division
Argonne National Laboratory
Argonne, IL 60439

References:

  1. "An Overview of Software Development for Special Functions", W. J. Cody, Lecture Notes in Mathematics, 506, Numerical Analysis Dundee, 1975, G. A. Watson (ed.), Springer Verlag, Berlin, 1976.
  2. Computer Approximations, Hart, Et. Al., Wiley and sons, New York, 1968.

From the original documentation:

This routine calculates the GAMMA function for a real argument X. Computation is based on an algorithm outlined in reference 1. The program uses rational functions that approximate the GAMMA function to at least 20 significant decimal digits. Coefficients for the approximation over the interval (1,2) are unpublished. Those for the approximation for X .GE. 12 are from reference 2. The accuracy achieved depends on the arithmetic system, the compiler, the intrinsic functions, and proper selection of the machine-dependent constants.

Error returns:
The program returns the value XINF for singularities or when overflow would occur. The computation is believed to be free of underflow and overflow.


logGamma

public static double logGamma(double x)
The natural logarithm of the gamma function. Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
Applied Mathematics Division
Argonne National Laboratory
Argonne, IL 60439

References:

  1. W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.
  2. K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.
  3. Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.

From the original documentation:

This routine calculates the LOG(GAMMA) function for a positive real argument X. Computation is based on an algorithm outlined in references 1 and 2. The program uses rational functions that theoretically approximate LOG(GAMMA) to at least 18 significant decimal digits. The approximation for X > 12 is from reference 3, while approximations for X < 12.0 are similar to those in reference 1, but are unpublished. The accuracy achieved depends on the arithmetic system, the compiler, the intrinsic functions, and proper selection of the machine-dependent constants.

Error returns:
The program returns the value XINF for X .LE. 0.0 or when overflow would occur. The computation is believed to be free of underflow and overflow.


incompleteGamma

public static double incompleteGamma(double a,
                                     double x)
Incomplete gamma function. The computation is based on approximations presented in Numerical Recipes, Chapter 6.2 (W.H. Press et al, 1992).


gammaSeriesExpansion

private static double gammaSeriesExpansion(double a,
                                           double x)

gammaFraction

private static double gammaFraction(double a,
                                    double x)

beta

public static double beta(double p,
                          double q)
Beta function.


logBeta

public static double logBeta(double p,
                             double q)
The natural logarithm of the beta function.


incompleteBeta

public static double incompleteBeta(double x,
                                    double p,
                                    double q)
Incomplete beta function. The computation is based on formulas from Numerical Recipes, Chapter 6.4 (W.H. Press et al, 1992).


betaFraction

private static double betaFraction(double x,
                                   double p,
                                   double q)
Evaluates of continued fraction part of incomplete beta function. Based on an idea from Numerical Recipes (W.H. Press et al, 1992).


error

public static double error(double x)
Error function. Based on C-code for the error function developed at Sun Microsystems.


complementaryError

public static double complementaryError(double x)
Complementary error function. Based on C-code for the error function developed at Sun Microsystems.


format

public static java.lang.String format(double d)
This method formats a floating point number to a minimum of 12 characters, six decimal places, in decimal format, right aligned, without + signs on positive numbers. Spaces fill out the number to the specified width.


format

public static java.lang.String format(double d,
                                      int width)
This method formats a floating point number to specified width, six decimal places, in decimal format, right aligned, without + signs on positive numbers. Spaces fill out the number to the specified width.


format

public static java.lang.String format(double d,
                                      int width,
                                      int precision)
This method formats a floating point number to specified width, number of decimal places, in decimal format, right aligned, without + signs on positive numbers. Spaces fill out the number to the specified width.


format

public static java.lang.String format(double d,
                                      int width,
                                      int precision,
                                      boolean exponential)
This method formats a floating point number to specified width, number of decimal places, in exponential or decimal format, right aligned, without + signs on positive numbers. Spaces fill out the number to the specified width.


format

public static java.lang.String format(double d,
                                      int width,
                                      int precision,
                                      boolean exponential,
                                      boolean alignLeft)
This method formats a floating point number to a specified width, number of decimal places, in exponential or decimal format, aligned left or right, without + signs on positive numbers. Spaces fill out the number to the specified width.


format

public static java.lang.String format(double d,
                                      int width,
                                      int precision,
                                      boolean exponential,
                                      boolean alignLeft,
                                      boolean usePlus)
This method formats a floating point number to a specified width, number of decimal places, in exponential or decimal format, aligned left or right, with or without + signs on positive numbers. Spaces fill out the number to the specified width.


format

public static java.lang.String format(double d,
                                      int width,
                                      int precision,
                                      boolean exponential,
                                      boolean alignLeft,
                                      boolean usePlus,
                                      char pad)
This method formats a floating point number to a specified width, number of decimal places, in exponential or decimal format, aligned left or right, with or without + signs on positive numbers, and with a user-specified padding character used to fill out the number to the specified width.