Package net.simplace.core.service
Class MathHelper
java.lang.Object
net.simplace.core.service.MathHelper
- Author:
- XPMUser
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Double[]
Calculates the sum of a list of valuesstatic Integer[]
Calculates the sum of a list of valuesstatic Number
AVG
(LinkedList aLinkedList, FWSimVariable.DATA_TYPE aDataType, int i) Calculates the average of a list of valuesstatic void
calulateLinearRegression
(int ind, double[] x, double[] y, FWSimVariable<Double> aRegressionM, FWSimVariable<Double> aRegressionB) Calculates linear regressionstatic Integer
COUNT
(LinkedList aLinkedList) static double
GaussIntegrationWeight
(int n, int i) Returns the weights for Gauß-Legendre-Integrationstatic double
GaussIntegrationX
(int n, int i) Returns the locations (x-values) for Gauß-Legendre-Integrationstatic Number
MAX
(LinkedList aLinkedList, int i) Calculates the maximum of a list of valuesstatic Number
MIN
(LinkedList aLinkedList, int i) Calculates the minimum of a list of valuesstatic Double[]
Calculates the product of a list of valuesstatic Integer[]
Calculates the product of a list of valuesstatic Number
SUM
(LinkedList aLinkedList, FWSimVariable.DATA_TYPE aDataType, int i) Calculates the sum of a list of values
-
Constructor Details
-
MathHelper
public MathHelper()
-
-
Method Details
-
MAX
Calculates the maximum of a list of values- Parameters:
aLinkedList
- list of valuesi
-- Returns:
- the maximum
-
MIN
Calculates the minimum of a list of values- Parameters:
aLinkedList
- list of valuesi
-- Returns:
- the minimum
-
AVG
Calculates the average of a list of values- Parameters:
aLinkedList
- list of valuesaDataType
-i
-- Returns:
- the average
-
SUM
Calculates the sum of a list of values- Parameters:
aLinkedList
- list of valuesaDataType
-i
-- Returns:
- the sum
-
COUNT
- Parameters:
aLinkedList
-aDataType
-aI
-- Returns:
-
ADD
public static Double[] ADD(Double[] aFirstObjectToCalculateWith, Double[] aSecondObjectToCalculateWith) Calculates the sum of a list of values- Parameters:
aFirstObjectToCalculateWith
-aSecondObjectToCalculateWith
- two values to sum up- Returns:
- the sum
-
ADD
public static Integer[] ADD(Integer[] aFirstObjectToCalculateWith, Integer[] aSecondObjectToCalculateWith) Calculates the sum of a list of values- Parameters:
aFirstObjectToCalculateWith
-aSecondObjectToCalculateWith
- two values to sum up- Returns:
- the sum
-
MULTIPLY
public static Double[] MULTIPLY(Double[] aFirstObjectToCalculateWith, Object aSecondObjectToCalculateWith) Calculates the product of a list of values- Parameters:
aFirstObjectToCalculateWith
-aSecondObjectToCalculateWith
- two values to multiply- Returns:
- the sum
-
MULTIPLY
public static Integer[] MULTIPLY(Integer[] aFirstObjectToCalculateWith, Object aSecondObjectToCalculateWith) Calculates the product of a list of values- Parameters:
aFirstObjectToCalculateWith
-aSecondObjectToCalculateWith
- two values to multiply- Returns:
- the sum
-
GaussIntegrationWeight
public static double GaussIntegrationWeight(int n, int i) Returns the weights for Gauß-Legendre-Integration- Parameters:
n
- degree of polynomiali
- number of weight- Returns:
- weight
-
GaussIntegrationX
public static double GaussIntegrationX(int n, int i) Returns the locations (x-values) for Gauß-Legendre-Integration- Parameters:
n
- degree of polynomiali
- number of location- Returns:
- x-value
-
calulateLinearRegression
public static void calulateLinearRegression(int ind, double[] x, double[] y, FWSimVariable<Double> aRegressionM, FWSimVariable<Double> aRegressionB) Calculates linear regression- Parameters:
ind
- length of vectorx
- vector with x-valuesy
- vector with y-valuesaRegressionM
- stores the calculated m (slope)aRegressionB
- stores the calculated b
-