Documentation of 'kcl.waterloo.math.Precise' Java class
Precise
kcl.waterloo.math

Class Precise



  • public class Precise
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.math.BigDecimal[] cumprod(double[] in)
      Returns the cumulative sum for a double[] as a BigDecimal
      static java.math.BigDecimal[] cumsum(double[] in)
      Returns the cumulative sum for a double[] as a BigDecimal
      static java.math.BigDecimal dot(double[] in1, double[] in2) 
      static java.math.BigDecimal factorial(java.math.BigDecimal n)
      Returns the factorial as a BigDecimal.
      static java.math.BigDecimal factorial(long n)
      Returns the factorial as a BigDecimal.
      static java.util.LinkedHashMap getFactorialTable() 
      static java.math.BigDecimal mean(double[] in)
      Returns the sumsq for a double[].
      static java.math.BigDecimal nCk(java.math.BigDecimal n, java.math.BigDecimal k)
      Accurately returns the binomial (N choose K) as a BigDecimal
      static java.math.BigDecimal nCk(int n, int k)
      Accurately returns the binomial (N choose K) as a BigDecimal
      static java.math.BigDecimal nCk(long n, long k)
      Accurately returns the binomial (N choose K) as a BigDecimal
      static void reset()
      Resets the internal hashmaps - thus freeing memory
      static java.math.BigDecimal sum(double[] in)
      Returns the sum for a double[].
      static java.math.BigDecimal sumsq(double[] in)
      Returns the sum of squares for a double[] accumulated as a BigDecimal
      • Methods inherited from class java.lang.Object

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

      • sum

        public static java.math.BigDecimal sum(double[] in)
        Returns the sum for a double[]. The sum is accumulated as a BigDecimal
        Parameters:
        in -
        Returns:
        a BigDecimal
      • cumsum

        public static java.math.BigDecimal[] cumsum(double[] in)
        Returns the cumulative sum for a double[] as a BigDecimal
        Parameters:
        in -
        Returns:
        BigDecimal
      • cumprod

        public static java.math.BigDecimal[] cumprod(double[] in)
        Returns the cumulative sum for a double[] as a BigDecimal
        Parameters:
        in -
        Returns:
        a BigDecimal
      • sumsq

        public static java.math.BigDecimal sumsq(double[] in)
        Returns the sum of squares for a double[] accumulated as a BigDecimal
        Parameters:
        in - BigDecimal
        Returns:
        `
      • dot

        public static java.math.BigDecimal dot(double[] in1,
                                               double[] in2)
      • mean

        public static java.math.BigDecimal mean(double[] in)
        Returns the sumsq for a double[]. The mean is calculated as a BigDecimal but returned as double
        Parameters:
        in -
        Returns:
        a BigDecimal
      • reset

        public static void reset()
        Resets the internal hashmaps - thus freeing memory
      • getFactorialTable

        public static java.util.LinkedHashMap getFactorialTable()
      • factorial

        public static java.math.BigDecimal factorial(long n)
        Returns the factorial as a BigDecimal. For n less than 0 returns null. For n=0,1 returns 1. Otherwise returns n!. Once calculated, values of n and n! are stored in a HashMap. Subsequent calls with input n will return the stored value of n!.
        Parameters:
        n - - type long
        Returns:
        n! - type BigDecimal
      • factorial

        public static java.math.BigDecimal factorial(java.math.BigDecimal n)
        Returns the factorial as a BigDecimal. For n less than 0 returns null. For n=0,1 returns 1. Otherwise returns n! Once calculated, values of n and n! are stored in a HashMap. Subsequent calls with input n will return the stored value of n!.
        Parameters:
        n - - type BigDecimal
        Returns:
        n! - type BigDecimal
      • nCk

        public static java.math.BigDecimal nCk(int n,
                                               int k)

        Accurately returns the binomial (N choose K) as a BigDecimal

        For k< 0, return ZERO

        For k==0 or k ==n return ONE

        For k==1 return n

        Otherwise returns

        n!/((n*k)! k!)

        Parameters:
        n - - int
        k - - int
        Returns:
        n!/((n*k)! k!)
        as a BigDecimal
      • nCk

        public static java.math.BigDecimal nCk(long n,
                                               long k)

        Accurately returns the binomial (N choose K) as a BigDecimal

        For k< 0, return ZERO

        For k==0 or k ==n return ONE

        For k==1 return n

        Otherwise returns

        n!/((n*k)! k!)

        Parameters:
        n - - long
        k - - long
        Returns:
        n!/((n*k)! k!)
        as a BigDecimal
      • nCk

        public static java.math.BigDecimal nCk(java.math.BigDecimal n,
                                               java.math.BigDecimal k)

        Accurately returns the binomial (N choose K) as a BigDecimal

        For k< 0, return ZERO

        For k==0 or k ==n return ONE

        For k==1 return n

        Otherwise returns

        n!/((n*k)! k!)

        Parameters:
        n - - BigDecimal
        k - - BigDecimal
        Returns:
        n!/((n*k)! k!)
        as a BigDecimal

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.