Package org.ojalgo.function.special
Class MissingMath
java.lang.Object
org.ojalgo.function.special.MissingMath
Math utilities missing from
Math
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BigDecimal[]
Coefficients for the Taylor series expansion of the exponential function.private static final MathContext
Binary 256 octuple precision roughly corresponds to 71.34 decimal digits. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
acosh
(double arg) static double
asinh
(double arg) static double
atan2
(double y, double x) https://math.stackexchange.com/questions/1098487/atan2-faster-approximation/1105038static double
atanh
(double arg) static BigDecimal
cos
(BigDecimal arg) static BigDecimal
divide
(BigDecimal numerator, BigDecimal denominator) private static BigDecimal
doInternalCos
(BigDecimal arg) static BigDecimal
exp
(BigDecimal arg) static double
factorial
(int arg) 13!
does not fit in anint
, and21!
does not fit in along
- that's why this method returns adouble
.(package private) static double
factorialDouble
(int arg) (package private) static int
factorialInt
(int arg) (package private) static long
factorialLong
(int arg) static int
gcd
(int[] vals) static int
gcd
(int val1, int val2) Greatest Common Denominatorstatic int
gcd
(int val1, int... vals) static long
gcd
(long[] vals) static long
gcd
(long val1, long val2) Greatest Common Denominatorstatic long
gcd
(long val1, long... vals) static double
hypot
(double arg1, double arg2) static BigDecimal
hypot
(BigDecimal arg1, BigDecimal arg2) static BigDecimal
log
(BigDecimal arg) static double
log10
(double arg, double replacement) For very small arguments (regardless of sign) the replacement is returned insteadstatic double
logistic
(double arg) static double
logit
(double arg) static int
magnitude
(BigDecimal arg) Returns a rough approximation ofMath.log10(double)
forBigDecimal
.static double
max
(double... values) static double
max
(double a, double b) static double
max
(double a, double b, double c) static double
max
(double a, double b, double c, double d) static int
max
(int... values) static int
max
(int a, int b) static int
max
(int a, int b, int c) static int
max
(int a, int b, int c, int d) static long
max
(long... values) static long
max
(long a, long b) static long
max
(long a, long b, long c) static long
max
(long a, long b, long c, long d) static double
min
(double... values) static double
min
(double a, double b) static double
min
(double a, double b, double c) static double
min
(double a, double b, double c, double d) static int
min
(int... values) static int
min
(int a, int b) static int
min
(int a, int b, int c) static int
min
(int a, int b, int c, int d) static long
min
(long... values) static long
min
(long a, long b) static long
min
(long a, long b, long c) static long
min
(long a, long b, long c, long d) static double
norm
(double... values) static double
norm
(double a, double b) static double
norm
(double a, double b, double c) static double
norm
(double a, double b, double c, double d) static BigDecimal
pow
(BigDecimal arg1, BigDecimal arg2) static double
power
(double arg, int param) static long
power
(long arg, int param) static BigDecimal
power
(BigDecimal arg, int param) static double
root
(double arg, int param) static BigDecimal
root
(BigDecimal arg, int param) static int
roundToInt
(double value) static double
scale
(double arg, int param) static BigDecimal
signum
(BigDecimal arg) static BigDecimal
sin
(BigDecimal arg) static double
sqrt1px2
(double arg) static BigDecimal
tanh
(BigDecimal arg) static int
toMinIntExact
(long... values) static int
toMinIntExact
(long a, long b) static int
toMinIntExact
(long a, long b, long c) static int
toMinIntExact
(long a, long b, long c, long d)
-
Field Details
-
EXP_COEF
Coefficients for the Taylor series expansion of the exponential function. -
MC256
Binary 256 octuple precision roughly corresponds to 71.34 decimal digits. Here we set it higher (for intermediate calculations) to enable end-results that are accurate to 71 decimal digits.https://en.wikipedia.org/wiki/IEEE_754
-
-
Constructor Details
-
MissingMath
public MissingMath()
-
-
Method Details
-
acosh
public static double acosh(double arg) -
asinh
public static double asinh(double arg) -
atan2
public static double atan2(double y, double x) https://math.stackexchange.com/questions/1098487/atan2-faster-approximation/1105038
Math.atan2(double, double)
-
atanh
public static double atanh(double arg) -
cos
-
divide
-
exp
-
factorial
public static double factorial(int arg) 13!
does not fit in anint
, and21!
does not fit in along
- that's why this method returns adouble
. -
gcd
public static int gcd(int val1, int val2) Greatest Common Denominator -
gcd
public static int gcd(int val1, int... vals) -
gcd
public static int gcd(int[] vals) -
gcd
public static long gcd(long val1, long... vals) -
gcd
public static long gcd(long val1, long val2) Greatest Common Denominator -
gcd
public static long gcd(long[] vals) -
hypot
-
hypot
public static double hypot(double arg1, double arg2) -
log
-
log10
public static double log10(double arg, double replacement) For very small arguments (regardless of sign) the replacement is returned instead -
logistic
public static double logistic(double arg) -
logit
public static double logit(double arg) -
magnitude
Returns a rough approximation ofMath.log10(double)
forBigDecimal
.- For numbers like 10^n it returns the exact correct number, n.
- The magnitude of 0.0 is 0.
- The error is [0.0,1.0) and the returned value is never more than the actual/correct value. For 999.0 the correct value is close to 3, but this method returns 2, as the implementation simply counts the digits.
- Works for negative numbers as the sign is disregarded.
- Works for fractional numbers 0.1, 0.0456, 1.2 or whatever.
-
max
public static double max(double... values) -
max
public static double max(double a, double b) -
max
public static double max(double a, double b, double c) -
max
public static double max(double a, double b, double c, double d) -
max
public static int max(int... values) -
max
public static int max(int a, int b) -
max
public static int max(int a, int b, int c) -
max
public static int max(int a, int b, int c, int d) -
max
public static long max(long... values) -
max
public static long max(long a, long b) -
max
public static long max(long a, long b, long c) -
max
public static long max(long a, long b, long c, long d) -
min
public static double min(double... values) -
min
public static double min(double a, double b) -
min
public static double min(double a, double b, double c) -
min
public static double min(double a, double b, double c, double d) -
min
public static int min(int... values) -
min
public static int min(int a, int b) -
min
public static int min(int a, int b, int c) -
min
public static int min(int a, int b, int c, int d) -
min
public static long min(long... values) -
min
public static long min(long a, long b) -
min
public static long min(long a, long b, long c) -
min
public static long min(long a, long b, long c, long d) -
norm
public static double norm(double... values) -
norm
public static double norm(double a, double b) -
norm
public static double norm(double a, double b, double c) -
norm
public static double norm(double a, double b, double c, double d) -
pow
-
power
-
power
public static double power(double arg, int param) -
power
public static long power(long arg, int param) -
root
-
root
public static double root(double arg, int param) -
roundToInt
public static int roundToInt(double value) -
scale
public static double scale(double arg, int param) -
signum
-
sin
-
sqrt1px2
public static double sqrt1px2(double arg) -
tanh
-
toMinIntExact
public static int toMinIntExact(long... values) -
toMinIntExact
public static int toMinIntExact(long a, long b) -
toMinIntExact
public static int toMinIntExact(long a, long b, long c) -
toMinIntExact
public static int toMinIntExact(long a, long b, long c, long d) -
doInternalCos
-
factorialDouble
static double factorialDouble(int arg) -
factorialInt
static int factorialInt(int arg) -
factorialLong
static long factorialLong(int arg)
-