Class Set

java.lang.Object
parser.Set

public class Set extends Object
Class that provides utility methods for carrying out statistical analysis on a data set consisting of real numbers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private List<String>
    The data attribute of objects if this class
  • Constructor Summary

    Constructors
    Constructor
    Description
    Set(double... data)
     
    Set(List<String> data)
    Creates a new Set object initialized with the specified data set.
    Set(MathExpression function, List<String> data)
    Creates a new Set object initialized with a set of data coming from a mathematical MathExpression.
  • Method Summary

    Modifier and Type
    Method
    Description
    The list must have been originally supplied: matrix_add(A,B) {where A and B are matrices} It adds them out and returns the result as a list.
    The list must have been originally supplied: adjoint(A) {where A is a Matrix} It finds the adjoint of A and returns the result as a list.
    double
    avg()
     
    The list must have been originally supplied: adjoint(A) {where A is a Matrix} It finds the adjoint of A and returns the result as a list.
     
    cov()
     
    double
     
    Finds the numerical derivative of a Function which has been pre-defined in the Workspace.
    private List<String>
     
    The list must have been originally supplied: matrix_div(A,B) {where A and B are matrices} or matrix_div(A,k) {where A is a matrix and k is a scalar} It divides them out and returns the result as a list.
    The input list is such that: The first 2 entries specify the number of rows and columns.
    The list must have been originally supplied: transpose(A) {where A is a Matrix} It transposes A and returns the result as a list.
    The list must have been originally supplied: eigPoly(A) {where A is a Matrix} It finds the characterisic polynomial whose solution yields the eigenvalues of A and returns the result as a list.
    The list must have been originally supplied: eigvec(A) {where A is a Matrix} It finds the eigenvalues of A and returns the result as a list.
     
     
     
     
    Finds the numerical integral of a Function which has been pre-defined in the Workspace.
     
    The input list is such that: The first 2 entries specify the number of rows and columns.
    double
    max()
     
    double
     
    double
    min()
    this method determines the least value in a set of numbers
     
    double
     
    The list must have been originally supplied: matrix_mul(A,B) {where A and B are matrices} or matrix_mul(A,k) {where A is a matrix and k is a scalar} It multiplies them out and returns the result as a list.
     
     
    The list must have been originally supplied: matrix_pow(A,n) {where A is a Matrix and n is an integer.
    void
    The list must have been originally supplied: eigvec(A) {where A is a Matrix} It finds the eigenvalues of A and returns the result as a list.
    private static final void
     
    double
     
     
    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).
    double
    rms()
     
    double
    rng()
     
    Finds the zero of a Function which has been pre-defined in the Workspace.
    void
     
    int
     
    The input list must be an n rows by n+1 columns matrix
     
    double
     
    double
     
    The list must have been originally supplied: matrix_sub(A,B) {where A and B are matrices} It subtracts them out and returns the result as a list.
    double
    sum()
     
    double
     
     
    The list must have been originally supplied: transpose(A) {where A is a Matrix} It transposes A and returns the result as a list.
    The input list is such that: The first 2 entries specify the number of rows and columns.
    double
    var()
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • data

      private List<String> data
      The data attribute of objects if this class
  • Constructor Details

    • Set

      public Set(double... data)
      Parameters:
      data -
    • Set

      public Set(List<String> data)
      Creates a new Set object initialized with the specified data set.
      Parameters:
      data - the data set used to initialize the data attribute of this class
    • Set

      public Set(MathExpression function, List<String> data)
      Creates a new Set 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(ArrayList<String> data)
      Parameters:
      data - sets the data to be operated on
    • getData

      public List<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
    • gsum

      public BigDecimal gsum()
      Returns:
      the geomethrical (multiplied) sum of all elements in the data set
    • geom

      public BigDecimal geom()
      Returns:
      the geomethrical avarage 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:
      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 String cov()
      Returns:
      the coefficient of variation
    • displayOuputLineByLine

      private List<String> displayOuputLineByLine()
      Returns:
      displays the output of the result method as the sorting process proceeds.
    • sort

      public List<String> sort()
      Returns:
      a number list sorted in ascending order
    • invert

      public Matrix invert()
      Returns:
      the inverse of the Matrix as a number list
    • solveSystem

      public Matrix solveSystem()
      The input list must be an n rows by n+1 columns matrix
      Returns:
      a the solution to the system of equations represented by the number list
    • listToMatrix

      public Matrix listToMatrix()
      The input list is such that: The first 2 entries specify the number of rows and columns. The remaining entries are the Matrix's entries.
      Returns:
      a number list which represents the row-reduced echelon Matrix that the entries reduce to.
    • echelon

      public Matrix echelon()
      The input list is such that: The first 2 entries specify the number of rows and columns. The remaining entries are the Matrix's entries.
      Returns:
      a number list which represents the row-reduced echelon Matrix that the entries reduce to.
    • triMatrix

      public Matrix triMatrix()
      The input list is such that: The first 2 entries specify the number of rows and columns. The remaining entries are the Matrix's entries.
      Returns:
      a number list which represents the triangular Matrix that the entries reduce to.
    • median

      public double median()
      Returns:
      the median of the data set
    • mode

      public String mode()
      Returns:
      the mode of a number set as a list
    • random

      public List<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 String permutation()
      Returns:
      the permutation of 2 values.
    • combination

      public String combination()
      Returns:
      the combination of 2 values.
    • power

      public String power()
      Returns:
      Raises the number in index 0 to a power equal to the number in index 1.
    • differentiate

      public String differentiate()
      Finds the numerical derivative of a Function which has been pre-defined in the Workspace.
      Returns:
      the derivative at the specified value of the horizontal coordinate.
    • quadraticRoots

      public String quadraticRoots()
    • tartaglianRoots

      public String tartaglianRoots()
    • rootOfEquation

      public String rootOfEquation()
      Finds the zero of a Function which has been pre-defined in the Workspace.
      Returns:
      one of the roots of the Function object.
    • integrate

      public String integrate()
      Finds the numerical integral of a Function which has been pre-defined in the Workspace.
      Returns:
      the derivative at the specified value of the horizontal coordinate.
    • determinant

      public double determinant()
      Returns:
      the determinant or Double.NaN if the determinant does not exist.
    • multiplyMatrix

      public Matrix multiplyMatrix()
      The list must have been originally supplied: matrix_mul(A,B) {where A and B are matrices} or matrix_mul(A,k) {where A is a matrix and k is a scalar} It multiplies them out and returns the result as a list.
      Returns:
      a Matrix containing the matrix product (scalar or vector) depending on the second argument.
    • divideMatrix

      public Matrix divideMatrix()
      The list must have been originally supplied: matrix_div(A,B) {where A and B are matrices} or matrix_div(A,k) {where A is a matrix and k is a scalar} It divides them out and returns the result as a list.
      Returns:
      a Matrix containing the matrix division (scalar or vector) depending on the second argument.
    • addMatrix

      public Matrix addMatrix()
      The list must have been originally supplied: matrix_add(A,B) {where A and B are matrices} It adds them out and returns the result as a list.
      Returns:
      a Matrixcontaining the matrix addition (scalar or vector).
    • subtractMatrix

      public Matrix subtractMatrix()
      The list must have been originally supplied: matrix_sub(A,B) {where A and B are matrices} It subtracts them out and returns the result as a list.
      Returns:
      a Matrix containing the matrix difference.
    • powerMatrix

      public Matrix powerMatrix()
      The list must have been originally supplied: matrix_pow(A,n) {where A is a Matrix and n is an integer. If n is a double, it is rounded down to the nearest int.} It raises the Matrix to the power of the second argument and returns the result as a list.
      Returns:
      a Matrix containing the matrix's power.
    • transpose

      public Matrix transpose()
      The list must have been originally supplied: transpose(A) {where A is a Matrix} It transposes A and returns the result as a list.
      Returns:
      a Matrix containing the matrix transpose.
    • adjoint

      public Matrix adjoint()
      The list must have been originally supplied: adjoint(A) {where A is a Matrix} It finds the adjoint of A and returns the result as a list.
      Returns:
      a Matrix containing the matrix transpose.
    • cofactorMatrix

      public Matrix cofactorMatrix()
      The list must have been originally supplied: adjoint(A) {where A is a Matrix} It finds the adjoint of A and returns the result as a list.
      Returns:
      a Matrix containing the matrix transpose.
    • eigenVectors

      public Matrix eigenVectors()
      The list must have been originally supplied: eigvec(A) {where A is a Matrix} It finds the eigenvalues of A and returns the result as a list.
      Returns:
      a Matrix containing the matrix transpose.
    • printImpl

      private static final void printImpl(String data)
    • print

      public void print()
      The list must have been originally supplied: eigvec(A) {where A is a Matrix} It finds the eigenvalues of A and returns the result as a list.
    • eigenPoly

      public String eigenPoly()
      The list must have been originally supplied: eigPoly(A) {where A is a Matrix} It finds the characterisic polynomial whose solution yields the eigenvalues of A and returns the result as a list.
      Returns:
      a Matrix containing the matrix transpose.
    • editMatrix

      public Matrix editMatrix()
      The list must have been originally supplied: transpose(A) {where A is a Matrix} It transposes A and returns the result as a list.
      Returns:
      a Matrix containing the matrix transpose.
    • evaluateUserDefinedFunction

      public String evaluateUserDefinedFunction(String operator) throws ClassNotFoundException
      Parameters:
      operator - The operator.
      Returns:
      the value of the user defined function.
      Throws:
      ClassNotFoundException - if the function was never defined by the user.