Class Agm
java.lang.Object
de.tilman_neumann.jml.transcendental.Agm
public class Agm
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description Agm()
-
Method Summary
Modifier and Type Method Description static java.math.BigDecimal
agm(java.math.BigDecimal a, java.math.BigDecimal b, Scale outScale)
Arithmetic-geometric mean of a and b.static int
getResultMagnitude(java.math.BigDecimal a, java.math.BigDecimal b)
Computes an estimate of the size of agm(a, b) in decimal digits.static void
main(java.lang.String[] args)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Agm
public Agm()
-
-
Method Details
-
agm
public static java.math.BigDecimal agm(java.math.BigDecimal a, java.math.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(java.math.BigDecimal a, java.math.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(java.lang.String[] args)
-