Class ApfloatMath
Due to different types of round-off errors that can occur in the implementation, no guarantees about e.g. monotonicity are given for any of the methods.
- Version:
- 1.14.0
- Author:
- Mikko Tommila
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ApfloatAbsolute value.static ApfloatInverse cosine.static ApfloatInverse hyperbolic cosine.static ApfloatArithmetic-geometric mean.static ApfloatAiry function Ai.static ApfloatDerivative of the Airy function Ai.static ApfloatAiry function Bi.static ApfloatDerivative of the Airy function Bi.static ApfloatInverse sine.static ApfloatInverse hyperbolic sine.static ApfloatInverse tangent.static ApfloatConverts cartesian coordinates to polar coordinates.static ApfloatInverse hyperbolic tangent.static ApfloatbernoulliB(long n, Apfloat x) Bernoulli polynomial.static ApfloatModified Bessel function of the first kind.static ApfloatBessel function of the first kind.static ApfloatModified Bessel function of the second kind.static ApfloatBessel function of the second kind.static ApfloatBeta function.static ApfloatIncomplete beta function.static ApfloatGeneralized incomplete beta function.static ApfloatBinomial coefficient.static Apfloatcatalan(long precision) Calculates Catalan's constant, G.static Apfloatcatalan(long precision, int radix) Calculates Catalan's constant, G.static ApfloatCube root.static ApintCeiling function.static ApfloatchebyshevT(Apfloat ν, Apfloat x) Chebyshev function of the first kind.static ApfloatchebyshevU(Apfloat ν, Apfloat x) Chebyshev function of the second kind.static Apint[]continuedFraction(Apfloat x, int n) Generates the firstnterms in the continued fraction representation ofx.static Aprational[]convergents(Apfloat x, int n) Generates the firstnconvergents corresponding to the continued fraction ofx.static ApfloatCopy sign from one argument to another.static ApfloatCosine.static ApfloatHyperbolic cosine.static ApfloatHyperbolic cosine integral.static ApfloatCosine integral.static ApfloatDigamma function.static Apfloate(long precision) Calculates e.static Apfloate(long precision, int radix) Calculates e.static ApfloatComplete elliptic integral of the second kind.static ApfloatComplete elliptic integral of the first kind.static ApfloatError function.static ApfloatComplementary error function.static ApfloatImaginary error function.static Apfloateuler(long precision) Calculates γ, the Euler-Mascheroni constant.static Apfloateuler(long precision, int radix) Calculates γ, the Euler-Mascheroni constant.static ApfloatEuler polynomial.static ApfloatExponent function.static ApfloatexpIntegralE(Apfloat ν, Apfloat x) Exponential integral E.static ApfloatExponential integral Ei.static ApfloatFibonacci function.static ApintFloor function.static ApfloatReturns x modulo y.static ApfloatExtracts fractional part.static ApfloatFresnel integral C.static ApfloatFresnel integral S.static ApfloatGamma function.static ApfloatIncomplete gamma function.static ApfloatGeneralized incomplete gamma function.static ApfloatgegenbauerC(Apfloat ν, Apfloat x) Renormalized Gegenbauer function.static ApfloatgegenbauerC(Apfloat ν, Apfloat λ, Apfloat x) Gegenbauer function.static Apfloatglaisher(long precision) Calculates the Glaisher‐Kinkelin constant, A.static Apfloatglaisher(long precision, int radix) Calculates the Glaisher‐Kinkelin constant, A.static ApfloatHarmonic number.static ApfloatharmonicNumber(Apfloat x, Apfloat r) Generalized harmonic number.static ApfloatHermite function.static Apfloathypergeometric0F1(Apfloat a, Apfloat x) Confluent hypergeometric function 0F1.static ApfloatRegularized confluent hypergeometric function 0F̃1.static Apfloathypergeometric1F1(Apfloat a, Apfloat b, Apfloat x) Kummer confluent hypergeometric function 1F1.static ApfloatRegularized Kummer confluent hypergeometric function 1F̃1.static Apfloathypergeometric2F1(Apfloat a, Apfloat b, Apfloat c, Apfloat x) Hypergeometric function 2F1.static Apfloathypergeometric2F1Regularized(Apfloat a, Apfloat b, Apfloat c, Apfloat x) Regularized hypergeometric function 2F̃1.static ApfloathypergeometricU(Apfloat a, Apfloat b, Apfloat x) Tricomi's confluent hypergeometric function U.static ApfloatInverse error function.static ApfloatInverse complementary error function.static ApfloatinverseRoot(Apfloat x, long n) Inverse positive integer root.static ApfloatinverseRoot(Apfloat x, long n, long targetPrecision) Inverse positive integer root.static ApfloatinverseRoot(Apfloat x, long n, long targetPrecision, Apfloat initialGuess) Inverse positive integer root.static ApfloatinverseRoot(Apfloat x, long n, long targetPrecision, Apfloat initialGuess, long initialPrecision) Inverse positive integer root.static ApfloatJacobi function.static Apfloatkhinchin(long precision) Calculates Khinchin's constant, K.Uses the default radix.static Apfloatkhinchin(long precision, int radix) Calculates Khinchin's constant, K.static ApfloatLaguerre function.static ApfloatGeneralized Laguerre function.static ApfloatLegendre function.static ApfloatAssociated Legendre function of the first kind.static ApfloatLegendre function of the second kind.static ApfloatAssociated Legendre function of the second kind.static ApfloatNatural logarithm.static ApfloatLogarithm in arbitrary base.static ApfloatLogarithm of the gamma function.static ApfloatLogarithmic integral.static ApfloatLogistic sigmoid.static ApfloatlogRadix(long precision, int radix) Gets or calculates logarithm of a radix to required precision.static ApfloatReturns the greater of the two values.static ApfloatReturns the smaller of the two values.static Apfloat[]Split to integer and fractional parts.static ApfloatmultiplyAdd(Apfloat a, Apfloat b, Apfloat c, Apfloat d) Fused multiply-add.static ApfloatmultiplySubtract(Apfloat a, Apfloat b, Apfloat c, Apfloat d) Fused multiply-subtract.static ApfloatDeprecated.static ApfloatReturns the number adjacent to the first argument in the direction of the second argument, considering the scale and precision of the first argument.static ApfloatReturns the number adjacent to the argument in the direction of negative infinity, considering the scale and precision of the argument.static ApfloatReturns the number adjacent to the argument in the direction of positive infinity, considering the scale and precision of the argument.static Apfloatpi(long precision) Calculates π.static Apfloatpi(long precision, int radix) Calculates π.static Apfloatpochhammer(Apfloat x, Apfloat n) Pochhammer symbol.static ApfloatPolygamma function.static ApfloatPolylogarithm.static ApfloatInteger power.static ApfloatArbitrary power.static ApfloatProduct of numbers.static Apfloatrandom(long digits) Generates a random number.static Apfloatrandom(long digits, int radix) Generates a random number.static ApfloatrandomGaussian(long digits) Generates a random, Gaussian ("normally") distributed number value with mean 0 and standard deviation 1.static ApfloatrandomGaussian(long digits, int radix) Generates a random, Gaussian ("normally") distributed number value with mean 0 and standard deviation 1.static ApfloatPositive integer root.static Apfloatround(Apfloat x, long precision, RoundingMode roundingMode) Deprecated.static ApintroundToInteger(Apfloat x, RoundingMode roundingMode) Roundsxto integer using the specified rounding mode.static ApfloatroundToMultiple(Apfloat x, Apfloat y, RoundingMode roundingMode) Roundsxto the nearest multiple ofyusing the specified rounding mode.static ApfloatroundToPlaces(Apfloat x, long places, RoundingMode roundingMode) Roundsxto the specified number of places using the specified rounding mode.static ApfloatroundToPrecision(Apfloat x, long precision, RoundingMode roundingMode) Rounds the given number to the specified precision with the specified rounding mode.static ApfloatMultiply by a power of the radix.static ApfloatSine.static ApfloatSinc.static ApfloatHyperbolic sine.static ApfloatHyperbolic sine integral.static ApfloatSine integral.static ApfloatSquare root.static ApfloatSum of numbers.static ApfloatTangent.static ApfloatHyperbolic tangent.static ApfloatConverts an angle measured in radians to degrees.static ApfloatConverts an angle measured in degrees to radians.static ApintTruncates fractional part.static ApfloatReturns the unit in the last place of the argument, considering the scale and precision.static ApfloatLambert W function.static ApfloatRiemann zeta function.static ApfloatHurwitz zeta function.
-
Method Details
-
pow
Integer power.- Parameters:
x- Base of the power operator.n- Exponent of the power operator.- Returns:
xto then:th power, that isxn.- Throws:
ArithmeticException- If bothxandnare zero.ApfloatRuntimeException
-
sqrt
Square root.- Parameters:
x- The argument.- Returns:
- Square root of
x. - Throws:
ArithmeticException- Ifxis negative.ApfloatRuntimeException
-
cbrt
Cube root.- Parameters:
x- The argument.- Returns:
- Cube root of
x. - Throws:
ApfloatRuntimeException
-
root
Positive integer root.- Parameters:
x- The argument.n- Which root to take.- Returns:
n:th root ofx, that isx1/n.- Throws:
ArithmeticException- Ifnis zero, orxis negative andnis even.ApfloatRuntimeException
-
inverseRoot
public static Apfloat inverseRoot(Apfloat x, long n) throws ArithmeticException, ApfloatRuntimeException Inverse positive integer root.- Parameters:
x- The argument.n- Which inverse root to take.- Returns:
- Inverse
n:th root ofx, that isx-1/n. - Throws:
ArithmeticException- Ifxornis zero, orxis negative andnis even.ApfloatRuntimeException
-
inverseRoot
public static Apfloat inverseRoot(Apfloat x, long n, long targetPrecision) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Inverse positive integer root.- Parameters:
x- The argument.n- Which inverse root to take.targetPrecision- Precision of the desired result.- Returns:
- Inverse
n:th root ofx, that isx-1/n. - Throws:
IllegalArgumentException- IftargetPrecision <= 0.ArithmeticException- Ifxornis zero, orxis negative andnis even.ApfloatRuntimeException
-
inverseRoot
public static Apfloat inverseRoot(Apfloat x, long n, long targetPrecision, Apfloat initialGuess) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Inverse positive integer root.- Parameters:
x- The argument.n- Which inverse root to take.targetPrecision- Precision of the desired result.initialGuess- Initial guess for the result value, ornullif none is available.- Returns:
- Inverse
n:th root ofx, that isx-1/n. - Throws:
IllegalArgumentException- IftargetPrecision <= 0.ArithmeticException- Ifxornis zero, orxis negative andnis even.ApfloatRuntimeException
-
inverseRoot
public static Apfloat inverseRoot(Apfloat x, long n, long targetPrecision, Apfloat initialGuess, long initialPrecision) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Inverse positive integer root.This method is the basis for most of apfloat's non-elementary operations. It is used e.g. in
Apfloat.divide(Apfloat),sqrt(Apfloat)androot(Apfloat,long).- Parameters:
x- The argument.n- Which inverse root to take.targetPrecision- Precision of the desired result.initialGuess- Initial guess for the result value, ornullif none is available.initialPrecision- Precision of the initial guess, if available.- Returns:
- Inverse
n:th root ofx, that isx-1/n. - Throws:
IllegalArgumentException- IftargetPrecision <= 0orinitialPrecision <= 0.ArithmeticException- Ifxornis zero, orxis negative andnis even.ApfloatRuntimeException
-
floor
Floor function. Returns the largest (closest to positive infinity) value that is not greater than the argument and is equal to a mathematical integer.- Parameters:
x- The argument.- Returns:
xrounded towards negative infinity.- Throws:
ApfloatRuntimeException
-
ceil
Ceiling function. Returns the smallest (closest to negative infinity) value that is not less than the argument and is equal to a mathematical integer.- Parameters:
x- The argument.- Returns:
xrounded towards positive infinity.- Throws:
ApfloatRuntimeException
-
truncate
Truncates fractional part.- Parameters:
x- The argument.- Returns:
xrounded towards zero.- Throws:
ApfloatRuntimeException
-
frac
Extracts fractional part.- Parameters:
x- The argument.- Returns:
- The fractional part of
x. - Throws:
ApfloatRuntimeException- Since:
- 1.7.0
-
round
@Deprecated public static Apfloat round(Apfloat x, long precision, RoundingMode roundingMode) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Deprecated.Rounds the given number to the specified precision with the specified rounding mode.- Parameters:
x- The number to round.precision- The precision to round to.roundingMode- The rounding mode to use.- Returns:
- The rounded number.
- Throws:
IllegalArgumentException- Ifprecisionis less than zero or zero.ArithmeticException- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY.ApfloatRuntimeException- Since:
- 1.7.0
-
roundToPrecision
public static Apfloat roundToPrecision(Apfloat x, long precision, RoundingMode roundingMode) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Rounds the given number to the specified precision with the specified rounding mode.- Parameters:
x- The number to round.precision- The precision to round to.roundingMode- The rounding mode to use.- Returns:
- The rounded number.
- Throws:
IllegalArgumentException- Ifprecisionis less than zero or zero.ArithmeticException- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY.ApfloatRuntimeException- Since:
- 1.11.0
-
roundToInteger
public static Apint roundToInteger(Apfloat x, RoundingMode roundingMode) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Roundsxto integer using the specified rounding mode.- Parameters:
x- The number to round.roundingMode- The rounding mode to use.- Returns:
- The rounded number.
- Throws:
ArithmeticException- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY.IllegalArgumentExceptionApfloatRuntimeException- Since:
- 1.11.0
-
roundToPlaces
public static Apfloat roundToPlaces(Apfloat x, long places, RoundingMode roundingMode) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Roundsxto the specified number of places using the specified rounding mode.- Parameters:
x- The number to round.places- The number of places to round to (in base 10, the number of decimal places).roundingMode- The rounding mode to use.- Returns:
- The rounded number.
- Throws:
ArithmeticException- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY.IllegalArgumentExceptionApfloatRuntimeException- Since:
- 1.11.0
-
roundToMultiple
public static Apfloat roundToMultiple(Apfloat x, Apfloat y, RoundingMode roundingMode) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException Roundsxto the nearest multiple ofyusing the specified rounding mode.- Parameters:
x- The number to round.y- The integer multiple to round to.roundingMode- The rounding mode to use.- Returns:
- The rounded number.
- Throws:
ArithmeticException- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY.IllegalArgumentExceptionApfloatRuntimeException- Since:
- 1.11.0
-
negate
Deprecated.UseApfloat.negate().Returns an apfloat whose value is-x.- Parameters:
x- The argument.- Returns:
-x.- Throws:
ApfloatRuntimeException
-
abs
Absolute value.- Parameters:
x- The argument.- Returns:
- Absolute value of
x. - Throws:
ApfloatRuntimeException
-
copySign
Copy sign from one argument to another.- Parameters:
x- The value whose sign is to be adjusted.y- The value whose sign is to be used.- Returns:
xwith its sign changed to match the sign ofy.- Throws:
ApfloatRuntimeException- Since:
- 1.1
-
scale
Multiply by a power of the radix.- Parameters:
x- The argument.scale- The scaling factor.- Returns:
x * x.radix()scale.- Throws:
ApfloatRuntimeException
-
modf
Split to integer and fractional parts. The integer part is simplyi = floor(x). For the fractional partfthe following is always true:0 <= f < 1- Parameters:
x- The argument.- Returns:
- An array of two apfloats,
[i, f], the first being the integer part and the last being the fractional part. - Throws:
ApfloatRuntimeException
-
fmod
Returns x modulo y.This function calculates the remainder
fofx / ysuch thatx = i * y + f, whereiis an integer,fhas the same sign asx, and the absolute value offis less than the absolute value ofy.If
yis zero, then zero is returned.- Parameters:
x- The dividend.y- The divisor.- Returns:
- The remainder when x is divided by y.
- Throws:
ApfloatRuntimeException
-
multiplyAdd
public static Apfloat multiplyAdd(Apfloat a, Apfloat b, Apfloat c, Apfloat d) throws ApfloatRuntimeException Fused multiply-add. Calculatesa * b + c * dso that the precision used in the multiplications is only what is needed for the end result. Performance can this way be better than by calculatinga.multiply(b).add(c.multiply(d)).- Parameters:
a- First argument.b- Second argument.c- Third argument.d- Fourth argument.- Returns:
a * b + c * d.- Throws:
ApfloatRuntimeException
-
multiplySubtract
public static Apfloat multiplySubtract(Apfloat a, Apfloat b, Apfloat c, Apfloat d) throws ApfloatRuntimeException Fused multiply-subtract. Calculatesa * b - c * dso that the precision used in the multiplications is only what is needed for the end result. Performance can this way be better than by calculatinga.multiply(b).subtract(c.multiply(d)).- Parameters:
a- First argument.b- Second argument.c- Third argument.d- Fourth argument.- Returns:
a * b - c * d.- Throws:
ApfloatRuntimeException
-
agm
Arithmetic-geometric mean.- Parameters:
a- First argument.b- Second argument.- Returns:
- Arithmetic-geometric mean of a and b.
- Throws:
ApfloatRuntimeException
-
pi
public static Apfloat pi(long precision) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates π. Uses default radix.- Parameters:
precision- Number of digits of π to calculate.- Returns:
- π accurate to
precisiondigits, in the default radix. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException
-
pi
public static Apfloat pi(long precision, int radix) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates π.- Parameters:
precision- Number of digits of π to calculate.radix- The radix in which the number should be presented.- Returns:
- π accurate to
precisiondigits, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException
-
log
Natural logarithm.The logarithm is calculated using the arithmetic-geometric mean. See the Borweins' book for the formula.
- Parameters:
x- The argument.- Returns:
- Natural logarithm of
x. - Throws:
ArithmeticException- Ifx <= 0.ApfloatRuntimeException
-
log
Logarithm in arbitrary base.The logarithm is calculated using the arithmetic-geometric mean. See the Borweins' book for the formula.
- Parameters:
x- The argument.b- The base.- Returns:
- Base-
blogarithm ofx. - Throws:
ArithmeticException- Ifx <= 0orb <= 0.ApfloatRuntimeException- Since:
- 1.6
-
logRadix
Gets or calculates logarithm of a radix to required precision. The calculated value is stored in a cache for later usage.- Parameters:
precision- The needed precision.radix- The radix.- Returns:
- Natural logarithm of
radixto the specified precision. - Throws:
NumberFormatException- If the radix is invalid.ApfloatRuntimeException
-
exp
Exponent function. Calculated using Newton's iteration for the inverse of logarithm.- Parameters:
x- The argument.- Returns:
ex.- Throws:
ApfloatRuntimeException
-
pow
Arbitrary power. Calculated usinglog()andexp().- Parameters:
x- The base.y- The exponent.- Returns:
xy.- Throws:
ArithmeticException- If bothxandyare zero, orxis negative andyis not an integer.ApfloatRuntimeException
-
acosh
Inverse hyperbolic cosine. Calculated usinglog().- Parameters:
x- The argument.- Returns:
- Inverse hyperbolic cosine of
x. - Throws:
ArithmeticException- Ifx < 1.ApfloatRuntimeException
-
asinh
Inverse hyperbolic sine. Calculated usinglog().- Parameters:
x- The argument.- Returns:
- Inverse hyperbolic sine of
x. - Throws:
ApfloatRuntimeException
-
atanh
Inverse hyperbolic tangent. Calculated usinglog().- Parameters:
x- The argument.- Returns:
- Inverse hyperbolic tangent of
x. - Throws:
ArithmeticException- Ifabs(x) >= 1.ApfloatRuntimeException
-
cosh
Hyperbolic cosine. Calculated usingexp().- Parameters:
x- The argument.- Returns:
- Hyperbolic cosine of
x. - Throws:
ApfloatRuntimeException
-
sinh
Hyperbolic sine. Calculated usingexp().- Parameters:
x- The argument.- Returns:
- Hyperbolic sine of
x. - Throws:
ApfloatRuntimeException
-
tanh
Hyperbolic tangent. Calculated usingexp().- Parameters:
x- The argument.- Returns:
- Hyperbolic tangent of
x. - Throws:
ApfloatRuntimeException
-
acos
Inverse cosine. Calculated using complex functions.- Parameters:
x- The argument.- Returns:
- Inverse cosine of
x. - Throws:
ArithmeticException- Ifabs(x) > 1.ApfloatRuntimeException
-
asin
Inverse sine. Calculated using complex functions.- Parameters:
x- The argument.- Returns:
- Inverse sine of
x. - Throws:
ArithmeticException- Ifabs(x) > 1.ApfloatRuntimeException
-
atan
Inverse tangent. Calculated using complex functions.- Parameters:
x- The argument.- Returns:
- Inverse tangent of
x. - Throws:
ApfloatRuntimeException
-
atan2
public static Apfloat atan2(Apfloat y, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Converts cartesian coordinates to polar coordinates. Calculated using complex functions.Computes the phase angle by computing an arc tangent of
y/xin the range of -π < angle <= π.- Parameters:
y- The argument.x- The argument.- Returns:
- The angle of the point
(x, y)in the plane. - Throws:
ArithmeticException- Ifyandxare both zero.ApfloatRuntimeException
-
cos
Cosine. Calculated using complex functions.- Parameters:
x- The argument (in radians).- Returns:
- Cosine of
x. - Throws:
ApfloatRuntimeException
-
sin
Sine. Calculated using complex functions.- Parameters:
x- The argument (in radians).- Returns:
- Sine of
x. - Throws:
ApfloatRuntimeException
-
tan
Tangent. Calculated using complex functions.- Parameters:
x- The argument (in radians).- Returns:
- Tangent of
x. - Throws:
ArithmeticException- Ifxis π/2 + n π where n is an integer.ApfloatRuntimeException
-
sinc
Sinc.- Parameters:
x- The argument.- Returns:
- sinc(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.14.0
-
w
Lambert W function. The W function gives the solution to the equationW eW = x. Also known as the product logarithm.This function only gives the solution to the principal branch, W0. For the real-valued W-1 branch, use
ApcomplexMath.w(Apcomplex,long).- Parameters:
x- The argument.- Returns:
W0(x).- Throws:
ArithmeticException- Ifxis less than -1/e.ApfloatRuntimeException- Since:
- 1.8.0
-
toDegrees
Converts an angle measured in radians to degrees.- Parameters:
x- The angle, in radians.- Returns:
- The angle in degrees.
- Throws:
ApfloatRuntimeException- Since:
- 1.8.0
-
toRadians
Converts an angle measured in degrees to radians.- Parameters:
x- The angle, in degrees.- Returns:
- The angle in radians.
- Throws:
ApfloatRuntimeException- Since:
- 1.8.0
-
product
Product of numbers. The precision used in the multiplications is only what is needed for the end result. This method may perform significantly better than simply multiplying the numbers sequentially.If there are no arguments, the return value is
1.- Parameters:
x- The argument(s).- Returns:
- The product of the given numbers.
- Throws:
ApfloatRuntimeException- Since:
- 1.3
-
sum
Sum of numbers. The precision used in the additions is only what is needed for the end result. This method may perform significantly better than simply adding the numbers sequentially.If there are no arguments, the return value is
0.- Parameters:
x- The argument(s).- Returns:
- The sum of the given numbers.
- Throws:
ApfloatRuntimeException- Since:
- 1.3
-
e
public static Apfloat e(long precision) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates e. Uses default radix.- Parameters:
precision- Number of digits of e to calculate.- Returns:
- e accurate to
precisiondigits, in the default radix. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
-
e
public static Apfloat e(long precision, int radix) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates e.- Parameters:
precision- Number of digits of e to calculate.radix- The radix in which the number should be presented.- Returns:
- e accurate to
precisiondigits, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
-
euler
public static Apfloat euler(long precision) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates γ, the Euler-Mascheroni constant. Uses default radix.- Parameters:
precision- Number of digits of γ to calculate.- Returns:
- γ accurate to
precisiondigits, in the default radix. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.10.0
-
euler
public static Apfloat euler(long precision, int radix) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates γ, the Euler-Mascheroni constant.- Parameters:
precision- Number of digits of γ to calculate.radix- The radix in which the number should be presented.- Returns:
- γ accurate to
precisiondigits, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.10.0
-
catalan
public static Apfloat catalan(long precision) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates Catalan's constant, G. Uses the default radix.- Parameters:
precision- Number of digits of G to calculate.- Returns:
- G accurate to
precisiondigits, in the default radix. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow.
-
catalan
public static Apfloat catalan(long precision, int radix) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates Catalan's constant, G. Uses the specified radix.- Parameters:
precision- Number of digits of G to calculate.radix- The radix in which the number should be presented.- Returns:
- G accurate to
precisiondigits, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow.
-
glaisher
public static Apfloat glaisher(long precision) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates the Glaisher‐Kinkelin constant, A. Uses the default radix.- Parameters:
precision- Number of digits of A to calculate.- Returns:
- A accurate to
precisiondigits, in the default radix. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow. At the time of implementation no efficient algorithm is known for the Glaisher‐Kinkelin constant.
-
glaisher
public static Apfloat glaisher(long precision, int radix) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates the Glaisher‐Kinkelin constant, A. Uses the specified radix.- Parameters:
precision- Number of digits of A to calculate.radix- The radix in which the number should be presented.- Returns:
- A accurate to
precisiondigits, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow. At the time of implementation no efficient algorithm is known for the Glaisher‐Kinkelin constant.
-
khinchin
public static Apfloat khinchin(long precision) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates Khinchin's constant, K.Uses the default radix.- Parameters:
precision- Number of digits of K to calculate.- Returns:
- K accurate to
precisiondigits, in the default radix. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow. At the time of implementation no efficient algorithm is known for Khinchin's constant.
-
khinchin
public static Apfloat khinchin(long precision, int radix) throws IllegalArgumentException, NumberFormatException, ApfloatRuntimeException Calculates Khinchin's constant, K. Uses the specified radix.- Parameters:
precision- Number of digits of K to calculate.radix- The radix in which the number should be presented.- Returns:
- K accurate to
precisiondigits, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the precision is invalid.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow. At the time of implementation no efficient algorithm is known for Khinchin's constant.
-
gamma
Gamma function.- Parameters:
x- The argument.- Returns:
Γ(x)- Throws:
ArithmeticException- Ifxis a nonpositive integer.ApfloatRuntimeException- Since:
- 1.9.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the gamma function.
-
gamma
public static Apfloat gamma(Apfloat a, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Incomplete gamma function.- Parameters:
a- The first argument.x- The second argument.- Returns:
Γ(a, x)- Throws:
ArithmeticException- Ifais not a positive integer andxis nonpositive.ApfloatRuntimeException- Since:
- 1.10.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the gamma function.
-
gamma
public static Apfloat gamma(Apfloat a, Apfloat x0, Apfloat x1) throws ArithmeticException, ApfloatRuntimeException Generalized incomplete gamma function.This function is defined as:
Γ(a, x0, x1) = Γ(a, x0) - Γ(a, x1)The lower gamma function can be calculated with:
γ(a, x) = Γ(a, 0, x)- Parameters:
a- The first argument.x0- The second argument.x1- The third argument.- Returns:
Γ(a, x0, x1)- Throws:
ArithmeticException- Ifais not a positive integer and eitherx0orx1is nonpositive.ApfloatRuntimeException- Since:
- 1.10.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the gamma function.
-
logGamma
Logarithm of the gamma function.- Parameters:
x- The argument.- Returns:
logΓ(x)- Throws:
ArithmeticException- Ifxis nonpositive.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the gamma function.
-
digamma
Digamma function.- Parameters:
x- The argument.- Returns:
ψ(x)- Throws:
ArithmeticException- Ifxis a nonpositive integer.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the digamma function.
-
polygamma
public static Apfloat polygamma(long n, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Polygamma function.- Parameters:
n- The order.x- The argument.- Returns:
ψ(n)(x)- Throws:
ArithmeticException- Ifnis negative orxis a nonpositive integer.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the polygamma function.
-
beta
public static Apfloat beta(Apfloat a, Apfloat b) throws ArithmeticException, ApfloatRuntimeException Beta function.- Parameters:
a- The first argument.b- The second argument.- Returns:
- B(a, b)
- Throws:
ArithmeticException- Ifaorbis a nonpositive integer buta + bis not. Also if bothaandbare nonpositive integers.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the beta function.
-
beta
public static Apfloat beta(Apfloat x, Apfloat a, Apfloat b) throws ArithmeticException, ApfloatRuntimeException Incomplete beta function.- Parameters:
x- The first argument.a- The second argument.b- The third argument.- Returns:
- Bx(a, b)
- Throws:
ArithmeticException- Ifais a nonpositive integer orxis zero andais nonpositive orxis negative andais not an integer. Also ifx> 1 and the result is not a polynomial.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
beta
public static Apfloat beta(Apfloat x1, Apfloat x2, Apfloat a, Apfloat b) throws ArithmeticException, ApfloatRuntimeException Generalized incomplete beta function.- Parameters:
x1- The first argument.x2- The second argument.a- The third argument.b- The fourth argument.- Returns:
- B(x1, x2)(a, b)
- Throws:
ArithmeticException- Ifais a nonpositive integer orx1orx2is zero andais nonpositive orx1orx2is negative andais not an integer. Also ifx1> 1 orx2> 1 and the result is not a polynomial.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
pochhammer
public static Apfloat pochhammer(Apfloat x, Apfloat n) throws ArithmeticException, ApfloatRuntimeException Pochhammer symbol.- Parameters:
x- The first argument.n- The second argument.- Returns:
(x)n- Throws:
ArithmeticException- Ifx + nis a nonpositive integer butxis not.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. The asymptotic complexity is at least O(n2log n) and it is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the pochhammer symbol.
-
binomial
public static Apfloat binomial(Apfloat n, Apfloat k) throws ArithmeticException, ApfloatRuntimeException Binomial coefficient. Calculated using thegamma(Apfloat)function.- Parameters:
n- The first argument.k- The second argument.- Returns:
- Throws:
ArithmeticException- Ifnis a negative integer andkis noninteger.ApfloatRuntimeException- Since:
- 1.11.0
-
zeta
Riemann zeta function.- Parameters:
s- The argument.- Returns:
ζ(s)- Throws:
ArithmeticException- Ifsis1.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few hundred digits. At the time of implementation no generic fast algorithm is known for the zeta function.
-
zeta
public static Apfloat zeta(Apfloat s, Apfloat a) throws ArithmeticException, ApfloatRuntimeException Hurwitz zeta function.- Parameters:
s- The first argument.a- The second argument.- Returns:
ζ(s, a)- Throws:
ArithmeticException- Ifsis1or ifais a nonpositive integer or ifsis not an integer andais nonpositive.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few hundred digits. At the time of implementation no generic fast algorithm is known for the zeta function.
-
hypergeometric0F1
public static Apfloat hypergeometric0F1(Apfloat a, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Confluent hypergeometric function 0F1.- Parameters:
a- The first argument.x- The second argument.- Returns:
- 0F1(; a; x)
- Throws:
ArithmeticException- If the function value is not finite.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
hypergeometric0F1Regularized
public static Apfloat hypergeometric0F1Regularized(Apfloat a, Apfloat x) throws ApfloatRuntimeException Regularized confluent hypergeometric function 0F̃1.- Parameters:
a- The first argument.x- The second argument.- Returns:
- 0F̃1(; a; x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
hypergeometric1F1
public static Apfloat hypergeometric1F1(Apfloat a, Apfloat b, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Kummer confluent hypergeometric function 1F1. Also known as the confluent hypergeometric function of the first kind.- Parameters:
a- The first argument.b- The second argument.x- The third argument.- Returns:
- 1F1(a; b; x)
- Throws:
ArithmeticException- If the function value is not finite.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
hypergeometric1F1Regularized
public static Apfloat hypergeometric1F1Regularized(Apfloat a, Apfloat b, Apfloat x) throws ApfloatRuntimeException Regularized Kummer confluent hypergeometric function 1F̃1. Also known as the regularized confluent hypergeometric function of the first kind.- Parameters:
a- The first argument.b- The second argument.x- The third argument.- Returns:
- 1F̃1(a; b; x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
hypergeometric2F1
public static Apfloat hypergeometric2F1(Apfloat a, Apfloat b, Apfloat c, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Hypergeometric function 2F1. Also known as the Gaussian or ordinary hypergeometric function.- Parameters:
a- The first argument.b- The second argument.c- The third argument.x- The fourth argument.- Returns:
- 2F1(a, b; c; x)
- Throws:
ArithmeticException- If the function value is not finite or real.ApfloatRuntimeException- Since:
- 1.11.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
hypergeometric2F1Regularized
public static Apfloat hypergeometric2F1Regularized(Apfloat a, Apfloat b, Apfloat c, Apfloat x) throws ApfloatRuntimeException Regularized hypergeometric function 2F̃1. Also known as the regularized Gaussian or ordinary hypergeometric function.- Parameters:
a- The first argument.b- The second argument.c- The third argument.x- The fourth argument.- Returns:
- 2F̃1(a, b; c; x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
hypergeometricU
public static Apfloat hypergeometricU(Apfloat a, Apfloat b, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Tricomi's confluent hypergeometric function U. Also known as the confluent hypergeometric function of the second kind.- Parameters:
a- The first argument.b- The second argument.x- The third argument.- Returns:
- U(a, b, x)
- Throws:
ArithmeticException- If the result would be complex or not finite.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
erf
Error function.- Parameters:
x- The argument.- Returns:
- erf(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
erfc
Complementary error function.- Parameters:
x- The argument.- Returns:
- erfc(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
erfi
Imaginary error function.- Parameters:
x- The argument.- Returns:
- erfi(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
inverseErf
Inverse error function.- Parameters:
x- The argument.- Returns:
- erf−1(x)
- Throws:
ArithmeticException- If|x|is ≥ 1.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
inverseErfc
Inverse complementary error function.- Parameters:
x- The argument.- Returns:
- erfc−1(x)
- Throws:
ArithmeticException- Ifxis ≤ 0 or ≥ 2.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
fresnelS
Fresnel integral S.- Parameters:
x- The argument.- Returns:
- S(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
fresnelC
Fresnel integral C.- Parameters:
x- The argument.- Returns:
- C(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
expIntegralE
public static Apfloat expIntegralE(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Exponential integral E.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Eν(x)
- Throws:
ArithmeticException- Ifνis < 0 andxis zero orνis nonzero andxis negative.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
expIntegralEi
Exponential integral Ei.- Parameters:
x- The argument.- Returns:
- Ei(x)
- Throws:
ArithmeticException- Ifxis zero.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
logIntegral
Logarithmic integral.- Parameters:
x- The argument.- Returns:
- li(x)
- Throws:
ArithmeticException- Ifxis nonpositive or 1.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
sinIntegral
Sine integral.- Parameters:
x- The argument.- Returns:
- Si(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
cosIntegral
Cosine integral.- Parameters:
x- The argument.- Returns:
- Ci(x)
- Throws:
ArithmeticException- Ifxis nonpositive.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
sinhIntegral
Hyperbolic sine integral.- Parameters:
x- The argument.- Returns:
- Shi(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
coshIntegral
Hyperbolic cosine integral.- Parameters:
x- The argument.- Returns:
- Chi(x)
- Throws:
ArithmeticException- Ifxis nonpositive.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
airyAi
Airy function Ai.- Parameters:
x- The argument.- Returns:
- Ai(x)
- Throws:
InfiniteExpansionException- Ifxis zero.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
airyAiPrime
Derivative of the Airy function Ai.- Parameters:
x- The argument.- Returns:
- Ai′(x)
- Throws:
InfiniteExpansionException- Ifxis zero.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
airyBi
Airy function Bi.- Parameters:
x- The argument.- Returns:
- Bi(x)
- Throws:
InfiniteExpansionException- Ifxis zero.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
airyBiPrime
Derivative of the Airy function Bi.- Parameters:
x- The argument.- Returns:
- Bi′(x)
- Throws:
InfiniteExpansionException- Ifxis zero.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
besselJ
public static Apfloat besselJ(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Bessel function of the first kind.- Parameters:
ν- The order.x- The argument.- Returns:
- Jν(x)
- Throws:
ArithmeticException- Ifνis < 0 andνis not an integer andxis zero. Also ifνis not an integer andxis < 0.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
besselI
public static Apfloat besselI(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Modified Bessel function of the first kind.- Parameters:
ν- The order.x- The argument.- Returns:
- Iν(x)
- Throws:
ArithmeticException- Ifνis < 0 andνis not an integer andxis zero. Also ifνis not an integer andxis < 0.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
besselY
public static Apfloat besselY(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Bessel function of the second kind.- Parameters:
ν- The order.x- The argument.- Returns:
- Yν(x)
- Throws:
ArithmeticException- Ifxis ≤ 0.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
besselK
public static Apfloat besselK(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Modified Bessel function of the second kind.- Parameters:
ν- The order.x- The argument.- Returns:
- Kν(x)
- Throws:
ArithmeticException- Ifxis ≤ 0.ApfloatRuntimeException- Since:
- 1.13.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
ellipticK
Complete elliptic integral of the first kind.Note that this function uses the definition:
- Parameters:
x- The argument.- Returns:
- K(x)
- Throws:
InfiniteExpansionException- Ifxis zero.ArithmeticException- Ifxis ≥ 1.ApfloatRuntimeException- Since:
- 1.13.0
-
ellipticE
Complete elliptic integral of the second kind.Note that this function uses the definition:
- Parameters:
x- The argument.- Returns:
- E(x)
- Throws:
InfiniteExpansionException- Ifxis zero.ArithmeticException- Ifxis > 1.ApfloatRuntimeException- Since:
- 1.13.0
-
hermiteH
Hermite function. For integer values ofνgives the Hermite polynomial.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Hν(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
laguerreL
Laguerre function. For integer values ofνgives the Laguerre polynomial.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Lν(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
laguerreL
Generalized Laguerre function. For integer values ofνgives the generalized Laguerre polynomial.- Parameters:
ν- The first argument.λ- The second argument.x- The third argument.- Returns:
- Lνλ(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
legendreP
public static Apfloat legendreP(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Legendre function. For integer values ofνgives the Legendre polynomial.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Pν(x)
- Throws:
ArithmeticException- Ifνis not an integer andx≤ -1.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
legendreP
public static Apfloat legendreP(Apfloat ν, Apfloat μ, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Associated Legendre function of the first kind. Gives Legendre functions of type 2.- Parameters:
ν- The first argument.μ- The second argument.x- The third argument.- Returns:
- Pνμ(x)
- Throws:
ArithmeticException- Ifxis ≤ -1 or ≥ 1 andνorμis not an integer orμis not even orμis not positive and-μ≤ν<μ.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
legendreQ
public static Apfloat legendreQ(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Legendre function of the second kind.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Qν(x)
- Throws:
ArithmeticException- Ifxis ≥ 1 or ≤ -1.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
legendreQ
public static Apfloat legendreQ(Apfloat ν, Apfloat μ, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Associated Legendre function of the second kind. Gives Legendre functions of type 2.- Parameters:
ν- The first argument.μ- The second argument.x- The third argument.- Returns:
- Qνμ(x)
- Throws:
ArithmeticException- Ifxis ≥ 1 or ≤ -1.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
chebyshevT
public static Apfloat chebyshevT(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Chebyshev function of the first kind. For integer values ofνgives the Chebyshev polynomial of the first kind.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Tν(x)
- Throws:
ArithmeticException- Ifxis < -1 andνis not an integer.ApfloatRuntimeException- Since:
- 1.14.0
-
chebyshevU
public static Apfloat chebyshevU(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Chebyshev function of the second kind. For integer values ofνgives the Chebyshev polynomial of the second kind.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Uν(x)
- Throws:
ArithmeticException- Ifxis ≤ -1 andνis not an integer.ApfloatRuntimeException- Since:
- 1.14.0
-
gegenbauerC
public static Apfloat gegenbauerC(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Renormalized Gegenbauer function.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Cν(0)(x)
- Throws:
ArithmeticException- Ifνis zero. Also ifxis < -1 andνis not an integer.ApfloatRuntimeException- Since:
- 1.14.0
-
gegenbauerC
public static Apfloat gegenbauerC(Apfloat ν, Apfloat λ, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Gegenbauer function. For nonnegative integer values ofνgives the Gegenbauer polynomial.- Parameters:
ν- The first argument.λ- The second argument.x- The third argument.- Returns:
- Cνλ(x)
- Throws:
ArithmeticException- Ifxis < -1 andνis not an integer. Also ifxis -1 andλis > 1/2. Also ifxis -1 andλis 1/2 andνis not an integer.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
jacobiP
public static Apfloat jacobiP(Apfloat ν, Apfloat a, Apfloat b, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Jacobi function. For nonnegative integer values ofνgives the Jacobi polynomial.- Parameters:
ν- The first argument.a- The second argument.b- The third argument.x- The fourth argument.- Returns:
- Pν(a,b)(x)
- Throws:
ArithmeticException- Ifνis not a positive integer and eitherxis -1 andbis > 0 orxis < -1. Also ifν + ais a negative integer andνis not an integer.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
fibonacci
Fibonacci function. For nonnegative integer values ofνgives the Fibonacci polynomial.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Fν(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.14.0
-
eulerE
public static Apfloat eulerE(long n, Apfloat x) throws IllegalArgumentException, ApfloatRuntimeException Euler polynomial.- Parameters:
n- The first argument.x- The second argument.- Returns:
- En(x)
- Throws:
IllegalArgumentException- Ifn< 0.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
bernoulliB
public static Apfloat bernoulliB(long n, Apfloat x) throws IllegalArgumentException, ApfloatRuntimeException Bernoulli polynomial.- Parameters:
n- The first argument.x- The second argument.- Returns:
- Bn(x)
- Throws:
IllegalArgumentException- Ifn< 0.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
harmonicNumber
Harmonic number.- Parameters:
x- The argument.- Returns:
- Hx
- Throws:
ArithmeticException- Ifxis a negative integer.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
harmonicNumber
public static Apfloat harmonicNumber(Apfloat x, Apfloat r) throws ArithmeticException, ApfloatRuntimeException Generalized harmonic number.- Parameters:
x- The first argument.r- The second argument.- Returns:
- Hx(r)
- Throws:
ArithmeticException- Ifxis a negative integer, unlessris a nonpositive integer. Also ifxis < -1 andris not an integer.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
polylog
public static Apfloat polylog(Apfloat ν, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Polylogarithm.- Parameters:
ν- The first argument.x- The second argument.- Returns:
- Liν(x)
- Throws:
ArithmeticException- Ifνis ≤ 1 andxis 1 or ifxis > 1.ApfloatRuntimeException- Since:
- 1.14.0
- Implementation notes:
- This implementation is slow, meaning that it isn't a fast algorithm. It is impractically slow beyond a precision of a few thousand digits. At the time of implementation no generic fast algorithm is known for the function.
-
logisticSigmoid
Logistic sigmoid.- Parameters:
x- The argument.- Returns:
- σ(x)
- Throws:
ApfloatRuntimeException- Since:
- 1.14.0
-
random
Generates a random number. Uses the default radix. Returned values are chosen pseudorandomly with (approximately) uniform distribution from the range0 ≤ x < 1. The generated random numbers may have leading zeros and may thus not always have exactly the requested number of significant digits. The precision of the numbers is the requested number of digits minus the number of leading zeros. Trailing zeros do not affect the precision.- Parameters:
digits- Maximum number of digits in the number.- Returns:
- A random number, uniformly distributed between
0 ≤ x < 1. - Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the number of specified digits is invalid.- Since:
- 1.9.0
-
random
Generates a random number. Returned values are chosen pseudorandomly with (approximately) uniform distribution from the range0 ≤ x < 1. The generated random numbers may have leading zeros and may thus not always have exactly the requested number of significant digits. The precision of the numbers is the requested number of digits minus the number of leading zeros. Trailing zeros do not affect the precision.- Parameters:
digits- Maximum number of digits in the number.radix- The radix in which the number should be generated.- Returns:
- A random number, uniformly distributed between
0 ≤ x < 1, in baseradix. - Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the number of specified digits is invalid.- Since:
- 1.9.0
-
randomGaussian
Generates a random, Gaussian ("normally") distributed number value with mean 0 and standard deviation 1. Uses the default radix.- Parameters:
digits- Maximum number of digits in the number.- Returns:
- A random number, Gaussian ("normally") distributed with mean 0 and standard deviation 1.
- Throws:
NumberFormatException- If the default radix is not valid.IllegalArgumentException- In case the number of specified digits is invalid.- Since:
- 1.9.0
-
randomGaussian
Generates a random, Gaussian ("normally") distributed number value with mean 0 and standard deviation 1. Uses the default radix.- Parameters:
digits- Maximum number of digits in the number.radix- The radix in which the number should be generated.- Returns:
- A random number, Gaussian ("normally") distributed with mean 0 and standard deviation 1.
- Throws:
NumberFormatException- If the radix is not valid.IllegalArgumentException- In case the number of specified digits is invalid.- Since:
- 1.9.0
-
continuedFraction
Generates the firstnterms in the continued fraction representation ofx.Note that the result length might be less than
n, depending on the input value and precision. The last terms could be incorrect due to accumulating round-off errors.- Parameters:
x- The number whose continued fraction terms should be generated.n- The maximum number of terms to generate.- Returns:
- The continued fraction.
- Throws:
IllegalArgumentException- Ifnis less than one.- Since:
- 1.12.0
-
convergents
Generates the firstnconvergents corresponding to the continued fraction ofx.Note that the result length might be less than
n, depending on the input value and precision. The last convergents could be incorrect due to accumulating round-off errors.- Parameters:
x- The number whose continued fraction convergents should be generated.n- The maximum number of convergents to generate.- Returns:
- The convergents.
- Throws:
IllegalArgumentException- Ifnis less than one.- Since:
- 1.12.0
-
max
-
min
-
nextAfter
Returns the number adjacent to the first argument in the direction of the second argument, considering the scale and precision of the first argument. If the precision of the first argument is infinite, the first argument is returned. If both arguments compare as equal then the first argument is returned.- Parameters:
start- The starting value.direction- Value indicating which ofstart's neighbors orstartshould be returned.- Returns:
- The number adjacent to
startin the direction ofdirection. - Since:
- 1.10.0
-
nextUp
Returns the number adjacent to the argument in the direction of positive infinity, considering the scale and precision of the argument. If the precision of the argument is infinite, the argument is returned.- Parameters:
x- The starting value.- Returns:
- The adjacent value closer to positive infinity.
- Since:
- 1.10.0
-
nextDown
Returns the number adjacent to the argument in the direction of negative infinity, considering the scale and precision of the argument. If the precision of the argument is infinite, the argument is returned.- Parameters:
x- The starting value.- Returns:
- The adjacent value closer to negative infinity.
- Since:
- 1.10.0
-
ulp
Returns the unit in the last place of the argument, considering the scale and precision. This is same as the difference between the argument and the value returned fromnextUp(Apfloat). If the precision of the argument is infinite, zero is returned.For example, ulp of
1.is1, ulp of1.1is0.1and ulp of1.001is0.001(considering significant digits only).- Parameters:
x- The argument.- Returns:
- The ulp of the argument.
- Since:
- 1.10.0
-
Apfloat.negate().