Class SpecialFunctions
- java.lang.Object
-
- org.mariuszgromada.math.mxparser.mathcollection.SpecialFunctions
-
public final class SpecialFunctions extends java.lang.ObjectSpecialFunctions - special (non-elementary functions).- Version:
- 5.1.0
-
-
Field Summary
Fields Modifier and Type Field Description private static doubledoublePrecisionprivate static intdoubleWidthprivate static doubleEI_DBL_EPSILONConstants for Exponential integral function Ei(x) calculationprivate static doubleEI_EPSILONprivate static doubleGSL_DBL_EPSILON
-
Constructor Summary
Constructors Constructor Description SpecialFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static doubleargumentAdditionSeriesEi(double x)Supporting function while Exponential integral function Ei(x) calculationstatic doublebeta(double x, double y)Beta special functionprivate static doublecontinuedFractionEi(double x)Supporting function while Exponential integral function Ei(x) calculationstatic doublediGamma(double x)Digamma function as the logarithmic derivative of the Gamma special functionstatic doubleerf(double x)Calculates the error functionstatic doubleerfc(double x)Calculates the complementary error function.static doubleerfcInv(double z)Calculates the complementary inverse error function evaluated at x.private static doubleerfImp(double z, boolean invert)Calculates the inverse error function evaluated at x.static doubleerfInv(double x)Calculates the inverse error function evaluated at x.private static doubleerfInvImpl(double p, double q, double s)The implementation of the inverse error function.static doubleexponentialIntegralEi(double x)Exponential integral function Ei(x)static doublegamma(double x)Real valued Gamma functionprivate static doublegammaInt(long n)Gamma function for the integersprivate static doublehalleyIteration(double x, double wInitial, int maxIter)Halley's iteration used in Lambert-W approximationstatic doublehypergeometricF(double a, double b, double c, double z, double maxIterations, double precision)The Gaussian or ordinary hypergeometric special functionprivate static doublehypergeometricFDirect(double a, double b, double c, double z, double maxIterations, double precision)The Gaussian or ordinary hypergeometric special function - directstatic doubleincompleteBeta(double a, double b, double x)Log Incomplete Beta special functionstatic doubleincompleteGammaLower(double s, double x)Incomplete lower gamma functionstatic doubleincompleteGammaUpper(double s, double x)Incomplete upper gamma functionstatic doubleinverseRegularizedBeta(double a, double b, double p)Inerse regularized incomplete Beta special functionstatic doubleinverseRegularizedGammaLowerP(double a, double p)Inverse of regularized lower gamma function 'P'static doublelambertW(double x, double branch)Real-valued Lambert-W function approximation.private static doublelambertW0(double x)W0 - Principal branch of Lambert-W functionprivate static doublelambertW1(double x)Minus 1 branch of Lambert-W function Analytical approximations for real values of the Lambert W-function - D.A.static doublelanchosGamma(double x)Gamma function implementation based on Lanchos approximation algorithmstatic doublelogarithmicIntegralLi(double x)Logarithmic integral function li(x)static doublelogBeta(double x, double y)Log Beta special functionstatic doublelogGamma(double x)Real valued log gamma function.static doubleoffsetLogarithmicIntegralLi(double x)Offset logarithmic integral function Li(x)private static doublepowerSeriesEi(double x)Supporting function while Exponential integral function Ei(x) calculationstatic doubleregularizedBeta(double a, double b, double x)Regularized incomplete Beta special functionstatic doubleregularizedGammaLowerP(double s, double x)Regularized lower gamma function 'P'static doubleregularizedGammaUpperQ(double s, double x)Regularized upper gamma function 'Q'private static doubleseriesEval(double r)Private method used in Lambert-W approximation - near zerostatic doublesgnGamma(double x)Signum from the real valued gamma function.
-
-
-
Field Detail
-
EI_DBL_EPSILON
private static final double EI_DBL_EPSILON
Constants for Exponential integral function Ei(x) calculation
-
EI_EPSILON
private static final double EI_EPSILON
-
doubleWidth
private static final int doubleWidth
- See Also:
- Constant Field Values
-
doublePrecision
private static final double doublePrecision
-
GSL_DBL_EPSILON
private static final double GSL_DBL_EPSILON
- See Also:
- Constant Field Values
-
-
Method Detail
-
exponentialIntegralEi
public static double exponentialIntegralEi(double x)
Exponential integral function Ei(x)- Parameters:
x- Point at which function will be evaluated.- Returns:
- Exponential integral function Ei(x)
-
continuedFractionEi
private static double continuedFractionEi(double x)
Supporting function while Exponential integral function Ei(x) calculation
-
powerSeriesEi
private static double powerSeriesEi(double x)
Supporting function while Exponential integral function Ei(x) calculation
-
argumentAdditionSeriesEi
private static double argumentAdditionSeriesEi(double x)
Supporting function while Exponential integral function Ei(x) calculation
-
logarithmicIntegralLi
public static double logarithmicIntegralLi(double x)
Logarithmic integral function li(x)- Parameters:
x- Point at which function will be evaluated.- Returns:
- Logarithmic integral function li(x)
-
offsetLogarithmicIntegralLi
public static double offsetLogarithmicIntegralLi(double x)
Offset logarithmic integral function Li(x)- Parameters:
x- Point at which function will be evaluated.- Returns:
- Offset logarithmic integral function Li(x)
-
erf
public static double erf(double x)
Calculates the error function- Parameters:
x- Point at which function will be evaluated.- Returns:
- Error function erf(x)
-
erfc
public static double erfc(double x)
Calculates the complementary error function.- Parameters:
x- Point at which function will be evaluated.- Returns:
- Complementary error function erfc(x)
-
erfInv
public static double erfInv(double x)
Calculates the inverse error function evaluated at x.- Parameters:
x- Point at which function will be evaluated.- Returns:
- Inverse error function erfInv(x)
-
erfImp
private static double erfImp(double z, boolean invert)Calculates the inverse error function evaluated at x.- Parameters:
z-invert-- Returns:
-
erfcInv
public static double erfcInv(double z)
Calculates the complementary inverse error function evaluated at x.- Parameters:
z- Point at which function will be evaluated.- Returns:
- Inverse of complementary inverse error function erfcInv(x)
-
erfInvImpl
private static double erfInvImpl(double p, double q, double s)The implementation of the inverse error function.- Parameters:
p-q-s-- Returns:
-
gammaInt
private static double gammaInt(long n)
Gamma function for the integers- Parameters:
n- Integer number- Returns:
- Returns Gamma function for the integers.
-
gamma
public static double gamma(double x)
Real valued Gamma function- Parameters:
x- Argument value- Returns:
- Returns gamma function value.
-
lanchosGamma
public static double lanchosGamma(double x)
Gamma function implementation based on Lanchos approximation algorithm- Parameters:
x- Function parameter- Returns:
- Gamma function value (Lanchos approx).
-
logGamma
public static double logGamma(double x)
Real valued log gamma function.- Parameters:
x- Argument value- Returns:
- Returns log value from gamma function.
-
sgnGamma
public static double sgnGamma(double x)
Signum from the real valued gamma function.- Parameters:
x- Argument value- Returns:
- Returns signum of the gamma(x)
-
regularizedGammaLowerP
public static double regularizedGammaLowerP(double s, double x)Regularized lower gamma function 'P'- Parameters:
s- Argument valuex- Argument value- Returns:
- Value of the regularized lower gamma function 'P'.
-
inverseRegularizedGammaLowerP
public static double inverseRegularizedGammaLowerP(double a, double p)Inverse of regularized lower gamma function 'P'- Parameters:
a- Argument valuep- Argument value- Returns:
- Value of the inverse regularized lower gamma function 'P'.
-
incompleteGammaLower
public static double incompleteGammaLower(double s, double x)Incomplete lower gamma function- Parameters:
s- Argument valuex- Argument value- Returns:
- Value of the incomplete lower gamma function.
-
regularizedGammaUpperQ
public static double regularizedGammaUpperQ(double s, double x)Regularized upper gamma function 'Q'- Parameters:
s- Argument valuex- Argument value- Returns:
- Value of the regularized upper gamma function 'Q'.
-
incompleteGammaUpper
public static double incompleteGammaUpper(double s, double x)Incomplete upper gamma function- Parameters:
s- Argument valuex- Argument value- Returns:
- Value of the incomplete upper gamma function.
-
diGamma
public static double diGamma(double x)
Digamma function as the logarithmic derivative of the Gamma special function- Parameters:
x- Argument value- Returns:
- Approximated value of the digamma function.
-
logBeta
public static double logBeta(double x, double y)Log Beta special function- Parameters:
x- Argument valuey- Argument value- Returns:
- Return logBeta special function (for positive x and positive y)
-
beta
public static double beta(double x, double y)Beta special function- Parameters:
x- Argument valuey- Argument value- Returns:
- Return Beta special function (for positive x and positive y)
-
incompleteBeta
public static double incompleteBeta(double a, double b, double x)Log Incomplete Beta special function- Parameters:
a- Argument valueb- Argument valuex- Argument value- Returns:
- Return incomplete Beta special function for positive a and positive b and x between 0 and 1
-
regularizedBeta
public static double regularizedBeta(double a, double b, double x)Regularized incomplete Beta special function- Parameters:
a- Argument valueb- Argument valuex- Argument value- Returns:
- Return incomplete Beta special function for positive a and positive b and x between 0 and 1
-
inverseRegularizedBeta
public static double inverseRegularizedBeta(double a, double b, double p)Inerse regularized incomplete Beta special function- Parameters:
a- Argument valueb- Argument valuep- Argument value- Returns:
- Return inverse incomplete Beta special function for positive a and positive b and x between 0 and 1
-
halleyIteration
private static double halleyIteration(double x, double wInitial, int maxIter)Halley's iteration used in Lambert-W approximation- Parameters:
x- Point at which Halley iteration will be calculatedwInitial- Starting pointmaxIter- Maximum number of iteration- Returns:
- Halley's iteration value if successful, otherwise Double.NaN
-
seriesEval
private static double seriesEval(double r)
Private method used in Lambert-W approximation - near zero- Parameters:
r-- Returns:
- Ner zero approximation
-
lambertW0
private static double lambertW0(double x)
W0 - Principal branch of Lambert-W function- Parameters:
x-- Returns:
- Approximation of principal branch of Lambert-W function
-
lambertW1
private static double lambertW1(double x)
Minus 1 branch of Lambert-W function Analytical approximations for real values of the Lambert W-function - D.A. Barry Mathematics and Computers in Simulation 53 (2000) 95–103- Parameters:
x-- Returns:
- Approxmiation of minus 1 branch of Lambert-W function
-
lambertW
public static double lambertW(double x, double branch)Real-valued Lambert-W function approximation.- Parameters:
x- Point at which function will be approximatedbranch- Branch id, 0 for principal branch, -1 for the other branch- Returns:
- Principal branch for x greater or equal than -1/e, otherwise Double.NaN. Minus 1 branch for x greater or equal than -1/e and lower than 0, otherwise Double.NaN.
-
hypergeometricF
public static double hypergeometricF(double a, double b, double c, double z, double maxIterations, double precision)The Gaussian or ordinary hypergeometric special function- Parameters:
a- Argument valueb- Argument valuec- Argument valuez- Argument valuemaxIterations- Stop conditionprecision- Stop condition- Returns:
- Returns hypergeometric special function approximation
-
hypergeometricFDirect
private static double hypergeometricFDirect(double a, double b, double c, double z, double maxIterations, double precision)The Gaussian or ordinary hypergeometric special function - direct- Parameters:
a- Argument valueb- Argument valuec- Argument valuez- Argument valuemaxIterations- Stop conditionprecision- Stop condition- Returns:
- Returns hypergeometric special function approximation - direct
-
-