Package org.tweetyproject.commons.util
Class MathTools
java.lang.Object
org.tweetyproject.commons.util.MathTools
This class contains some useful math tools.
- Author:
- Matthias Thimm
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaverageAndVariance(Collection<Double> values)
Compute the average value and the variance of the given list of numbers.static Integer
This method computes "n choose k".static int
faculty(int i)
Computes the faculty of the given number.
-
Constructor Details
-
MathTools
public MathTools()
-
-
Method Details
-
binomial
This method computes "n choose k". If n < 0 or k < 0 the result is defined to be 0.- Parameters:
n
- an integer.k
- an integer- Returns:
- the value of "n choose k".
-
faculty
public static int faculty(int i)Computes the faculty of the given number.- Parameters:
i
- an integer.- Returns:
- the value 1*...*i or 1 if i==0.
-
averageAndVariance
Compute the average value and the variance of the given list of numbers.- Parameters:
values
- some values- Returns:
- a pair of average value (first element) and variance (second element).
-