public class BigDecimalMath extends Object
Constructor and Description |
---|
BigDecimalMath() |
Modifier and Type | Method and Description |
---|---|
static BigDecimal |
acosh(BigDecimal x)
The inverse hyperbolic cosine.
|
static BigDecimal |
addRound(BigDecimal x,
BigDecimal y)
Add and round according to the larger of the two ulp’s.
|
static BigDecimal |
asin(BigDecimal x)
The inverse trigonometric sine.
|
static BigDecimal |
asinh(BigDecimal x)
The inverse hyperbolic sine.
|
static BigDecimal |
atan(BigDecimal x)
The inverse trigonometric tangent.
|
protected static BigDecimal |
broadhurstBBP(int n,
int p,
int[] a,
MathContext mc)
Broadhurst ladder sequence.
|
static BigDecimal |
cbrt(BigDecimal x)
The cube root.
|
static BigDecimal |
cos(BigDecimal x)
Trigonometric cosine.
|
static BigDecimal |
cosh(BigDecimal x)
The hyperbolic cosine.
|
static BigDecimal |
cot(BigDecimal x)
The trigonometric co-tangent.
|
static BigDecimal |
divideRound(BigDecimal x,
BigDecimal y)
Divide and round.
|
static BigDecimal |
divideRound(BigDecimal x,
BigInteger n)
Divide and round.
|
static BigDecimal |
divideRound(BigDecimal x,
int n)
Divide and round.
|
static BigDecimal |
divideRound(BigInteger n,
BigDecimal x)
Divide and round.
|
static BigDecimal |
divideRound(int n,
BigDecimal x)
Divide and round.
|
static int |
err2prec(BigDecimal x,
BigDecimal xerr)
Convert an absolute error to a precision.
|
static int |
err2prec(double xerr)
Convert a relative error to a precision.
|
static int |
err2prec(double x,
double xerr)
Convert an absolute error to a precision.
|
static BigDecimal |
exp(BigDecimal x)
The exponential function.
|
static BigDecimal |
exp(MathContext mc)
The base of the natural logarithm.
|
static BigDecimal |
Gamma(BigDecimal x)
The Gamma function.
|
static BigDecimal |
gamma(MathContext mc)
Euler-Mascheroni constant.
|
static BigDecimal |
hypot(BigDecimal x,
BigDecimal y)
The hypotenuse.
|
static BigDecimal |
hypot(int n,
BigDecimal x)
The hypotenuse.
|
static BigDecimal |
log(BigDecimal x)
The natural logarithm.
|
static BigDecimal |
log(int n,
MathContext mc)
The natural logarithm.
|
static BigDecimal |
log(org.nd4j.linalg.util.Rational r,
MathContext mc)
The natural logarithm.
|
static BigDecimal |
mod2pi(BigDecimal x)
Reduce value to the interval [0,2*Pi].
|
static BigDecimal |
modpi(BigDecimal x)
Reduce value to the interval [-Pi/2,Pi/2].
|
static BigDecimal |
multiplyRound(BigDecimal x,
BigDecimal y)
Multiply and round.
|
static BigDecimal |
multiplyRound(BigDecimal x,
BigInteger n)
Multiply and round.
|
static BigDecimal |
multiplyRound(BigDecimal x,
int n)
Multiply and round.
|
static BigDecimal |
multiplyRound(BigDecimal x,
org.nd4j.linalg.util.Rational f)
Multiply and round.
|
static BigDecimal |
pi(MathContext mc)
Euler’s constant.
|
static BigDecimal |
pochhammer(BigDecimal x,
int n)
Pochhammer’s function.
|
static BigDecimal |
pow(BigDecimal x,
BigDecimal y)
Power function.
|
static BigDecimal |
powRound(BigDecimal x,
int n)
Raise to an integer power and round.
|
static double |
prec2err(double x,
int prec)
Convert a precision (relative error) to an absolute error.
|
static BigDecimal |
root(int n,
BigDecimal x)
The integer root.
|
static BigDecimal |
scalePrec(BigDecimal x,
int d)
Append decimal zeros to the value.
|
static BigDecimal |
scalePrec(BigDecimal x,
MathContext mc)
Boost the precision by appending decimal zeros to the value.
|
static BigDecimal |
sin(BigDecimal x)
Trigonometric sine.
|
static BigDecimal |
sinh(BigDecimal x)
The hyperbolic sine.
|
static BigDecimal |
sqrt(BigDecimal x)
The square root.
|
static BigDecimal |
subtractRound(BigDecimal x,
BigDecimal y)
Subtract and round according to the larger of the two ulp’s.
|
static BigDecimal |
tan(BigDecimal x)
The trigonometric tangent.
|
static BigDecimal |
tanh(BigDecimal x)
The hyperbolic tangent.
|
static BigDecimal |
zeta(int n,
MathContext mc)
Riemann zeta function.
|
static double |
zeta1(int n)
Riemann zeta function.
|
public static BigDecimal pi(MathContext mc)
mc
- The required precision of the result.public static BigDecimal gamma(MathContext mc)
mc
- The required precision of the result.public static BigDecimal sqrt(BigDecimal x)
x
- the non-negative argument.public static BigDecimal cbrt(BigDecimal x)
x
- The argument.public static BigDecimal root(int n, BigDecimal x)
n
- the positive argument.x
- the non-negative argument.public static BigDecimal hypot(BigDecimal x, BigDecimal y)
x
- the first argument.y
- the second argument.public static BigDecimal hypot(int n, BigDecimal x)
n
- the first argument.x
- the second argument.public static BigDecimal exp(BigDecimal x)
x
- the argument.public static BigDecimal exp(MathContext mc)
mc
- the required precision of the resultpublic static BigDecimal log(BigDecimal x)
x
- the argument.public static BigDecimal log(int n, MathContext mc)
n
- The main argument, a strictly positive integer.mc
- The requirements on the precision.public static BigDecimal log(org.nd4j.linalg.util.Rational r, MathContext mc)
r
- The main argument, a strictly positive value.mc
- The requirements on the precision.public static BigDecimal pow(BigDecimal x, BigDecimal y)
x
- Base of the power.y
- Exponent of the power.public static BigDecimal powRound(BigDecimal x, int n)
x
- The base.n
- The exponent.public static BigDecimal sin(BigDecimal x)
x
- The argument in radians.public static BigDecimal cos(BigDecimal x)
x
- The argument in radians.public static BigDecimal tan(BigDecimal x)
x
- the argument in radians.public static BigDecimal cot(BigDecimal x)
x
- the argument in radians.public static BigDecimal asin(BigDecimal x)
x
- the argument.public static BigDecimal atan(BigDecimal x)
x
- the argument.public static BigDecimal cosh(BigDecimal x)
x
- The argument.public static BigDecimal sinh(BigDecimal x)
x
- the argument.public static BigDecimal tanh(BigDecimal x)
x
- The argument.public static BigDecimal asinh(BigDecimal x)
x
- The argument.public static BigDecimal acosh(BigDecimal x)
x
- The argument.public static BigDecimal Gamma(BigDecimal x)
x
- The argument.public static BigDecimal pochhammer(BigDecimal x, int n)
x
- The main argument.n
- The non-negative index.public static BigDecimal mod2pi(BigDecimal x)
x
- the original valuepublic static BigDecimal modpi(BigDecimal x)
x
- The original valuepublic static BigDecimal zeta(int n, MathContext mc)
n
- The positive integer argument.
32mc
- Specification of the accuracy of the result.public static double zeta1(int n)
n
- The positive integer argument.protected static BigDecimal broadhurstBBP(int n, int p, int[] a, MathContext mc)
a
- The vector of 8 integer argumentsmc
- Specification of the accuracy of the resultwidth0pt\protect\href{http://arxiv.org/abs/math/9803067}{arXiv:math/9803067}
public static BigDecimal addRound(BigDecimal x, BigDecimal y)
x
- The left summandy
- The right summandpublic static BigDecimal subtractRound(BigDecimal x, BigDecimal y)
x
- The left term.y
- The right term.public static BigDecimal multiplyRound(BigDecimal x, BigDecimal y)
x
- The left factor.y
- The right factor.public static BigDecimal multiplyRound(BigDecimal x, org.nd4j.linalg.util.Rational f)
x
- The left factor.f
- The right factor.public static BigDecimal multiplyRound(BigDecimal x, int n)
x
- The left factor.n
- The right factor.public static BigDecimal multiplyRound(BigDecimal x, BigInteger n)
x
- The left factor.n
- The right factor.public static BigDecimal divideRound(BigDecimal x, BigDecimal y)
x
- The numeratory
- The denominatorpublic static BigDecimal divideRound(BigDecimal x, int n)
x
- The numeratorn
- The denominatorpublic static BigDecimal divideRound(BigDecimal x, BigInteger n)
x
- The numeratorn
- The denominatorpublic static BigDecimal divideRound(BigInteger n, BigDecimal x)
n
- The numeratorx
- The denominatorpublic static BigDecimal divideRound(int n, BigDecimal x)
n
- The numerator.x
- The denominator.public static BigDecimal scalePrec(BigDecimal x, int d)
x
- The input valued
- The (positive) value of zeros to be added as least significant digits.public static BigDecimal scalePrec(BigDecimal x, MathContext mc)
x
- The input valuemc
- The requirement on the minimum precision on return.public static int err2prec(BigDecimal x, BigDecimal xerr)
x
- The value of the variablexerr
- The absolute error in the variablepublic static int err2prec(double x, double xerr)
x
- The value of the variable
The value returned depends only on the absolute value, not on the sign.xerr
- The absolute error in the variable
The value returned depends only on the absolute value, not on the sign.public static int err2prec(double xerr)
xerr
- The relative error in the variable.
The value returned depends only on the absolute value, not on the sign.public static double prec2err(double x, int prec)
x
- The value of the variable
The value returned depends only on the absolute value, not on the sign.prec
- The number of valid digits of the variable.Copyright © 2015. All Rights Reserved.