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
InfiniteExpansionExceptione.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 Apfloatabs(Apfloat x)Absolute value.Apfloatacos(Apfloat x)Arc cosine.Apfloatacosh(Apfloat x)Hyperbolic arc cosine.Apfloatadd(Apfloat x, Apfloat y)Addition.Apfloatagm(Apfloat a, Apfloat b)Arithmetic-geometric mean.ApfloatairyAi(Apfloat x)Airy function Ai.ApfloatairyAiPrime(Apfloat x)Derivative of the Airy function Ai.ApfloatairyBi(Apfloat x)Airy function Bi.ApfloatairyBiPrime(Apfloat x)Derivative of the Airy function Bi.Apfloatasin(Apfloat x)Arc sine.Apfloatasinh(Apfloat x)Hyperbolic arc sine.Apfloatatan(Apfloat x)Arc tangent.Apfloatatan2(Apfloat x, Apfloat y)Angle of point.Apfloatatanh(Apfloat x)Hyperbolic arc tangent.ApfloatbernoulliB(long n, Apfloat x)Bernoulli polynomial.ApfloatbesselI(Apfloat ν, Apfloat x)Modified Bessel function of the first kind.ApfloatbesselJ(Apfloat ν, Apfloat x)Bessel function of the first kind.ApfloatbesselK(Apfloat ν, Apfloat x)Modified Bessel function of the second kind.ApfloatbesselY(Apfloat ν, Apfloat x)Bessel function of the second kind.Apfloatbeta(Apfloat a, Apfloat b)Beta function.Apfloatbeta(Apfloat x, Apfloat a, Apfloat b)Incomplete beta function.Apfloatbeta(Apfloat x1, Apfloat x2, Apfloat a, Apfloat b)Generalized incomplete beta function.Apfloatbinomial(Apfloat n, Apfloat k)Binomial coefficient.Apfloatcbrt(Apfloat x)Cube root.Apfloatceil(Apfloat x)Ceiling function.ApfloatchebyshevT(Apfloat ν, Apfloat x)Chebyshev function of the first kind.ApfloatchebyshevU(Apfloat ν, Apfloat x)Chebyshev function of the second kind.private ApfloatcheckSmallLinear(Apfloat x)Apfloat[]continuedFraction(Apfloat x, int n)Continued fraction.Apfloat[]convergents(Apfloat x, int n)Convergents.ApfloatcopySign(Apfloat x, Apfloat y)Copies the sign from one number to another.Apfloatcos(Apfloat x)Cosine.Apfloatcosh(Apfloat x)Hyperbolic cosine.ApfloatcoshIntegral(Apfloat x)Hyperbolic cosine integral.ApfloatcosIntegral(Apfloat x)Cosine integral.Apfloatdigamma(Apfloat x)Digamma function.Apfloatdivide(Apfloat x, Apfloat y)Division.ApfloatdoubleFactorial(long n)Double factorial.ApfloatdoubleFactorial(long n, int radix)Double factorial.ApfloatellipticE(Apfloat x)Complete elliptic integral of the second kind.ApfloatellipticK(Apfloat x)Complete elliptic integral of the first kind.Apfloaterf(Apfloat x)Error function.Apfloaterfc(Apfloat x)Complementary error function.Apfloaterfi(Apfloat x)Imaginary error function.ApfloateulerE(long n, Apfloat x)Euler polynomial.Apfloatexp(Apfloat x)Exponential function.ApfloatexpIntegralE(Apfloat ν, Apfloat x)Exponential integral E.ApfloatexpIntegralEi(Apfloat x)Exponential integral Ei.Apfloatfactorial(long n)Factorial.Apfloatfactorial(long n, int radix)Factorial.Apfloatfibonacci(Apfloat ν, Apfloat x)Fibonacci function.Apfloatfloor(Apfloat x)Floor function.Apfloatfmod(Apfloat x, Apfloat y)Modulus.Apfloatfrac(Apfloat x)Extract fractional part.ApfloatfresnelC(Apfloat x)Fresnel integral C.ApfloatfresnelS(Apfloat x)Fresnel integral S.Apfloatgamma(Apfloat x)Gamma function.Apfloatgamma(Apfloat a, Apfloat x)Incomplete gamma function.Apfloatgamma(Apfloat a, Apfloat x0, Apfloat x1)Generalized incomplete gamma function.ApfloatgegenbauerC(Apfloat ν, Apfloat x)Renormalized Gegenbauer function.ApfloatgegenbauerC(Apfloat ν, Apfloat λ, Apfloat x)Gegenbauer function.ApfloatharmonicNumber(Apfloat x)Harmonic number.ApfloatharmonicNumber(Apfloat x, Apfloat r)Generalized harmonic number.ApfloathermiteH(Apfloat ν, Apfloat x)Hermite function.Apfloathypergeometric0F1(Apfloat a, Apfloat x)Confluent hypergeometric function 0F1.Apfloathypergeometric0F1Regularized(Apfloat a, Apfloat x)Regularized confluent hypergeometric function 0F̃1.Apfloathypergeometric1F1(Apfloat a, Apfloat b, Apfloat x)Kummer confluent hypergeometric function 1F1.Apfloathypergeometric1F1Regularized(Apfloat a, Apfloat b, Apfloat x)Regularized Kummer confluent hypergeometric function 1F̃1.Apfloathypergeometric2F1(Apfloat a, Apfloat b, Apfloat c, Apfloat x)Hypergeometric function 2F1.Apfloathypergeometric2F1Regularized(Apfloat a, Apfloat b, Apfloat c, Apfloat x)Regularized hypergeometric function 2F̃1.ApfloathypergeometricU(Apfloat a, Apfloat b, Apfloat x)Tricomi's confluent hypergeometric function U.ApfloatinverseErf(Apfloat x)Inverse error function.ApfloatinverseErfc(Apfloat x)Inverse complementary error function.ApfloatinverseRoot(Apfloat x, long n)Inverse root.ApfloatjacobiP(Apfloat ν, Apfloat a, Apfloat b, Apfloat x)Jacobi function.ApfloatlaguerreL(Apfloat ν, Apfloat x)Laguerre function.ApfloatlaguerreL(Apfloat ν, Apfloat λ, Apfloat x)Generalized Laguerre function.ApfloatlegendreP(Apfloat ν, Apfloat x)Legendre function.ApfloatlegendreP(Apfloat ν, Apfloat μ, Apfloat x)Associated Legendre function of the first kind.ApfloatlegendreQ(Apfloat ν, Apfloat x)Legendre function of the second kind.ApfloatlegendreQ(Apfloat ν, Apfloat μ, Apfloat x)Associated Legendre function of the second kind.Apfloatlog(Apfloat x)Natural logarithm.Apfloatlog(Apfloat x, Apfloat b)Logarithm in specified base.ApfloatlogGamma(Apfloat x)Logarithm of the gamma function.ApfloatlogIntegral(Apfloat x)Logarithmic integral.ApfloatlogisticSigmoid(Apfloat x)Logistic sigmoid.ApfloatlogRadix(int radix)Logarithm.Apfloatmax(Apfloat x, Apfloat y)Maximum value.Apfloatmin(Apfloat x, Apfloat y)Minimum value.Apfloatmod(Apfloat x, Apfloat y)Modulus.Apfloat[]modf(Apfloat x)Split to integer and fractional parts.Apfloatmultiply(Apfloat x, Apfloat y)Multiplication.ApfloatmultiplyAdd(Apfloat a, Apfloat b, Apfloat c, Apfloat d)Fused multiply-add.ApfloatmultiplySubtract(Apfloat a, Apfloat b, Apfloat c, Apfloat d)Fused multiply-subtract.Apfloatnegate(Apfloat x)Negation.ApfloatnextAfter(Apfloat x, Apfloat y)The number adjacent to the first argument in the direction of the second argument.ApfloatnextDown(Apfloat x)The adjacent value closer to negative infinity.ApfloatnextUp(Apfloat x)The adjacent value closer to positive infinity.Apfloatpi()π.Apfloatpi(int radix)π.Apfloatpochhammer(Apfloat x, Apfloat n)Pochhammer symbol.Apfloatpolygamma(long n, Apfloat x)Polygamma function.Apfloatpolylog(Apfloat ν, Apfloat x)Polylogarithm.Apfloatpow(Apfloat x, long n)Integer power.Apfloatpow(Apfloat x, Apfloat y)Power.Apfloatproduct(Apfloat... x)Product.Apfloatrandom()Return a uniformly distributed random number0 ≤ x < 1.Apfloatrandom(int radix)Return a uniformly distributed random number0 ≤ x < 1.ApfloatrandomGaussian()Return a normally distributed random number with mean 0 and standard deviation 1.ApfloatrandomGaussian(int radix)Return a normally distributed random number with mean 0 and standard deviation 1.Apfloatroot(Apfloat x, long n)Root.Apfloatround(Apfloat x, java.math.RoundingMode roundingMode)Deprecated.ApfloatroundToInteger(Apfloat x, java.math.RoundingMode roundingMode)Round to integer with specified rounding mode.ApfloatroundToMultiple(Apfloat x, Apfloat y, java.math.RoundingMode roundingMode)Round to multiple with specified rounding mode.ApfloatroundToPlaces(Apfloat x, long places, java.math.RoundingMode roundingMode)Round to specified number of places with specified rounding mode.ApfloatroundToPrecision(Apfloat x, java.math.RoundingMode roundingMode)Round to precision with specified rounding mode.Apfloatscale(Apfloat x, long scale)Move the radix point.private ApfloatsetPrecision(Apfloat x)private Apfloat[]setPrecision(Apfloat[] x)Apfloatsin(Apfloat x)Sine.Apfloatsinc(Apfloat x)Sinc.Apfloatsinh(Apfloat x)Hyperbolic sine.ApfloatsinhIntegral(Apfloat x)Hyperbolic sine integral.ApfloatsinIntegral(Apfloat x)Sine integral.Apfloatsqrt(Apfloat x)Square root.Apfloatsubtract(Apfloat x, Apfloat y)Subtraction.Apfloatsum(Apfloat... x)Sum.Apfloattan(Apfloat x)Tangent.Apfloattanh(Apfloat x)Hyperbolic tangent.ApfloattoDegrees(Apfloat x)Convert radians to degrees.ApfloattoRadians(Apfloat x)Convert degrees to radians.Apfloattruncate(Apfloat x)Truncate fractional part.Apfloatulp(Apfloat x)Unit in the last place.ApfloatvalueOf(Apfloat x)Returns the value with the specified precision.Apfloatw(Apfloat x)Lambert W function.Apfloatzeta(Apfloat s)Riemann zeta function.Apfloatzeta(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.IllegalArgumentExceptionConstructs 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:
valueOfin 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- Ifyis 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- Ifxandyare zero, orxis negative andyis 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- Ifxandnare zero, orxis zero andnis 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 ofxis 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 thexis 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 ofxis 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 ofxis 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- Ifxis 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-
blogarithm ofx. - Throws:
java.lang.ArithmeticException- Ifxorbis 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- Ifxis 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- Ifxis π/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
aandb. - 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- Ifxornis zero, orxis negative andnis 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- Ifnis zero, orxis negative andnis 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:
xrounded 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:
xrounded 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:
xrounded 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:
xrounded 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:
xrounded to the nearest multiple ofywith 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:
xconverted 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:
xconverted 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- Ifxandyare 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:
xwith 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]whereiisfloor(x)andfisx - 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:
piin classFixedPrecisionApcomplexHelper- Returns:
π.- Throws:
ApfloatRuntimeException
-
pi
public Apfloat pi(int radix) throws java.lang.NumberFormatException, ApfloatRuntimeException
π.- Overrides:
piin 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- Ifxis 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- Ifais not a positive integer andxis 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- Ifais not a positive integer and eitherx0orx1is 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- Ifxis 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- Ifxis 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- Ifnis negative orxis 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- Ifaorbis a nonpositive integer buta + bis not. Also if bothaandbare 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- 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
-
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- 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
-
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 + nis a nonpositive integer butxis 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,korn - kis 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- Ifsis1.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- Ifsis1or ifais a nonpositive integer or ifsis not an integer andais 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- Ifxis ≤ 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 andxis zero orνis nonzero andxis 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- Ifxis 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- Ifxis 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- Ifxis 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- Ifxis 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 andxis zero. Also ifνis not an integer andxis < 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 andxis zero. Also ifνis not an integer andxis < 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- Ifxis ≤ 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- Ifxis ≤ 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- Ifxis ≥ 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- Ifxis > 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- Ifxis ≤ -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- Ifxis ≥ 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- Ifxis ≥ 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- Ifxis < -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- Ifxis ≤ -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 ifxis < -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- 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
-
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 eitherxis -1 andbis > 0 orxis < -1. Also ifν + ais 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- Ifxis 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- Ifxis a negative integer, unlessris a nonpositive integer. Also ifxis < -1 andris 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 andxis 1 or ifxis > 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- Ifnis 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- Ifnis 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
xandy. - 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
xandy. - 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
-
-