Package math.matrix.expressParser
Class MSet
java.lang.Object
math.matrix.expressParser.MSet
public class MSet
extends java.lang.Object
Class that provides utility methods for carrying
out statistical analysis on a data set consisting of real numbers.
- Author:
- GBENRO
-
Constructor Summary
Constructors Constructor Description MSet(double... data)MSet(java.util.List<java.lang.String> data)Creates a new MSet object initialized with the specified data set.MSet(MatrixFunction function, java.util.List<java.lang.String> data)Creates a new MSet object initialized with a set of data coming from a mathematical MathExpression. -
Method Summary
Modifier and Type Method Description doubleavg()java.lang.Stringcombination()java.lang.Stringcov()java.lang.StringevaluateUserDefinedFunction(java.lang.String operator)java.util.List<java.lang.String>getData()static voidmain(java.lang.String[] args)doublemax()doublemedian()doublemin()this method determines the least value in a set of numbersjava.lang.Stringmode()doublemrng()java.lang.Stringpermutation()java.lang.Stringpower()doubleprod()java.util.List<java.lang.String>random()if no value is found in the data set, the software will generate floating point values randomly between 0.0 and 1.0 ( 0.0 inclusive and 1.0 exclusive).doublerms()doublerng()voidsetData(java.util.ArrayList<java.lang.String> data)intsize()java.lang.Stringsort()java.util.List<java.lang.String>sort1()doublestd_dev()doublestd_err()doublesum()doublesumOfSquares()doublevar()
-
Constructor Details
-
MSet
public MSet(double... data)- Parameters:
data-
-
MSet
public MSet(java.util.List<java.lang.String> data)Creates a new MSet object initialized with the specified data set.- Parameters:
data- the data set used to initialize the data attribute of this class
-
MSet
Creates a new MSet object initialized with a set of data coming from a mathematical MathExpression.- Parameters:
function- the Math MathExpression from which the set of data is coming.data- the incoming data set
-
-
Method Details
-
setData
public void setData(java.util.ArrayList<java.lang.String> data)- Parameters:
data- sets the data to be operated on
-
getData
public java.util.List<java.lang.String> getData()- Returns:
- the data set
-
size
public int size()- Returns:
- the number of elements in the data set
-
sum
public double sum()- Returns:
- the sum of all elements in the data set
-
sumOfSquares
public double sumOfSquares()- Returns:
- the sum of squares of values in the data set.
-
prod
public double prod()- Returns:
- the product of all elements in the data set.
-
min
public double min()this method determines the least value in a set of numbers- Returns:
- the least value in a set of numbers
- Throws:
java.lang.NumberFormatException
-
max
public double max()- Returns:
- the maximum value in the data set.
-
avg
public double avg()- Returns:
- the meanor average value of a data set
-
rms
public double rms()- Returns:
- the root mean squared value of the data set
-
rng
public double rng()- Returns:
- the range of the data set
-
mrng
public double mrng()- Returns:
- the midrange of the data set
-
var
public double var()- Returns:
- the variance
-
std_dev
public double std_dev()- Returns:
- the standard deviation
-
std_err
public double std_err()- Returns:
- the standard error
-
cov
public java.lang.String cov()- Returns:
- the coefficient of variation
-
sort
public java.lang.String sort()- Returns:
- sorts a number set and returns the result as a string of comma separated values sorted in ascending order
-
sort1
public java.util.List<java.lang.String> sort1()- Returns:
- a number list sorted in ascending order
-
median
public double median()- Returns:
- the median of the data set
-
mode
public java.lang.String mode()- Returns:
- the mode of a number set as a list
-
random
public java.util.List<java.lang.String> random()if no value is found in the data set, the software will generate floating point values randomly between 0.0 and 1.0 ( 0.0 inclusive and 1.0 exclusive). Else: If the data set has only one number, e.g [m] this method will randomly generate a number between 0 and m-1 If the list has 2 numbers, say m and n, e.g [m,n] The method will generate n numbers between 0 and m-1- Returns:
- a list of values generated randomly according to the format of the random command.
-
permutation
public java.lang.String permutation()- Returns:
- the permutation of 2 values.
-
combination
public java.lang.String combination()- Returns:
- the combination of 2 values.
-
power
public java.lang.String power()- Returns:
- Raises the number in index 0 to a power equal to the number in index 1.
-
evaluateUserDefinedFunction
public java.lang.String evaluateUserDefinedFunction(java.lang.String operator) throws java.lang.ClassNotFoundException- Parameters:
operator- The operator.- Returns:
- the value of the user defined function.
- Throws:
java.lang.ClassNotFoundException- if the function was never defined by the user.
-
main
public static void main(java.lang.String[] args)
-