Package org.apfloat
Class FixedPrecisionApfloatHelper
java.lang.Object
org.apfloat.FixedPrecisionApcomplexHelper
org.apfloat.FixedPrecisionApfloatHelper
Fixed-precision mathematical functions for floating-point numbers.
All results of the mathematical operations are set to have the specified precision.
Also all input arguments are set to the specified precision before the operation.
If the specified precision is not infinite, this helper class also avoids
InfiniteExpansionException
e.g. in case where it would happen with
ApfloatMath.acos(Apfloat.ZERO)
.
- Since:
- 1.5
- Version:
- 1.14.0
- Author:
- Mikko Tommila
-
Constructor Summary
ConstructorsConstructorDescriptionFixedPrecisionApfloatHelper
(long precision) Constructs an apfloat fixed-precison helper with the specified precision. -
Method Summary
Modifier and TypeMethodDescriptionAbsolute value.Arc cosine.Hyperbolic arc cosine.Addition.Arithmetic-geometric mean.Airy function Ai.Derivative of the Airy function Ai.Airy function Bi.Derivative of the Airy function Bi.Arc sine.Hyperbolic arc sine.Arc tangent.Angle of point.Hyperbolic arc tangent.bernoulliB
(long n, Apfloat x) Bernoulli polynomial.Modified Bessel function of the first kind.Bessel function of the first kind.Modified Bessel function of the second kind.Bessel function of the second kind.Beta function.Incomplete beta function.Generalized incomplete beta function.Binomial coefficient.Cube root.Ceiling function.chebyshevT
(Apfloat ν, Apfloat x) Chebyshev function of the first kind.chebyshevU
(Apfloat ν, Apfloat x) Chebyshev function of the second kind.Apfloat[]
continuedFraction
(Apfloat x, int n) Continued fraction.Apfloat[]
convergents
(Apfloat x, int n) Convergents.Copies the sign from one number to another.Cosine.Hyperbolic cosine.Hyperbolic cosine integral.Cosine integral.Digamma function.Division.doubleFactorial
(long n) Double factorial.doubleFactorial
(long n, int radix) Double factorial.Complete elliptic integral of the second kind.Complete elliptic integral of the first kind.Error function.Complementary error function.Imaginary error function.Euler polynomial.Exponential function.expIntegralE
(Apfloat ν, Apfloat x) Exponential integral E.Exponential integral Ei.factorial
(long n) Factorial.factorial
(long n, int radix) Factorial.Fibonacci function.Floor function.Modulus.Extract fractional part.Fresnel integral C.Fresnel integral S.Gamma function.Incomplete gamma function.Generalized incomplete gamma function.gegenbauerC
(Apfloat ν, Apfloat x) Renormalized Gegenbauer function.gegenbauerC
(Apfloat ν, Apfloat λ, Apfloat x) Gegenbauer function.Harmonic number.harmonicNumber
(Apfloat x, Apfloat r) Generalized harmonic number.Hermite function.hypergeometric0F1
(Apfloat a, Apfloat x) Confluent hypergeometric function 0F1.Regularized confluent hypergeometric function 0F̃1.hypergeometric1F1
(Apfloat a, Apfloat b, Apfloat x) Kummer confluent hypergeometric function 1F1.Regularized Kummer confluent hypergeometric function 1F̃1.hypergeometric2F1
(Apfloat a, Apfloat b, Apfloat c, Apfloat x) Hypergeometric function 2F1.hypergeometric2F1Regularized
(Apfloat a, Apfloat b, Apfloat c, Apfloat x) Regularized hypergeometric function 2F̃1.hypergeometricU
(Apfloat a, Apfloat b, Apfloat x) Tricomi's confluent hypergeometric function U.Inverse error function.Inverse complementary error function.inverseRoot
(Apfloat x, long n) Inverse root.Jacobi function.Laguerre function.Generalized Laguerre function.Legendre function.Associated Legendre function of the first kind.Legendre function of the second kind.Associated Legendre function of the second kind.Natural logarithm.Logarithm in specified base.Logarithm of the gamma function.Logarithmic integral.Logistic sigmoid.logRadix
(int radix) Logarithm.Maximum value.Minimum value.Modulus.Apfloat[]
Split to integer and fractional parts.Multiplication.multiplyAdd
(Apfloat a, Apfloat b, Apfloat c, Apfloat d) Fused multiply-add.multiplySubtract
(Apfloat a, Apfloat b, Apfloat c, Apfloat d) Fused multiply-subtract.Negation.The number adjacent to the first argument in the direction of the second argument.The adjacent value closer to negative infinity.The adjacent value closer to positive infinity.pi()
π.pi
(int radix) π.pochhammer
(Apfloat x, Apfloat n) Pochhammer symbol.Polygamma function.Polylogarithm.Integer power.Power.Product.random()
Return a uniformly distributed random number0 ≤ x < 1
.random
(int radix) Return a uniformly distributed random number0 ≤ x < 1
.Return a normally distributed random number with mean 0 and standard deviation 1.randomGaussian
(int radix) Return a normally distributed random number with mean 0 and standard deviation 1.Root.round
(Apfloat x, RoundingMode roundingMode) Deprecated.roundToInteger
(Apfloat x, RoundingMode roundingMode) Round to integer with specified rounding mode.roundToMultiple
(Apfloat x, Apfloat y, RoundingMode roundingMode) Round to multiple with specified rounding mode.roundToPlaces
(Apfloat x, long places, RoundingMode roundingMode) Round to specified number of places with specified rounding mode.roundToPrecision
(Apfloat x, RoundingMode roundingMode) Round to precision with specified rounding mode.Move the radix point.Sine.Sinc.Hyperbolic sine.Hyperbolic sine integral.Sine integral.Square root.Subtraction.Sum.Tangent.Hyperbolic tangent.Convert radians to degrees.Convert degrees to radians.Truncate fractional part.Unit in the last place.Returns the value with the specified precision.Lambert W function.Riemann zeta function.Hurwitz zeta function.Methods inherited from class org.apfloat.FixedPrecisionApcomplexHelper
abs, acos, acosh, add, agm, airyAi, airyAiPrime, airyBi, airyBiPrime, allRoots, arg, asin, asinh, atan, atanh, bernoulli, bernoulli, bernoulliB, besselI, besselJ, besselK, besselY, beta, beta, beta, binomial, binomial, binomial, catalan, catalan, cbrt, chebyshevT, chebyshevU, conj, cos, cosh, coshIntegral, cosIntegral, digamma, divide, e, e, ellipticE, ellipticK, erf, erfc, erfi, euler, euler, eulerE, exp, expIntegralE, expIntegralEi, fibonacci, fresnelC, fresnelS, gamma, gamma, gamma, gegenbauerC, gegenbauerC, glaisher, glaisher, harmonicNumber, harmonicNumber, hermiteH, hypergeometric0F1, hypergeometric0F1Regularized, hypergeometric1F1, hypergeometric1F1Regularized, hypergeometric2F1, hypergeometric2F1Regularized, hypergeometricU, imag, inverseRoot, inverseRoot, jacobiP, khinchin, khinchin, laguerreL, laguerreL, legendreP, legendreP, legendreQ, legendreQ, log, log, logGamma, logIntegral, logisticSigmoid, multiply, negate, norm, pochhammer, polygamma, polylog, pow, pow, precision, product, real, root, root, scale, sin, sinc, sinh, sinhIntegral, sinIntegral, sphericalHarmonicY, sqrt, subtract, sum, tan, tanh, ulp, valueOf, w, w, zeta, zeta
-
Constructor Details
-
FixedPrecisionApfloatHelper
Constructs an apfloat fixed-precison helper with the specified precision. The results of all mathematical operations are set to the specified precision.- Parameters:
precision
- The precision of the results.- Throws:
IllegalArgumentException
- In case the precision is invalid.
-
-
Method Details
-
valueOf
-
negate
Negation.- Parameters:
x
- The value to negate.- Returns:
-x
.- Throws:
ApfloatRuntimeException
-
add
Addition.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
x + y
.- Throws:
ApfloatRuntimeException
-
subtract
Subtraction.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
x - y
.- Throws:
ApfloatRuntimeException
-
multiply
Multiplication.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
x * y
.- Throws:
ApfloatRuntimeException
-
divide
Division.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
x / y
.- Throws:
ArithmeticException
- Ify
is zero.ApfloatRuntimeException
-
pow
Power.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
xy
.- Throws:
ArithmeticException
- Ifx
andy
are zero, orx
is negative andy
is not an integer.ApfloatRuntimeException
-
pow
Integer power.- Parameters:
x
- The first operand.n
- The second operand.- Returns:
xn
.- Throws:
ArithmeticException
- Ifx
andn
are zero, orx
is zero andn
is negative.ApfloatRuntimeException
-
abs
Absolute value.- Parameters:
x
- The operand.- Returns:
- The absolute value of
x
. - Throws:
ApfloatRuntimeException
-
acos
Arc cosine.- Parameters:
x
- The operand.- Returns:
- The arc cosine of
x
. - Throws:
ArithmeticException
- If the absolute value ofx
is more than one.ApfloatRuntimeException
-
acosh
Hyperbolic arc cosine.- Parameters:
x
- The operand.- Returns:
- The hyperbolic arc cosine of
x
. - Throws:
ArithmeticException
- If thex
is less than one.ApfloatRuntimeException
-
asin
Arc sine.- Parameters:
x
- The operand.- Returns:
- The arc sine of
x
. - Throws:
ArithmeticException
- If the absolute value ofx
is more than one.ApfloatRuntimeException
-
asinh
Hyperbolic arc sine.- Parameters:
x
- The operand.- Returns:
- The hyperbolic arc sine of
x
. - Throws:
ApfloatRuntimeException
-
atan
Arc tangent.- Parameters:
x
- The operand.- Returns:
- The arc tangent of
x
. - Throws:
ApfloatRuntimeException
-
atanh
Hyperbolic arc tangent.- Parameters:
x
- The operand.- Returns:
- The hyperbolic arc tangent of
x
. - Throws:
ArithmeticException
- If the absolute value ofx
is equal to or more than one.ApfloatRuntimeException
-
cbrt
Cube root.- Parameters:
x
- The operand.- Returns:
- The cube root of
x
. - Throws:
ApfloatRuntimeException
-
cos
Cosine.- Parameters:
x
- The operand.- Returns:
- The cosine of
x
. - Throws:
ApfloatRuntimeException
-
cosh
Hyperbolic cosine.- Parameters:
x
- The operand.- Returns:
- The hyperbolic cosine of
x
. - Throws:
ApfloatRuntimeException
-
exp
Exponential function.- Parameters:
x
- The operand.- Returns:
ex
.- Throws:
ApfloatRuntimeException
-
log
Natural logarithm.- Parameters:
x
- The operand.- Returns:
- The natural logarithm of
x
. - Throws:
ArithmeticException
- Ifx
is less than or equal to zero.ApfloatRuntimeException
-
log
Logarithm in specified base.- Parameters:
x
- The operand.b
- The base.- Returns:
- The base-
b
logarithm ofx
. - Throws:
ArithmeticException
- Ifx
orb
is less than or equal to zero.ApfloatRuntimeException
- Since:
- 1.6
-
sin
Sine.- Parameters:
x
- The operand.- Returns:
- The sine of
x
. - Throws:
ApfloatRuntimeException
-
sinh
Hyperbolic sine.- Parameters:
x
- The operand.- Returns:
- The hyperbolic sine of
x
. - Throws:
ApfloatRuntimeException
-
sqrt
Square root.- Parameters:
x
- The operand.- Returns:
- The square root of
x
. - Throws:
ArithmeticException
- Ifx
is negative.ApfloatRuntimeException
-
tan
Tangent.- Parameters:
x
- The operand.- Returns:
- The tangent of
x
. - Throws:
ArithmeticException
- Ifx
is π/2 + n π where n is an integer.ApfloatRuntimeException
-
tanh
Hyperbolic tangent.- Parameters:
x
- The operand.- Returns:
- The hyperbolic tangent of
x
. - Throws:
ApfloatRuntimeException
-
sinc
Sinc.- Parameters:
x
- The argument.- Returns:
- sinc(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
agm
Arithmetic-geometric mean.- Parameters:
a
- The first operand.b
- The first operand.- Returns:
- The arithmetic-geometric mean of
a
andb
. - Throws:
ApfloatRuntimeException
-
inverseRoot
Inverse root.- Parameters:
x
- The operand.n
- Which inverse root to take.- Returns:
x-1/n
.- Throws:
ArithmeticException
- Ifx
orn
is zero, orx
is negative andn
is even.ApfloatRuntimeException
-
root
Root.- Parameters:
x
- The operand.n
- Which root to take.- Returns:
x1/n
.- Throws:
ArithmeticException
- Ifn
is zero, orx
is negative andn
is even.ApfloatRuntimeException
-
scale
Move the radix point.- Parameters:
x
- The operand.scale
- The amount to move the radix point.- Returns:
x * x.radix()scale
.- Throws:
ApfloatRuntimeException
-
mod
Modulus.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
x % y
.- Throws:
ApfloatRuntimeException
-
ceil
Ceiling function.- Parameters:
x
- The operand.- Returns:
- The nearest integer greater than or equal to
x
. - Throws:
ApfloatRuntimeException
-
floor
Floor function.- Parameters:
x
- The operand.- Returns:
- The nearest integer less than or equal to
x
. - Throws:
ApfloatRuntimeException
-
truncate
Truncate fractional part.- Parameters:
x
- The operand.- Returns:
- The nearest integer rounded towards zero from
x
. - Throws:
ApfloatRuntimeException
-
frac
Extract fractional part.- Parameters:
x
- The operand.- Returns:
- The fractional part of
x
. - Throws:
ApfloatRuntimeException
- Since:
- 1.7.0
-
round
@Deprecated public Apfloat round(Apfloat x, RoundingMode roundingMode) throws ApfloatRuntimeException Deprecated.Round with specified rounding mode.- Parameters:
x
- The operand.roundingMode
- The rounding mode.- Returns:
x
rounded with the specified rounding mode.- Throws:
ApfloatRuntimeException
- Since:
- 1.7.0
-
roundToPrecision
public Apfloat roundToPrecision(Apfloat x, RoundingMode roundingMode) throws ApfloatRuntimeException Round to precision with specified rounding mode.- Parameters:
x
- The operand.roundingMode
- The rounding mode.- Returns:
x
rounded to the precision of this helper with the specified rounding mode.- Throws:
ArithmeticException
- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY
.ApfloatRuntimeException
- Since:
- 1.11.0
-
roundToInteger
public Apfloat roundToInteger(Apfloat x, RoundingMode roundingMode) throws ApfloatRuntimeException, ArithmeticException Round to integer with specified rounding mode.- Parameters:
x
- The operand.roundingMode
- The rounding mode.- Returns:
x
rounded to integer with the specified rounding mode.- Throws:
ArithmeticException
- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY
.ApfloatRuntimeException
- Since:
- 1.11.0
-
roundToPlaces
public Apfloat roundToPlaces(Apfloat x, long places, RoundingMode roundingMode) throws ApfloatRuntimeException, ArithmeticException Round to specified number of places with specified rounding mode.- Parameters:
x
- The operand.places
- The number of places.roundingMode
- The rounding mode.- Returns:
x
rounded to the specified number of places with the specified rounding mode.- Throws:
ArithmeticException
- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY
.ApfloatRuntimeException
- Since:
- 1.11.0
-
roundToMultiple
public Apfloat roundToMultiple(Apfloat x, Apfloat y, RoundingMode roundingMode) throws ApfloatRuntimeException, ArithmeticException Round to multiple with specified rounding mode.- Parameters:
x
- The number to round.y
- The integer multiple to round to.roundingMode
- The rounding mode.- Returns:
x
rounded to the nearest multiple ofy
with the specified rounding mode.- Throws:
ArithmeticException
- If rounding is necessary (result is not exact) and rounding mode isRoundingMode.UNNECESSARY
.ApfloatRuntimeException
- Since:
- 1.11.0
-
w
Lambert W function.- Parameters:
x
- The operand.- Returns:
W0(x)
.- Throws:
ApfloatRuntimeException
- Since:
- 1.8.0
-
toDegrees
Convert radians to degrees.- Parameters:
x
- The angle in radians.- Returns:
x
converted to degrees.- Throws:
ApfloatRuntimeException
- Since:
- 1.8.0
-
toRadians
Convert degrees to radians.- Parameters:
x
- The angle in degrees.- Returns:
x
converted to radians.- Throws:
ApfloatRuntimeException
- Since:
- 1.8.0
-
atan2
Angle of point.- Parameters:
x
- The operand.y
- The operand.- Returns:
- The angle of the point
(y, x)
. - Throws:
ArithmeticException
- Ifx
andy
are zero.ApfloatRuntimeException
-
copySign
Copies the sign from one number to another.- Parameters:
x
- The number to copy the sign to.y
- The number to copy the sign from.- Returns:
x
with the sign ofy
.- Throws:
ApfloatRuntimeException
-
fmod
Modulus.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
x % y
.- Throws:
ApfloatRuntimeException
-
modf
Split to integer and fractional parts.- Parameters:
x
- The operand.- Returns:
- An array of two numbers
[i, f]
wherei
isfloor(x)
andf
isx - floor(x)
. - Throws:
ApfloatRuntimeException
-
factorial
Factorial.- Parameters:
n
- The operand.- Returns:
n!
.- Throws:
ApfloatRuntimeException
-
factorial
Factorial.- Parameters:
n
- The operand.radix
- The radix of the result.- Returns:
n!
.- Throws:
ApfloatRuntimeException
-
doubleFactorial
Double factorial.- Parameters:
n
- The operand.- Returns:
n!!
.- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
doubleFactorial
Double factorial.- Parameters:
n
- The operand.radix
- The radix of the result.- Returns:
n!!
.- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
pi
-
pi
π.- Parameters:
radix
- The radix of the result.- Returns:
π
.- Throws:
NumberFormatException
- If the radix is invalid.ApfloatRuntimeException
-
logRadix
Logarithm.- Parameters:
radix
- The radix of the result.- Returns:
log(radix)
.- Throws:
NumberFormatException
- If the radix is invalid.ApfloatRuntimeException
-
multiplyAdd
public Apfloat multiplyAdd(Apfloat a, Apfloat b, Apfloat c, Apfloat d) throws ApfloatRuntimeException Fused multiply-add.- Parameters:
a
- The first operand.b
- The second operand.c
- The third operand.d
- The fourth operand.- Returns:
a * b + c * d
.- Throws:
ApfloatRuntimeException
-
multiplySubtract
public Apfloat multiplySubtract(Apfloat a, Apfloat b, Apfloat c, Apfloat d) throws ApfloatRuntimeException Fused multiply-subtract.- Parameters:
a
- The first operand.b
- The second operand.c
- The third operand.d
- The fourth operand.- Returns:
a * b - c * d
.- Throws:
ApfloatRuntimeException
-
product
Product.- Parameters:
x
- The operand(s).- Returns:
- The product of the operands.
- Throws:
ApfloatRuntimeException
-
sum
Sum.- Parameters:
x
- The operand(s).- Returns:
- The sum of the operands.
- Throws:
ApfloatRuntimeException
-
gamma
Gamma function.- Parameters:
x
- The operand.- Returns:
Γ(x)
.- Throws:
ArithmeticException
- Ifx
is a nonpositive integer.ApfloatRuntimeException
- Since:
- 1.9.0
-
gamma
Incomplete gamma function.- Parameters:
a
- The first operand.x
- The second operand.- Returns:
Γ(a, x)
.- Throws:
ArithmeticException
- Ifa
is not a positive integer andx
is nonpositive.ApfloatRuntimeException
- Since:
- 1.10.0
-
gamma
public Apfloat gamma(Apfloat a, Apfloat x0, Apfloat x1) throws ArithmeticException, ApfloatRuntimeException Generalized incomplete gamma function.- Parameters:
a
- The first operand.x0
- The second operand.x1
- The third operand.- Returns:
Γ(a, x0) - Γ(a, x1)
.- Throws:
ArithmeticException
- Ifa
is not a positive integer and eitherx0
orx1
is nonpositive.ApfloatRuntimeException
- Since:
- 1.10.0
-
logGamma
Logarithm of the gamma function.- Parameters:
x
- The argument.- Returns:
logΓ(x)
- Throws:
ArithmeticException
- Ifx
is nonpositive.ApfloatRuntimeException
- Since:
- 1.11.0
-
digamma
Digamma function.- Parameters:
x
- The argument.- Returns:
ψ(x)
- Throws:
ArithmeticException
- Ifx
is a nonpositive integer.ApfloatRuntimeException
- Since:
- 1.11.0
-
polygamma
Polygamma function.- Parameters:
n
- The order.x
- The argument.- Returns:
ψ(n)(x)
- Throws:
ArithmeticException
- Ifn
is negative orx
is a nonpositive integer.ApfloatRuntimeException
- Since:
- 1.13.0
-
beta
Beta function.- Parameters:
a
- The first argument.b
- The second argument.- Returns:
- B(a, b)
- Throws:
ArithmeticException
- Ifa
orb
is a nonpositive integer buta + b
is not. Also if botha
andb
are nonpositive integers.ApfloatRuntimeException
- Since:
- 1.13.0
-
beta
public 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
- Ifa
is a nonpositive integer orx
is zero anda
is nonpositive orx
is negative anda
is not an integer. Also ifx
> 1 and the result is not a polynomial.ApfloatRuntimeException
- Since:
- 1.13.0
-
beta
public 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
- Ifa
is a nonpositive integer orx1
orx2
is zero anda
is nonpositive orx1
orx2
is negative anda
is not an integer. Also ifx1
> 1 orx2
> 1 and the result is not a polynomial.ApfloatRuntimeException
- Since:
- 1.13.0
-
pochhammer
Pochhammer symbol.- Parameters:
x
- The first argument.n
- The second argument.- Returns:
(x)n
- Throws:
ArithmeticException
- Ifx + n
is a nonpositive integer butx
is not.ApfloatRuntimeException
- Since:
- 1.13.0
-
binomial
Binomial coefficient.- Parameters:
n
- The argument.k
- The argument.- Returns:
- The binomial coefficient.
- Throws:
ArithmeticException
- Ifn
,k
orn - k
is a nonpositive integer.ApfloatRuntimeException
- Since:
- 1.11.0
-
zeta
Riemann zeta function.- Parameters:
s
- The argument.- Returns:
ζ(s)
- Throws:
ArithmeticException
- Ifs
is1
.ApfloatRuntimeException
- Since:
- 1.11.0
-
zeta
Hurwitz zeta function.- Parameters:
s
- The first argument.a
- The second argument.- Returns:
ζ(s, a)
- Throws:
ArithmeticException
- Ifs
is1
or ifa
is a nonpositive integer or ifs
is not an integer anda
is nonpositive.ApfloatRuntimeException
- Since:
- 1.11.0
-
hypergeometric0F1
public 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
-
hypergeometric0F1Regularized
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
-
hypergeometric1F1
public Apfloat hypergeometric1F1(Apfloat a, Apfloat b, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Kummer confluent hypergeometric function 1F1.- 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
-
hypergeometric1F1Regularized
public Apfloat hypergeometric1F1Regularized(Apfloat a, Apfloat b, Apfloat x) throws ApfloatRuntimeException Regularized Kummer confluent hypergeometric function 1F̃1.- 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
-
hypergeometric2F1
public Apfloat hypergeometric2F1(Apfloat a, Apfloat b, Apfloat c, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Hypergeometric function 2F1.- 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
-
hypergeometric2F1Regularized
public Apfloat hypergeometric2F1Regularized(Apfloat a, Apfloat b, Apfloat c, Apfloat x) throws ApfloatRuntimeException Regularized hypergeometric function 2F̃1.- 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
-
hypergeometricU
public Apfloat hypergeometricU(Apfloat a, Apfloat b, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Tricomi's confluent hypergeometric function U.- 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
-
erf
Error function.- Parameters:
x
- The argument.- Returns:
- erf(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
erfc
Complementary error function.- Parameters:
x
- The argument.- Returns:
- erfc(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
erfi
Imaginary error function.- Parameters:
x
- The argument.- Returns:
- erfi(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
inverseErf
Inverse error function.- Parameters:
x
- The argument.- Returns:
- erf−1(x)
- Throws:
ArithmeticException
- If|x|
is ≥ 1.ApfloatRuntimeException
- Since:
- 1.13.0
-
inverseErfc
Inverse complementary error function.- Parameters:
x
- The argument.- Returns:
- erfc−1(x)
- Throws:
ArithmeticException
- Ifx
is ≤ 0 or ≥ 2.ApfloatRuntimeException
- Since:
- 1.13.0
-
fresnelS
Fresnel integral S.- Parameters:
x
- The argument.- Returns:
- S(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
fresnelC
Fresnel integral C.- Parameters:
x
- The argument.- Returns:
- C(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
expIntegralE
public 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 andx
is zero orν
is nonzero andx
is negative.ApfloatRuntimeException
- Since:
- 1.13.0
-
expIntegralEi
Exponential integral Ei.- Parameters:
x
- The argument.- Returns:
- Ei(x)
- Throws:
ArithmeticException
- Ifx
is zero.ApfloatRuntimeException
- Since:
- 1.13.0
-
logIntegral
Logarithmic integral.- Parameters:
x
- The argument.- Returns:
- li(x)
- Throws:
ArithmeticException
- Ifx
is nonpositive or 1.ApfloatRuntimeException
- Since:
- 1.13.0
-
sinIntegral
Sine integral.- Parameters:
x
- The argument.- Returns:
- Si(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
cosIntegral
Cosine integral.- Parameters:
x
- The argument.- Returns:
- Ci(x)
- Throws:
ArithmeticException
- Ifx
is nonpositive.ApfloatRuntimeException
- Since:
- 1.13.0
-
sinhIntegral
Hyperbolic sine integral.- Parameters:
x
- The argument.- Returns:
- Shi(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
coshIntegral
Hyperbolic cosine integral.- Parameters:
x
- The argument.- Returns:
- Chi(x)
- Throws:
ArithmeticException
- Ifx
is nonpositive.ApfloatRuntimeException
- Since:
- 1.13.0
-
airyAi
Airy function Ai.- Parameters:
x
- The argument.- Returns:
- Ai(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
airyAiPrime
Derivative of the Airy function Ai.- Parameters:
x
- The argument.- Returns:
- Ai′(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
airyBi
Airy function Bi.- Parameters:
x
- The argument.- Returns:
- Bi(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
airyBiPrime
Derivative of the Airy function Bi.- Parameters:
x
- The argument.- Returns:
- Bi′(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.13.0
-
besselJ
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 andx
is zero. Also ifν
is not an integer andx
is < 0.ApfloatRuntimeException
- Since:
- 1.13.0
-
besselI
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 andx
is zero. Also ifν
is not an integer andx
is < 0.ApfloatRuntimeException
- Since:
- 1.13.0
-
besselY
Bessel function of the second kind.- Parameters:
ν
- The order.x
- The argument.- Returns:
- Yν(x)
- Throws:
ArithmeticException
- Ifx
is ≤ 0.ApfloatRuntimeException
- Since:
- 1.13.0
-
besselK
Modified Bessel function of the second kind.- Parameters:
ν
- The order.x
- The argument.- Returns:
- Kν(x)
- Throws:
ArithmeticException
- Ifx
is ≤ 0.ApfloatRuntimeException
- Since:
- 1.13.0
-
ellipticK
Complete elliptic integral of the first kind.- Parameters:
x
- The argument.- Returns:
- K(x)
- Throws:
ArithmeticException
- Ifx
is ≥ 1.ApfloatRuntimeException
- Since:
- 1.13.0
-
ellipticE
Complete elliptic integral of the second kind.- Parameters:
x
- The argument.- Returns:
- E(x)
- Throws:
ArithmeticException
- Ifx
is > 1.ApfloatRuntimeException
- Since:
- 1.13.0
-
hermiteH
Hermite function.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Hν(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
laguerreL
Laguerre function.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Lν(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
laguerreL
Generalized Laguerre function.- Parameters:
ν
- The first argument.λ
- The second argument.x
- The third argument.- Returns:
- Lνλ(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
legendreP
Legendre function.- 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
-
legendreP
public Apfloat legendreP(Apfloat ν, Apfloat μ, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Associated Legendre function of the first kind.- Parameters:
ν
- The first argument.μ
- The second argument.x
- The third argument.- Returns:
- Pνμ(x)
- Throws:
ArithmeticException
- Ifx
is ≤ -1 or ≥ 1 andν
orμ
is not an integer orμ
is not even orμ
is not positive and-μ
≤ν
<μ
.ApfloatRuntimeException
- Since:
- 1.14.0
-
legendreQ
Legendre function of the second kind.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Qν(x)
- Throws:
ArithmeticException
- Ifx
is ≥ 1 or ≤ -1.ApfloatRuntimeException
- Since:
- 1.14.0
-
legendreQ
public Apfloat legendreQ(Apfloat ν, Apfloat μ, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Associated Legendre function of the second kind.- Parameters:
ν
- The first argument.μ
- The second argument.x
- The third argument.- Returns:
- Qνμ(x)
- Throws:
ArithmeticException
- Ifx
is ≥ 1 or ≤ -1.ApfloatRuntimeException
- Since:
- 1.14.0
-
chebyshevT
Chebyshev function of the first kind.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Tν(x)
- Throws:
ArithmeticException
- Ifx
is < -1 andν
is not an integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
chebyshevU
Chebyshev function of the second kind.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Uν(x)
- Throws:
ArithmeticException
- Ifx
is ≤ -1 andν
is not an integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
gegenbauerC
public 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 ifx
is < -1 andν
is not an integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
gegenbauerC
public Apfloat gegenbauerC(Apfloat ν, Apfloat λ, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Gegenbauer function.- Parameters:
ν
- The first argument.λ
- The second argument.x
- The third argument.- Returns:
- Cνλ(x)
- Throws:
ArithmeticException
- Ifx
is < -1 andν
is not an integer. Also ifx
is -1 andλ
is > 1/2. Also ifx
is -1 andλ
is 1/2 andν
is not an integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
jacobiP
public Apfloat jacobiP(Apfloat ν, Apfloat a, Apfloat b, Apfloat x) throws ArithmeticException, ApfloatRuntimeException Jacobi function.- 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 eitherx
is -1 andb
is > 0 orx
is < -1. Also ifν + a
is a negative integer andν
is not an integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
fibonacci
Fibonacci function.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Fν(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
eulerE
Euler polynomial.- Parameters:
n
- The first argument.x
- The second argument.- Returns:
- En(x)
- Throws:
IllegalArgumentException
- Ifn
< 0.ApfloatRuntimeException
- Since:
- 1.14.0
-
bernoulliB
public 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
-
harmonicNumber
Harmonic number.- Parameters:
x
- The argument.- Returns:
- Hx
- Throws:
ArithmeticException
- Ifx
is a negative integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
harmonicNumber
public 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
- Ifx
is a negative integer, unlessr
is a nonpositive integer. Also ifx
is < -1 andr
is not an integer.ApfloatRuntimeException
- Since:
- 1.14.0
-
polylog
Polylogarithm.- Parameters:
ν
- The first argument.x
- The second argument.- Returns:
- Liν(x)
- Throws:
ArithmeticException
- Ifν
is ≤ 1 andx
is 1 or ifx
is > 1.ApfloatRuntimeException
- Since:
- 1.14.0
-
logisticSigmoid
Logistic sigmoid.- Parameters:
x
- The argument.- Returns:
- σ(x)
- Throws:
ApfloatRuntimeException
- Since:
- 1.14.0
-
random
Return a uniformly distributed random number0 ≤ x < 1
.- Returns:
- A random number.
- Throws:
ApfloatRuntimeException
- Since:
- 1.9.0
-
random
Return a uniformly distributed random number0 ≤ x < 1
.- Parameters:
radix
- The radix of the number.- Returns:
- A random number.
- Throws:
NumberFormatException
- If the radix is invalid.ApfloatRuntimeException
- Since:
- 1.9.0
-
randomGaussian
Return a normally distributed random number with mean 0 and standard deviation 1.- Returns:
- A random number.
- Throws:
ApfloatRuntimeException
- Since:
- 1.9.0
-
randomGaussian
Return a normally distributed random number with mean 0 and standard deviation 1.- Parameters:
radix
- The radix of the number.- Returns:
- A random number.
- Throws:
NumberFormatException
- If the radix is invalid.ApfloatRuntimeException
- Since:
- 1.9.0
-
continuedFraction
Continued fraction.- Parameters:
x
- The value.n
- Maximum number of terms.- Returns:
- The continued fraction.
- Throws:
IllegalArgumentException
- Ifn
is less than one.ApfloatRuntimeException
- Since:
- 1.12.0
-
convergents
Convergents.- Parameters:
x
- The value.n
- Maximum number of convergents.- Returns:
- The convergents.
- Throws:
IllegalArgumentException
- Ifn
is less than one.ApfloatRuntimeException
- Since:
- 1.12.0
-
max
Maximum value.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
- The maximum of
x
andy
. - Throws:
ApfloatRuntimeException
- Since:
- 1.9.0
-
min
Minimum value.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
- The minimum of
x
andy
. - Throws:
ApfloatRuntimeException
- Since:
- 1.9.0
-
nextAfter
The number adjacent to the first argument in the direction of the second argument.- Parameters:
x
- The first operand.y
- The second operand.- Returns:
- The number adjacent to the first argument in the direction of the second argument.
- Throws:
ApfloatRuntimeException
- Since:
- 1.10.0
-
nextDown
The adjacent value closer to negative infinity.- Parameters:
x
- The operand.- Returns:
- The adjacent value closer to negative infinity.
- Throws:
ApfloatRuntimeException
- Since:
- 1.10.0
-
nextUp
The adjacent value closer to positive infinity.- Parameters:
x
- The operand.- Returns:
- The adjacent value closer to positive infinity.
- Throws:
ApfloatRuntimeException
- Since:
- 1.10.0
-
ulp
Unit in the last place.- Parameters:
x
- The operand.- Returns:
- The unit in the last place.
- Throws:
ApfloatRuntimeException
- Since:
- 1.10.0
-
roundToPrecision(Apfloat,RoundingMode)
.