This module supports mathematics
-
TCCMaths_Functions | This module supports mathematics |
Functions | |
f_maxIL | Return an IntegerList with the highest number found at index 0 and the index of ilist where it’s found at index 1 |
f_maxFL | Return an FloatList with the highest number found at index 0 and the index of flist where it’s fond at index 1 |
f_minIL | Return an IntegerList with the lowest number found at index 0 and the index of ilist where it’s fond at index 1 |
f_minFL | Return an FloatList with the highest number found at index 0 and the index of flist where it’s fond at index 1 |
f_averageFL | Return the average of flist |
f_averageIL | Return the average of ilist |
f_updateFL | Append tail to the end of head (head return as inout) |
f_updateIL | Append tail to the end of head (head return as inout) |
f_stdFL | Return the normalized standard devILtion of float list (so the average square distance from the center of elements in the list) |
f_stdFLL | Return the normalized standard devILtion of float list using custom center (so it is the average square distance from a user defined central value) |
f_stdIL | Return the normalized standard devILtion of integer list (so the average square distance from the center of points) |
f_stdILL | Return the normalized standard devILtion of integer list using custom center (so it is the average square distance from a user defined central value) |
f_sinVL | Return the values of the sine function |
f_cosVL | Return the values of the cosine function |
f_sin | Return the sine of angle radILns |
f_cos | Return the cosine of angle radILns |
f_asin | Return the arc sine of value in [-pi/2, +pi/2] |
f_acos | Return the arc cosine of value in [0, pi] |
f_powFF | Raise to power (float to float power) |
f_powII | Raise to power (integer to integer power) |
f_powIF | Raise to power (integer to float power) |
f_powFI | Raise to power (float to integer power) |
f_sqrF | Raise a float value to square |
f_sqrI | Raise an integer value to square |
f_sqrtF | Square root of float value |
f_sqrtI | Square root of integer value |
f_ceil | Return the smallest integer value that is not less then value |
f_floor | Return the largest integer value that is not greater then value |
f_exp | Return the exponential value of the argument |
f_log | Return the natural logarithm of the argument |
f_generate_poissonTable | Returns with an initialized poisson table which is a cumulative probability distribution list for a given lambda. |
f_getNext_poissonValue | Returns with a random poisson value by the given poisson table and lambda poisson variance. |
f_gen_Exponential_Distribution(in float p_lambda) return float | Returns with the exponential random variable for a given lambda |
external function f_maxIL( in IntegerList ilist ) return IntegerList
Return an IntegerList with the highest number found at index 0 and the index of ilist where it’s found at index 1
ilist | in IntegerList - integer array |
<IntegerList> | integer array: { <max>, <max index> } |
-
-
external function f_maxFL( in FloatList flist ) return FloatList
Return an FloatList with the highest number found at index 0 and the index of flist where it’s fond at index 1
flist | in FloatList - integer array |
<FloatList> | float array: { <max>, <max index> } |
-
-
external function f_minIL( in IntegerList ilist ) return IntegerList
Return an IntegerList with the lowest number found at index 0 and the index of ilist where it’s fond at index 1
ilist | in IntegerList - integer array |
<IntegerList> | integer array: { <min>, <min index> } |
-
-
external function f_minFL( in FloatList flist ) return FloatList
Return an FloatList with the highest number found at index 0 and the index of flist where it’s fond at index 1
flist | in FloatList - integer array |
<FloatList> | float array: { <min>, <min index> } |
-
-
external function f_averageFL( in FloatList flist ) return float
Return the average of flist
flist | in FloatList - integer array |
float | average of float numbers |
-
-
external function f_averageIL( in IntegerList ilist ) return float
Return the average of ilist
ilist | in IntegerList - integer array |
float | average of integer numbers |
-
-
external function f_updateIL( inout IntegerList head, in IntegerList tail )
Append tail to the end of head (head return as inout)
head | in IntegerList - first part of the integer list |
tail | in IntegerList - second part of the integer list |
-
-
-
external function f_stdFL( in FloatList flist ) return float
Return the normalized standard devILtion of float list (so the average square distance from the center of elements in the list)
flist | in FloatList - float list |
float | normalized, standard derivate |
-
E.g. list = {2.0, 4.0}
u = (2.0 + 4.0) / 2 <- center of elements in the list
len = sizeof(list)
[ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
external function f_stdFLL( in FloatList flist, in float u ) return float
Return the normalized standard devILtion of float list using custom center (so it is the average square distance from a user defined central value)
u | in float - user defined central value |
flist | in FloatList - float list |
float | normalized, standard derivate |
-
Note: u is the average value of flist and has to be calculated before a call to this function
E.g. list = {2.0, 4.0}
u <- user input
len = sizeof(list)
[ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
external function f_stdIL( in IntegerList ilist ) return float
Return the normalized standard devILtion of integer list (so the average square distance from the center of points)
ilist | in IntegerList - integer list |
float | normalized, standard derivate |
-
E.g. list = {2.0, 4.0}
u = (2.0 + 4.0) / 2 <- center of elements in the list
len = sizeof(list)
[ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
external function f_stdILL( in IntegerList ilist, in float u ) return float
Return the normalized standard devILtion of integer list using custom center (so it is the average square distance from a user defined central value)
u | in float - user defined central value |
ilist | in IntegerList - integer list |
float | normalized, standard derivate |
-
Note: u is a user defined value
E.g. list = {2.0, 4.0}
u <- user input
len = sizeof(list)
[ ( (2.0-u)^2 + (4.0-u)^2 ) / len ] ^ (0.5)
external function f_sinVL( in float freq, in float altitude, in float start_val, in integer len, in float step ) return FloatList
Return the values of the sine function
freq | in float - the frequency of the sine curve |
altitude | in float - the altitude of the sine curve |
start_val | in float - the starting value passed to the sine function |
len | in integer - the wanted number of points of the sine curve |
step | in float - the length between the points on the sine curve |
<FloatList> | the wanted points in a float list |
-
Generation of one sin value:
altitude * sin(2 * pi * freq * start_val)
start_val := start_val + step
external function f_cosVL( in float freq, in float altitude, in float start_val, in integer len, in float step ) return FloatList
Return the values of the cosine function
freq | in float - the frequency of the sine curve |
altitude | in float - the altitude of the sine curve |
start_val | in float - the starting value passed to the sine function |
len | in integer - the wanted number of points of the sine curve |
step | in float - the length between the points on the sine curve |
<FloatList> | the wanted points in a float list |
-
Generation of one cos value:
altitude * cos(2 * pi * freq * start_val)
start_val := start_val + step
function f_generate_poissonTable( in float p_lambda, out t_Poisson_Table p_pTable ) return boolean
Returns with an initialized poisson table which is a cumulative probability distribution list for a given lambda.
p_lambda | in float - the lambda variance of the poisson distribution |
p_pTable | out t_Poisson_Table - the generated poisson table |
*boolean* | true if the generation was success |
If exp(-lambda) is zero than the table generation fails
The table used to get a poisson value by a random number indicates the next poisson value that should be use. See f_getNext_poissonValue function for more details. The size of the table will be lambda * 2. Note: With this method we can only generate correct values for lambda-s smaller than about 100-110 This is due to f_powFF(p_lambda, j) is rounded to infinity above lambda-s bigger than about 150
function f_getNext_poissonValue( in float p_lambda, inout t_Poisson_Table p_pTable, out boolean p_sucess ) return integer
Returns with a random poisson value by the given poisson table and lambda poisson variance.
p_lambda | in float - the lambda variance of the poisson distribution |
p_pTable | inout t_Poisson_Table - the poisson table |
p_sucess | out boolean - indicates if the returned value is from a successfully generated poisson table or not If false, an extremly rare error happened under the table generation and this need to be regenerate! |
*integer* | the selected random poisson value between 0 and sizeof(p_pTable) |
-
The function checks the input table if it is initialized or not and if not first of all generates it by the f_generate_poissonTable function. If the table was initialized checks the given lambda if it was used to generate the table. If it is different, regenerates the table. After these checks we have the correct initialized poisson table for the given p_lambda. Finally it returns with a random poisson value by the table.
function f_gen_Exponential_Distribution( in float p_lambda ) return float
Returns with the exponential random variable for a given lambda
p_lambda | in float - the lambda variance of the exponential distribution |
*float* | the exponential random variable for the given lambda |
-
The function works as the following:
Return an IntegerList with the highest number found at index 0 and the index of ilist where it’s found at index 1
external function f_maxIL( in IntegerList ilist ) return IntegerList
Return an FloatList with the highest number found at index 0 and the index of flist where it’s fond at index 1
external function f_maxFL( in FloatList flist ) return FloatList
Return an IntegerList with the lowest number found at index 0 and the index of ilist where it’s fond at index 1
external function f_minIL( in IntegerList ilist ) return IntegerList
Return an FloatList with the highest number found at index 0 and the index of flist where it’s fond at index 1
external function f_minFL( in FloatList flist ) return FloatList
Return the average of flist
external function f_averageFL( in FloatList flist ) return float
Return the average of ilist
external function f_averageIL( in IntegerList ilist ) return float
Append tail to the end of head (head return as inout)
external function f_updateFL( inout FloatList head, in FloatList tail )
Append tail to the end of head (head return as inout)
external function f_updateIL( inout IntegerList head, in IntegerList tail )
Return the normalized standard devILtion of float list (so the average square distance from the center of elements in the list)
external function f_stdFL( in FloatList flist ) return float
Return the normalized standard devILtion of float list using custom center (so it is the average square distance from a user defined central value)
external function f_stdFLL( in FloatList flist, in float u ) return float
Return the normalized standard devILtion of integer list (so the average square distance from the center of points)
external function f_stdIL( in IntegerList ilist ) return float
Return the normalized standard devILtion of integer list using custom center (so it is the average square distance from a user defined central value)
external function f_stdILL( in IntegerList ilist, in float u ) return float
Return the values of the sine function
external function f_sinVL( in float freq, in float altitude, in float start_val, in integer len, in float step ) return FloatList
Return the values of the cosine function
external function f_cosVL( in float freq, in float altitude, in float start_val, in integer len, in float step ) return FloatList
Return the sine of angle radILns
external function f_sin( in float angle ) return float
Return the cosine of angle radILns
external function f_cos( in float angle ) return float
Return the arc sine of value in [-pi/2, +pi/2]
external function f_asin( in float val ) return float
Return the arc cosine of value in [0, pi]
external function f_acos( in float val ) return float
Raise to power (float to float power)
external function f_powFF( in float base, in float expo ) return float
Raise to power (integer to integer power)
external function f_powII( in integer base, in integer expo ) return integer
Raise to power (integer to float power)
external function f_powIF( in integer base, in float expo ) return float
Raise to power (float to integer power)
external function f_powFI( in float base, in integer expo ) return float
Raise a float value to square
external function f_sqrF( in float base ) return float
Raise an integer value to square
external function f_sqrI( in integer base ) return integer
Square root of float value
external function f_sqrtF( in float base ) return float
Square root of integer value
external function f_sqrtI( in integer base ) return float
Return the smallest integer value that is not less then value
external function f_ceil( in float val ) return integer
Return the largest integer value that is not greater then value
external function f_floor( in float val ) return integer
Return the exponential value of the argument
external function f_exp( in float val ) return float
Return the natural logarithm of the argument
external function f_log( in float val ) return float
Returns with an initialized poisson table which is a cumulative probability distribution list for a given lambda.
function f_generate_poissonTable( in float p_lambda, out t_Poisson_Table p_pTable ) return boolean
Returns with a random poisson value by the given poisson table and lambda poisson variance.
function f_getNext_poissonValue( in float p_lambda, inout t_Poisson_Table p_pTable, out boolean p_sucess ) return integer
Returns with the exponential random variable for a given lambda
function f_gen_Exponential_Distribution( in float p_lambda ) return float
List of integer
type record of integer IntegerList
List of float
type record of float FloatList