uk.ac.leeds.ccg.andyt.generic.math
Class Generic_BigInteger
java.lang.Object
uk.ac.leeds.ccg.andyt.generic.math.Generic_Number
uk.ac.leeds.ccg.andyt.generic.math.Generic_BigInteger
public class Generic_BigInteger
- extends Generic_Number
Method Summary |
static java.math.BigDecimal |
exp(java.math.BigInteger x,
java.math.BigDecimal e,
Generic_BigDecimal a_Generic_BigDecimal,
int decimalPlaces,
java.math.RoundingMode a_RoundingMode)
e^x = 1 + x/1! +x^2/2! + x^3/3! +... |
java.math.BigInteger |
factorial(java.lang.Integer x)
Adds values to _Factorial_TreeMap if they do not already exist. |
void |
init_Factorial_TreeMap()
Initialises _Factorial_TreeMap |
static void |
main(java.lang.String[] args)
|
static java.math.BigInteger |
max(java.math.BigInteger x,
java.math.BigInteger y)
|
static java.math.BigInteger |
min(java.math.BigInteger x,
java.math.BigInteger y)
|
static java.math.BigDecimal |
power(java.math.BigInteger x,
int y,
int decimalPlaces,
java.math.RoundingMode a_RoundingMode)
|
static java.math.BigDecimal |
power(java.math.BigInteger x,
long y,
int decimalPlaces,
java.math.RoundingMode a_RoundingMode)
|
static java.math.BigDecimal |
reciprocal(java.math.BigInteger x,
int decimalPlace,
java.math.RoundingMode a_RoundingMode)
|
void |
test_factorial()
|
void |
test_power()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Two
public static final java.math.BigInteger Two
Three
public static final java.math.BigInteger Three
Hundred
public static final java.math.BigInteger Hundred
Integer_MAX_VALUE
public static final java.math.BigInteger Integer_MAX_VALUE
Long_MAX_VALUE
public static final java.math.BigInteger Long_MAX_VALUE
_Factorial_TreeMap
public java.util.TreeMap<java.lang.Integer,java.math.BigInteger> _Factorial_TreeMap
Generic_BigInteger
public Generic_BigInteger()
- Creates a new instance of Generic_BigDecimal
main
public static void main(java.lang.String[] args)
- Parameters:
args
- the command line arguments
test_power
public void test_power()
test_factorial
public void test_factorial()
init_Factorial_TreeMap
public void init_Factorial_TreeMap()
- Initialises _Factorial_TreeMap
max
public static java.math.BigInteger max(java.math.BigInteger x,
java.math.BigInteger y)
- Parameters:
x
- y
-
- Returns:
- the larger (closer to positive infinity) of either x or y
min
public static java.math.BigInteger min(java.math.BigInteger x,
java.math.BigInteger y)
- Parameters:
x
- y
-
- Returns:
- the larger (closer to negative infinity) of either x or y
factorial
public java.math.BigInteger factorial(java.lang.Integer x)
- Adds values to _Factorial_TreeMap if they do not already exist.
- Parameters:
x
-
- Returns:
- x! as a BigInteger
power
public static java.math.BigDecimal power(java.math.BigInteger x,
int y,
int decimalPlaces,
java.math.RoundingMode a_RoundingMode)
- Parameters:
x
- y
-
- Returns:
- x^y
power
public static java.math.BigDecimal power(java.math.BigInteger x,
long y,
int decimalPlaces,
java.math.RoundingMode a_RoundingMode)
- Parameters:
x
- y
-
- Returns:
- x^y
reciprocal
public static java.math.BigDecimal reciprocal(java.math.BigInteger x,
int decimalPlace,
java.math.RoundingMode a_RoundingMode)
- Parameters:
x
- decimalPlace
- a_RoundingMode
-
- Returns:
- 1/x Accurate to decimalPlace number of decimal places. If x = 0
then an IllegalArgumentException is thrown
exp
public static java.math.BigDecimal exp(java.math.BigInteger x,
java.math.BigDecimal e,
Generic_BigDecimal a_Generic_BigDecimal,
int decimalPlaces,
java.math.RoundingMode a_RoundingMode)
- e^x = 1 + x/1! +x^2/2! + x^3/3! +...
- Parameters:
x
- decimalPlaces
-
- Returns:
- e^x where e is like Generic_BigDecimal._E