Package edu.jas.arith
Class Roots
- java.lang.Object
-
- edu.jas.arith.Roots
-
public class Roots extends java.lang.Object
Root computation algorithms. Roots for BigInteger and BigDecimals.- Author:
- Heinz Kredel
-
-
Constructor Summary
Constructors Constructor Description Roots()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigDecimal
root(BigDecimal A, int n)
N-th root.static BigInteger
root(BigInteger A, int n)
Integer n-th root.static BigComplex
sqrt(BigComplex A)
Square root.static BigDecimal
sqrt(BigDecimal A)
Square root.static BigDecimalComplex
sqrt(BigDecimalComplex a)
Complex decimal number square root.static BigInteger
sqrt(BigInteger A)
Integer square root.static BigRational
sqrt(BigRational A)
Square root.static BigInteger
sqrtInt(BigInteger A)
Integer square root.
-
-
-
Constructor Detail
-
Roots
public Roots()
-
-
Method Detail
-
root
public static BigInteger root(BigInteger A, int n)
Integer n-th root. Uses BigDecimal and newton iteration. R is the n-th root of A.- Parameters:
A
- big integer.n
- long.- Returns:
- the n-th root of A.
-
sqrt
public static BigInteger sqrt(BigInteger A)
Integer square root. Uses BigDecimal and newton iteration. R is the square root of A.- Parameters:
A
- big integer.- Returns:
- the square root of A.
-
sqrtInt
public static BigInteger sqrtInt(BigInteger A)
Integer square root. Uses BigInteger only. R is the square root of A.- Parameters:
A
- big integer.- Returns:
- the square root of A.
-
sqrt
public static BigDecimal sqrt(BigDecimal A)
Square root. R is the square root of A.- Parameters:
A
- big decimal.- Returns:
- the square root of A.
-
root
public static BigDecimal root(BigDecimal A, int n)
N-th root. R is the n-th root of A.- Parameters:
A
- big decimal.n
- long.- Returns:
- the n-th root of A.
-
sqrt
public static BigDecimalComplex sqrt(BigDecimalComplex a)
Complex decimal number square root.- Parameters:
a
- big decimal complex.- Returns:
- sqrt(a).
-
sqrt
public static BigRational sqrt(BigRational A)
Square root. R is the square root approximation of A. Convert to BigDecimal and compute square root.- Parameters:
A
- big rational.- Returns:
- the square root approximation of A.
-
sqrt
public static BigComplex sqrt(BigComplex A)
Square root. R is the square root approximation of A. Convert to BigDecimalComplex and compute square root.- Parameters:
A
- big complex rational.- Returns:
- the square root approximation of A.
-
-