Class MathFunctions

    • Constructor Summary

      Constructors 
      Constructor Description
      MathFunctions()  
    • Method Summary

      Modifier and Type Method Description
      static double abs​(double a)
      Absolute value.
      static double acos​(double a)
      Arcus cosine - inverse trigonometric cosine function
      static double acosec​(double a)
      Arcus cosecant - inverse trigonometric cosecant function
      static double actan​(double a)
      Arcus cotangent - inverse trigonometric cotangent function
      static boolean almostEqual​(double a, double b)
      Check whether two double values are almost equal.
      static double arcosh​(double a)
      Arcus hyperbolic cosine - inverse hyperbolic cosine function.
      static double arcoth​(double a)
      Arcus hyperbolic tangent - inverse hyperbolic tangent function.
      static double arcsch​(double a)
      Arcus hyperbolic cosecant - inverse hyperbolic cosecant function.
      static double arsech​(double a)
      Arcus hyperbolic secant - inverse hyperbolic secant function.
      static double arsinh​(double a)
      Arcus hyperbolic sine - inverse hyperbolic sine function.
      static double artanh​(double a)
      Arcus hyperbolic tangent - inverse hyperbolic tangent function.
      static double asec​(double a)
      Arcus secant - inverse trigonometric secant function
      static double asin​(double a)
      Arcus sine - inverse trigonometric sine function
      static double atan​(double a)
      Arcus tangent - inverse trigonometric tangent function
      static double bellNumber​(double n)
      Bell number
      static double bellNumber​(int n)
      Bell Numbers
      static double bernoulliNumber​(double m, double n)
      Bernoulli numbers
      static double bernoulliNumber​(int m, int n)
      Bernoulli numbers
      static double binomCoeff​(double n, double k)
      Generalized binomial coefficient
      static double binomCoeff​(double n, long k)
      Generalized binomial coefficient
      static double catalanNumber​(double n)
      Catalan numbers
      static double catalanNumber​(int n)
      Catalan numbers
      static double ceil​(double a)
      Ceiling function.
      static double chi​(double x, double a, double b)
      Characteristic function x in (a,b)
      static double chi_L​(double x, double a, double b)
      Characteristic function x in [a,b)
      static double chi_LR​(double x, double a, double b)
      Characteristic function x in [a,b]
      static double chi_R​(double x, double a, double b)
      Characteristic function x in (a,b]
      static double coalesce​(double[] values)
      Returns the first non-NaN value
      static double continuedFraction​(double... sequence)
      Continued fraction
      static double continuedPolynomial​(double... x)
      Continued polynomial
      static double cos​(double a)
      Cosine trigonometric function
      static double cosec​(double a)
      Cosecant trigonometric function
      static double cosh​(double a)
      Hyperbolic cosine function.
      static double coth​(double a)
      Hyperbolic cotangent function.
      static double csch​(double a)
      Hyperbolic cosecant function.
      static double ctan​(double a)
      Cotangent trigonometric function
      static int decimalDigitsBefore​(double value)
      For very small number returns the position of first significant digit, ie 0.1 = 1, 0.01 = 2
      static double deg​(double a)
      Radius to degrees translation.
      static double div​(double a, double b)
      Division a / b applying canonical rounding if canonical rounding is enabled
      static double eulerNumber​(double n, double k)
      Euler numbers
      static double eulerNumber​(int n, int k)
      Euler numbers
      static double eulerPolynomial​(double m, double x)
      Euler polynomial
      static double eulerPolynomial​(int m, double x)
      Euler polynomial
      static double exp​(double a)
      Exponential function.
      static double factorial​(double n)
      Factorial
      static double factorial​(int n)
      Factorial
      static double fibonacciNumber​(double n)
      Fibonacci numbers
      static double fibonacciNumber​(int n)
      Fibonacci numbers
      static double floor​(double a)
      Floor function.
      static double harmonicNumber​(double n)
      Harmonic number
      static double harmonicNumber​(double x, double n)
      Harmonic number 1/1 + 1/2^x + ... + 1/n^x
      static double harmonicNumber​(double x, int n)
      Harmonic number 1/1 + 1/2^x + ... + 1/n^x
      static double harmonicNumber​(int n)
      Harmonic numer
      static double integerPart​(double x)
      Returns integer part of a double value.
      static boolean isAlmostInt​(double a)
      Verifies whether provided number is almost integer
      static boolean isInteger​(double x)
      Check whether double value is almost integer.
      static double kroneckerDelta​(double i, double j)
      Kronecker delta
      static double kroneckerDelta​(int i, int j)
      Kronecker delta
      static double ln​(double a)
      Natural logarithm
      static double log​(double a, double b)
      General logarithm.
      static double log10​(double a)
      Common logarithm
      static double log2​(double a)
      Binary logarithm
      static double lucasNumber​(double n)
      Lucas numebrs
      static double lucasNumber​(int n)
      Lucas numebrs
      static double minus​(double a, double b)
      Subtraction a - b applying canonical rounding if canonical rounding is enabled
      static double mod​(double a, double b)
      Modulo operator a % b
      static double multiply​(double a, double b)
      Multiplication a * b applying canonical rounding if canonical rounding is enabled
      static double numberOfPermutations​(double n, double k)
      Generalized coefficient returning number of k permutations that can be drawn for n elements set.
      static double numberOfPermutations​(double n, long k)
      Generalized coefficient returning number of k permutations that can be drawn for n elements set.
      static double plus​(double a, double b)
      Addition a + b applying canonical rounding if canonical rounding is enabled
      static double power​(double a, double b)
      Power function a^b
      static double rad​(double a)
      Degrees to radius translation.
      static double root​(double n, double x)
      Nth order root of a number
      static double round​(double value, int places)
      Double rounding
      static double roundDown​(double value, int places)
      Double down rounding
      static double roundHalfUp​(double value, int places)
      Double half up rounding
      static double roundUlp​(double number)
      Unit in the last place rounding, see 0.1 + 0.1 + 0.1 vs roundUlp(0.1 + 0.1 + 0.1)
      static double sa​(double a)
      Normalized sinc function.
      static double sec​(double a)
      Secant trigonometric function
      static double sech​(double a)
      Hyperbolic secant function.
      static double sgn​(double a)
      Signum function.
      static double sin​(double a)
      Sine trigonometric function
      static double sinc​(double a)
      Sinc function.
      static double sinh​(double a)
      Hyperbolic sine function.
      static double sqrt​(double a)
      Square root.
      static double Stirling1Number​(double n, double k)
      Stirling numbers of the first kind
      static double Stirling1Number​(int n, int k)
      Stirling numbers of the first kind
      static double Stirling2Number​(double n, double k)
      Stirling numbers of the second kind
      static double Stirling2Number​(int n, int k)
      Stirling numbers of the second kind
      static double tan​(double a)
      Tangent trigonometric function
      static double tanh​(double a)
      Hyperbolic tangent function.
      static double tetration​(double a, double n)
      Tetration, exponential power, power series
      static double ulp​(double value)
      Unit in the last place(ULP) for double
      static int ulpDecimalDigitsBefore​(double value)
      Unit in The Last Place - number of decimal digits before
      static double worpitzkyNumber​(double n, double k)
      Worpitzky numbers
      static double worpitzkyNumber​(int n, int k)
      Worpitzky numbers
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MathFunctions

        public MathFunctions()
    • Method Detail

      • plus

        public static final double plus​(double a,
                                        double b)
        Addition a + b applying canonical rounding if canonical rounding is enabled
        Parameters:
        a - The a parameter
        b - The b parameter
        Returns:
        The result of addition
      • minus

        public static final double minus​(double a,
                                         double b)
        Subtraction a - b applying canonical rounding if canonical rounding is enabled
        Parameters:
        a - The a parameter
        b - The b parameter
        Returns:
        The result of subtraction
      • multiply

        public static final double multiply​(double a,
                                            double b)
        Multiplication a * b applying canonical rounding if canonical rounding is enabled
        Parameters:
        a - The a parameter
        b - The b parameter
        Returns:
        The result of multiplication
      • div

        public static final double div​(double a,
                                       double b)
        Division a / b applying canonical rounding if canonical rounding is enabled
        Parameters:
        a - The a parameter
        b - The b parameter
        Returns:
        The result of division
      • bellNumber

        public static final double bellNumber​(int n)
        Bell Numbers
        Parameters:
        n - the n
        Returns:
        if n >= 0 returns Bell numbers, otherwise returns Double.NaN.
      • bellNumber

        public static final double bellNumber​(double n)
        Bell number
        Parameters:
        n - the n
        Returns:
        if n <> Double.NaN return bellNumber( (int)Math.round(n) ), otherwise return Double.NaN.
      • eulerNumber

        public static final double eulerNumber​(int n,
                                               int k)
        Euler numbers
        Parameters:
        n - the n function param
        k - the k function param
        Returns:
        if n >=0 returns Euler number, otherwise return Double.NaN.
      • eulerNumber

        public static final double eulerNumber​(double n,
                                               double k)
        Euler numbers
        Parameters:
        n - the n function param
        k - the k function param
        Returns:
        if n, k <> Double.NaN returns eulerNumber( (int)Math.round(n), (int)Math.round(k) ), otherwise return Double.NaN.
      • factorial

        public static final double factorial​(int n)
        Factorial
        Parameters:
        n - the n function parameter
        Returns:
        Factorial if n >=0, otherwise returns Double.NaN.
      • factorial

        public static final double factorial​(double n)
        Factorial
        Parameters:
        n - the n function parameter
        Returns:
        if n <> Double.NaN return factorial( (int)Math.round(n) ), otherwise returns Double.NaN.
      • binomCoeff

        public static final double binomCoeff​(double n,
                                              long k)
        Generalized binomial coefficient
        Parameters:
        n - the n function parameter
        k - k the k function parameter
        Returns:
        Generalized binomial coefficient, if n = Double.NaN or k < 0 returns Double.NaN.
      • binomCoeff

        public static final double binomCoeff​(double n,
                                              double k)
        Generalized binomial coefficient
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        if n, k <> Double.NaN returns binomCoeff(n, (int)Math.round(k) ), otherwise returns Double.NaN.
      • numberOfPermutations

        public static final double numberOfPermutations​(double n,
                                                        long k)
        Generalized coefficient returning number of k permutations that can be drawn for n elements set.
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        For k greater than 0 return number of permutations, otherwise returns Double.NaN
      • numberOfPermutations

        public static final double numberOfPermutations​(double n,
                                                        double k)
        Generalized coefficient returning number of k permutations that can be drawn for n elements set.
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        For k greater than 0 return number of permutations, otherwise returns Double.NaN
      • bernoulliNumber

        public static final double bernoulliNumber​(int m,
                                                   int n)
        Bernoulli numbers
        Parameters:
        m - the m function parameter
        n - the n function parameter
        Returns:
        if n, m >= 0 returns Bernoulli number, otherwise returns Double.NaN.
      • bernoulliNumber

        public static final double bernoulliNumber​(double m,
                                                   double n)
        Bernoulli numbers
        Parameters:
        m - the m function parameter
        n - the n function parameter
        Returns:
        if n, m <> Double.NaN returns bernoulliNumber( (int)Math.round(m), (int)Math.round(n) ), otherwise returns Double.NaN.
      • Stirling1Number

        public static final double Stirling1Number​(int n,
                                                   int k)
        Stirling numbers of the first kind
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        Stirling numbers of the first kind
      • Stirling1Number

        public static final double Stirling1Number​(double n,
                                                   double k)
        Stirling numbers of the first kind
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        if n, k <> Doube.NaN returns Stirling1Number( (int)Math.round(n), (int)Math.round(k) ), otherwise returns Double.NaN.
      • Stirling2Number

        public static final double Stirling2Number​(int n,
                                                   int k)
        Stirling numbers of the second kind
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        Stirling numbers of the second kind
      • Stirling2Number

        public static final double Stirling2Number​(double n,
                                                   double k)
        Stirling numbers of the second kind
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        if n, k <> Doube.NaN returns Stirling2Number( (int)Math.round(n), (int)Math.round(k) ), otherwise returns Double.NaN.
      • worpitzkyNumber

        public static final double worpitzkyNumber​(int n,
                                                   int k)
        Worpitzky numbers
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        if n,k >= 0 and k <= n return Worpitzky number, otherwise return Double.NaN.
      • worpitzkyNumber

        public static final double worpitzkyNumber​(double n,
                                                   double k)
        Worpitzky numbers
        Parameters:
        n - the n function parameter
        k - the k function parameter
        Returns:
        if n,k <> Double.NaN returns worpitzkyNumber( (int)Math.round(n), (int)Math.round(k) ), otherwise return Double.NaN.
      • harmonicNumber

        public static final double harmonicNumber​(int n)
        Harmonic numer
        Parameters:
        n - the n function parameter
        Returns:
        if n > 0 returns harmonic number, otherwise returns 0 (empty summation operator)
      • harmonicNumber

        public static final double harmonicNumber​(double n)
        Harmonic number
        Parameters:
        n - the n function parameter
        Returns:
        if n <> Double.NaN returns harmonicNumber( (int)Math.round(n) ), otherwise returns Double.NaN
      • harmonicNumber

        public static final double harmonicNumber​(double x,
                                                  int n)
        Harmonic number 1/1 + 1/2^x + ... + 1/n^x
        Parameters:
        x - the x function parameter
        n - the n function parameter
        Returns:
        if x <> Double.NaN and x >= 0 Harmonic number, otherwise returns Double.NaN.
      • harmonicNumber

        public static final double harmonicNumber​(double x,
                                                  double n)
        Harmonic number 1/1 + 1/2^x + ... + 1/n^x
        Parameters:
        x - the x function parameter
        n - the n function parameter
        Returns:
        if x,n <> Double.NaN returns harmonicNumber( x, (int)Math.round(n) ), otherwise returns Double.NaN.
      • catalanNumber

        public static final double catalanNumber​(int n)
        Catalan numbers
        Parameters:
        n - the n function parameter
        Returns:
        Catalan numbers
      • catalanNumber

        public static final double catalanNumber​(double n)
        Catalan numbers
        Parameters:
        n - the n function parameter
        Returns:
        if n <> Double.NaN returns catalanNumber( (int)Math.round(n) ), otherwise returns Double.NaN.
      • fibonacciNumber

        public static final double fibonacciNumber​(int n)
        Fibonacci numbers
        Parameters:
        n - the n function parameter
        Returns:
        if n >= 0 returns fibonacci numbers, otherwise returns Double.NaN.
      • fibonacciNumber

        public static final double fibonacciNumber​(double n)
        Fibonacci numbers
        Parameters:
        n - the n function parameter
        Returns:
        if n <> Double.NaN returns fibonacciNumber( (int)Math.round(n) ), otherwise returns Double.NaN.
      • lucasNumber

        public static final double lucasNumber​(int n)
        Lucas numebrs
        Parameters:
        n - the n function parameter
        Returns:
        if n >= 0 returns Lucas numbers, otherwise returns Double.NaN.
      • lucasNumber

        public static final double lucasNumber​(double n)
        Lucas numebrs
        Parameters:
        n - the n function parameter
        Returns:
        if n <> Double.NaN returns lucasNumber( (int)Math.round(n) ), otherwise returns Double.NaN.
      • kroneckerDelta

        public static final double kroneckerDelta​(double i,
                                                  double j)
        Kronecker delta
        Parameters:
        i - the i function parameter
        j - the j function parameter
        Returns:
        if i,j <> Double.NaN returns Kronecker delta, otherwise returns Double.NaN.
      • kroneckerDelta

        public static final double kroneckerDelta​(int i,
                                                  int j)
        Kronecker delta
        Parameters:
        i - the i function parameter
        j - the j function parameter
        Returns:
        Kronecker delta
      • continuedFraction

        public static final double continuedFraction​(double... sequence)
        Continued fraction
        Parameters:
        sequence - the numbers
        Returns:
        if each number form the sequence <> Double.NaN and there is no division by 0 while computing returns continued fraction value, otherwise returns Double.NaN.
      • continuedPolynomial

        public static final double continuedPolynomial​(double... x)
        Continued polynomial
        Parameters:
        x - the x values
        Returns:
        if each number for x is different the Double.NaN returns continued polynomial, otherwise returns Double.NaN.
      • eulerPolynomial

        public static final double eulerPolynomial​(int m,
                                                   double x)
        Euler polynomial
        Parameters:
        m - the m parameter
        x - the x parameter
        Returns:
        if x <> Double.NaN and m >= 0 returns polynomial value, otherwise returns Double.NaN.
      • eulerPolynomial

        public static final double eulerPolynomial​(double m,
                                                   double x)
        Euler polynomial
        Parameters:
        m - the m parameter
        x - the x parameter
        Returns:
        if x,m <> Double.NaN returns eulerPolynomial( (int)Math.round(m), (int)Math.round(x) ), otherwise returns Double.NaN.
      • chi

        public static final double chi​(double x,
                                       double a,
                                       double b)
        Characteristic function x in (a,b)
        Parameters:
        x - the x value
        a - the left (lower) limit
        b - the right (upper) limit
        Returns:
        if x, a, b <> Double.NaN returns characteristic function value on the (a,b) range.
      • chi_LR

        public static final double chi_LR​(double x,
                                          double a,
                                          double b)
        Characteristic function x in [a,b]
        Parameters:
        x - the x value
        a - the left (lower) limit
        b - the right (upper) limit
        Returns:
        if x, a, b <> Double.NaN returns characteristic function value on the [a,b] range.
      • chi_L

        public static final double chi_L​(double x,
                                         double a,
                                         double b)
        Characteristic function x in [a,b)
        Parameters:
        x - the x value
        a - the left (lower) limit
        b - the right (upper) limit
        Returns:
        if x, a, b <> Double.NaN returns characteristic function value on the [a,b) range.
      • chi_R

        public static final double chi_R​(double x,
                                         double a,
                                         double b)
        Characteristic function x in (a,b]
        Parameters:
        x - the x value
        a - the left (lower) limit
        b - the right (upper) limit
        Returns:
        if x, a, b <> Double.NaN returns characteristic function value on the (a,b] range.
      • isAlmostInt

        public static final boolean isAlmostInt​(double a)
        Verifies whether provided number is almost integer
        Parameters:
        a - The number to be verified
        Returns:
        True if the number is almost integer according to the default epsilon, otherwise returns false.
        See Also:
        BinaryRelations.DEFAULT_COMPARISON_EPSILON
      • power

        public static final double power​(double a,
                                         double b)
        Power function a^b
        Parameters:
        a - the a function parameter
        b - the b function parameter
        Returns:
        if a,b <> Double.NaN returns Math.pow(a, b), otherwise returns Double.NaN.
      • root

        public static final double root​(double n,
                                        double x)
        Nth order root of a number
        Parameters:
        n - Root order
        x - Number
        Returns:
        Returns root of a number. If calculation is not possible Double.NaN is returned.
      • tetration

        public static final double tetration​(double a,
                                             double n)
        Tetration, exponential power, power series
        Parameters:
        a - base
        n - exponent
        Returns:
        Tetration result.
      • mod

        public static final double mod​(double a,
                                       double b)
        Modulo operator a % b
        Parameters:
        a - the a function parameter
        b - the b function parameter
        Returns:
        if a,b <> Double.NaN returns a % b.
      • sin

        public static final double sin​(double a)
        Sine trigonometric function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN return Math.sin(a), otherwise return Double.NaN.
      • cos

        public static final double cos​(double a)
        Cosine trigonometric function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.cos(a), otherwise returns Double.NaN.
      • tan

        public static final double tan​(double a)
        Tangent trigonometric function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.tan(a), otherwise returns Double.NaN.
      • ctan

        public static final double ctan​(double a)
        Cotangent trigonometric function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and tan(a) <> 0 returns 1 / Math.tan(a), otherwise returns Double.NaN.
      • sec

        public static final double sec​(double a)
        Secant trigonometric function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and cos(a) <> 0 returns 1 / Math.cos(a), otherwise returns Double.NaN.
      • cosec

        public static final double cosec​(double a)
        Cosecant trigonometric function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and sin(a) <> 0 returns 1 / Math.sin(a), otherwise returns Double.NaN.
      • asin

        public static final double asin​(double a)
        Arcus sine - inverse trigonometric sine function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.asin(a), otherwise returns Double.NaN.
      • acos

        public static final double acos​(double a)
        Arcus cosine - inverse trigonometric cosine function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.acos(a), otherwise returns Double.NaN.
      • atan

        public static final double atan​(double a)
        Arcus tangent - inverse trigonometric tangent function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.atan(a), otherwise returns Double.NaN.
      • actan

        public static final double actan​(double a)
        Arcus cotangent - inverse trigonometric cotangent function
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and a <> 0 returns Math.atan(1/a), otherwise returns Double.NaN.
      • asec

        public static final double asec​(double a)
        Arcus secant - inverse trigonometric secant function
        Parameters:
        a - the a function parameter
        Returns:
        Inverse trigonometric secant function
      • acosec

        public static final double acosec​(double a)
        Arcus cosecant - inverse trigonometric cosecant function
        Parameters:
        a - the a function parameter
        Returns:
        Inverse trigonometric cosecant function
      • ln

        public static final double ln​(double a)
        Natural logarithm
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.log(1/a), otherwise returns Double.NaN.
      • log2

        public static final double log2​(double a)
        Binary logarithm
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.log(a)/Math.log(2.0), otherwise returns Double.NaN.
      • log10

        public static final double log10​(double a)
        Common logarithm
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.log10(a), otherwise returns Double.NaN.
      • rad

        public static final double rad​(double a)
        Degrees to radius translation.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.toRadians(a), otherwise returns Double.NaN.
      • exp

        public static final double exp​(double a)
        Exponential function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.exp(a), otherwise returns Double.NaN.
      • sqrt

        public static final double sqrt​(double a)
        Square root.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.sqrt(a), otherwise returns Double.NaN.
      • sinh

        public static final double sinh​(double a)
        Hyperbolic sine function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.sinh(a), otherwise returns Double.NaN.
      • cosh

        public static final double cosh​(double a)
        Hyperbolic cosine function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.cosh(a), otherwise returns Double.NaN.
      • tanh

        public static final double tanh​(double a)
        Hyperbolic tangent function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.tanh(a), otherwise returns Double.NaN.
      • coth

        public static final double coth​(double a)
        Hyperbolic cotangent function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and tanh(a) <> 0 returns 1 / Math.tanh(a), otherwise returns Double.NaN.
      • sech

        public static final double sech​(double a)
        Hyperbolic secant function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and cosh(a) <> 0 returns 1 / Math.cosh(a), otherwise returns Double.NaN.
      • csch

        public static final double csch​(double a)
        Hyperbolic cosecant function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and sinh(a) <> 0 returns 1 / Math.sinh(a), otherwise returns Double.NaN.
      • deg

        public static final double deg​(double a)
        Radius to degrees translation.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.toDegrees(a), otherwise returns Double.NaN.
      • abs

        public static final double abs​(double a)
        Absolute value.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.abs(a), otherwise returns Double.NaN.
      • sgn

        public static final double sgn​(double a)
        Signum function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.signum(a), otherwise returns Double.NaN.
      • floor

        public static final double floor​(double a)
        Floor function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.floor(a), otherwise returns Double.NaN.
      • ceil

        public static final double ceil​(double a)
        Ceiling function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.ceil(a), otherwise returns Double.NaN.
      • arsinh

        public static final double arsinh​(double a)
        Arcus hyperbolic sine - inverse hyperbolic sine function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.log(a + Math.sqrt(a*a+1)), otherwise returns Double.NaN.
      • arcosh

        public static final double arcosh​(double a)
        Arcus hyperbolic cosine - inverse hyperbolic cosine function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN returns Math.log(a + Math.sqrt(a*a-1)), otherwise returns Double.NaN.
      • artanh

        public static final double artanh​(double a)
        Arcus hyperbolic tangent - inverse hyperbolic tangent function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and 1-a <> 0 returns 0.5*Math.log( (1+a)/(1-a) ), otherwise returns Double.NaN.
      • arcoth

        public static final double arcoth​(double a)
        Arcus hyperbolic tangent - inverse hyperbolic tangent function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and a-1 <> 0 returns 0.5*Math.log( (a+1)/(a-1) );, otherwise returns Double.NaN.
      • arsech

        public static final double arsech​(double a)
        Arcus hyperbolic secant - inverse hyperbolic secant function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and a <> 0 returns Math.log( (1+Math.sqrt(1-a*a))/a);, otherwise returns Double.NaN.
      • arcsch

        public static final double arcsch​(double a)
        Arcus hyperbolic cosecant - inverse hyperbolic cosecant function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and a <> 0 returns Math.log( (1+Math.sqrt(1-a*a))/a);, otherwise returns Double.NaN.
      • sa

        public static final double sa​(double a)
        Normalized sinc function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and a <> 0 returns Math.sin(PI*a) / (PI*a);, otherwise returns Double.NaN.
      • sinc

        public static final double sinc​(double a)
        Sinc function.
        Parameters:
        a - the a function parameter
        Returns:
        if a <> Double.NaN and a <> 0 returns Math.sin(a) / (a), otherwise returns Double.NaN.
      • log

        public static final double log​(double a,
                                       double b)
        General logarithm.
        Parameters:
        a - the a function parameter (base)
        b - the b function parameter (number)
        Returns:
        if a,b <> Double.NaN and log(b) <> 0 returns Math.log(a) / Math.log(b), otherwise returns Double.NaN.
      • round

        public static final double round​(double value,
                                         int places)
        Double rounding
        Parameters:
        value - double value to be rounded
        places - decimal places
        Returns:
        Rounded value
      • roundHalfUp

        public static final double roundHalfUp​(double value,
                                               int places)
        Double half up rounding
        Parameters:
        value - double value to be rounded
        places - decimal places
        Returns:
        Rounded value
      • roundDown

        public static final double roundDown​(double value,
                                             int places)
        Double down rounding
        Parameters:
        value - double value to be rounded
        places - decimal places
        Returns:
        Rounded value
      • roundUlp

        public static final double roundUlp​(double number)
        Unit in the last place rounding, see 0.1 + 0.1 + 0.1 vs roundUlp(0.1 + 0.1 + 0.1)
        Parameters:
        number - Double number that is to be rounded
        Returns:
        Double number with rounded ulp
        See Also:
        decimalDigitsBefore(double), ulp(double)
      • integerPart

        public static final double integerPart​(double x)
        Returns integer part of a double value.
        Parameters:
        x - Number
        Returns:
        For non- negative x returns Math.floor(x), otherwise returns -Math.floor(-x)
      • decimalDigitsBefore

        public static final int decimalDigitsBefore​(double value)
        For very small number returns the position of first significant digit, ie 0.1 = 1, 0.01 = 2
        Parameters:
        value - Double value, small one.
        Returns:
        Number of digits, number of places.
      • ulp

        public static final double ulp​(double value)
        Unit in the last place(ULP) for double
        Parameters:
        value - Double number
        Returns:
        ULP for a given double.
      • ulpDecimalDigitsBefore

        public static final int ulpDecimalDigitsBefore​(double value)
        Unit in The Last Place - number of decimal digits before
        Parameters:
        value - Double number
        Returns:
        Positive number of digits N for ulp = 1e-{N+1}, if ulp is > 1 then -1 is returned. Returned proper value is always between -1 and +322. If value is NaN then -2 is returned.
      • coalesce

        public static final double coalesce​(double[] values)
        Returns the first non-NaN value
        Parameters:
        values - List of values
        Returns:
        Returns the first non-NaN value, if list is null then returns Double.NaN, if list contains no elements then returns Double.NaN.