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