Class Agm


  • public class Agm
    extends Object
    • Constructor Detail

      • Agm

        public Agm()
    • Method Detail

      • agm

        public static BigDecimal agm​(BigDecimal a,
                                     BigDecimal b,
                                     Scale outScale)
        Arithmetic-geometric mean of a and b. The core is computed in BigIntegers, which is much faster than a BigDecimal-core. agm(a, b) will be pretty slow if |ln(|a/b|)| is large, because then the initial sqrt guess is not good enough.
        Parameters:
        a -
        b -
        outScale - desired precision in after-floating point digits
        Returns:
        agm(a, b)
      • getResultMagnitude

        public static int getResultMagnitude​(BigDecimal a,
                                             BigDecimal b)
        Computes an estimate of the size of agm(a, b) in decimal digits.
        Parameters:
        a -
        b -
        Returns:
        estimated magnitude of agm(a, b)
      • main

        public static void main​(String[] args)