de.unihalle.informatik.MiToBo.math

## Class MathX

• ```public class MathX
extends Object```
Math class with functions that are not provided by Java's Math class.
Author:
Oliver Gress
• ### Constructor Summary

Constructors
Constructor and Description
`MathX()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```binomial(int n, int k)```
Binomial coefficient of n over k
`static int` `factorial(int n)`
Calculates the factorial of the given natural number.
`static double` ```logSumP(double logP1, double logP2)```
Natural logarithm of the sum of two values P1 and P2 when only their natural logarithms log(P1) and log(P2) are given.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### MathX

`public MathX()`
• ### Method Detail

• #### logSumP

```public static double logSumP(double logP1,
double logP2)```
Natural logarithm of the sum of two values P1 and P2 when only their natural logarithms log(P1) and log(P2) are given.
Parameters:
`logP1` - natural logarithm of P1: log(P1)
`logP2` - natural logarithm of P2: log(P2)
Returns:
log( P1 + P2 )
• #### factorial

`public static int factorial(int n)`
Calculates the factorial of the given natural number.

Parameters:
`n` - Number to calculate the factorial for, must be positive.
Returns:
Factorial of n.
• #### binomial

```public static double binomial(int n,
int k)```
Binomial coefficient of n over k
Parameters:
`n` -
`k` -
Returns: