net.simplace.util.service.MathHelper
public class MathHelper {
// Public Constructors
public MathHelper();
// Class Methods public static void
calulateLinearRegression(int ind, double[] x, double[] y,
FWSimVariable aRegressionM,
FWSimVariable aRegressionB);
Calculates linear regression
- ind length of vector
- x vector with x-values
- y vector with y-values
- aRegressionM stores the calculated m (slope)
- aRegressionB stores the calculated b
public static double
AFGEN(TreeMap sample, double x);
Computes a linear interpolation for x. The method returns the leftmost or rightmost value if x is out of range.
- sample data set
- x point at which the value is computed
returns the interpolated value
public static double
INSW(double testvalue, double X2, double X3);
Returns one value, if the test value is negative and another value, if the test value ist nonnegative
- testvalue
- X2 value returned if test value is negative
- X3 value returned if test value is positive or zero
returns resulting value
public static double
INSW(boolean testvalue, double X2, double X3);
Returns one value, if the test value is false and another value, if the test value ist nonnegative
- testvalue
- X2 value returned if test value is negative
- X3 value returned if test value is positive or zero
returns resulting value
public static int
REAAND(double x1, double x2);
Tests whether two values are positive
- x1 first value
- x2 second value
returns 1 if both are positive, 0 otherwise
public static double
LIMIT(double XL, double XH, double X);
Limits a value to a lower and upper bound
- XL lower bound
- XH upper bound
- X value
returns the value or it's lower/upper bound if it exceeds the bounds
public static double
NOTNUL(double x);
Returns 1 instead of 0 if the value is 0. Used to avoid division by 0
returns value or 1
public static Number
MAX(LinkedList aLinkedList, int i);
Calculates the maximum of a list of values
- aLinkedList list of values
- i
returns the maximum
public static Number
MIN(LinkedList aLinkedList, int i);
Calculates the minimum of a list of values
- aLinkedList list of values
- i
returns the minimum
public static Number
AVG(LinkedList aLinkedList, int i);
Calculates the average of a list of values
- aLinkedList list of values
- i
returns the average
public static Number
SUM(LinkedList aLinkedList, int i);
Calculates the sum of a list of values
- aLinkedList list of values
- i
returns the sum
public static Double[]
ADD(Double[] aFirstObjectToCalculateWith, Double[]
aSecondObjectToCalculateWith);
Calculates the sum of a list of values
returns the sum
public static Integer[]
ADD(Integer[] aFirstObjectToCalculateWith, Integer[]
aSecondObjectToCalculateWith);
Calculates the sum of a list of values
returns the sum
public static Double[]
MULTIPLY(Double[] aFirstObjectToCalculateWith, Object
aSecondObjectToCalculateWith);
Calculates the product of a list of values
returns the sum
public static Integer[]
MULTIPLY(Integer[] aFirstObjectToCalculateWith,
Object aSecondObjectToCalculateWith);
Calculates the product of a list of values
returns the sum
public static double
GaussIntegrationWeight(int n, int i);
Returns the weights for Gauß-Legendre-Integration
- n degree of polynomial
- i number of weight
returns weight
public static double
GaussIntegrationX(int n, int i);
Returns the locations (x-values) for Gauß-Legendre-Integration
- n degree of polynomial
- i number of location
returns x-value
public static double
REANOR(double a, double b);
Returns 1 if two values are both zero or negative, returns 0 otherwise
- a first value
- b second value
returns 1 or 0
}