MathFunctions
Kind: global class
new MathFunctions()
MathFunctions class
Compendium of math-related functions
MathFunctions.calcMax(array, [property]) ⇒ Number
Returns array max value
Kind: static method of MathFunctions
Returns: Number
- Max array value
Param | Type | Default | Description |
---|
array | Array | | Array to find max value of |
[property] | string | null | Property name to iterate |
MathFunctions.calcSum(array, [property]) ⇒ Number
Returns the sum of an array
Kind: static method of MathFunctions
Returns: Number
- Sum of array values
Param | Type | Default | Description |
---|
array | Array | | Array to find sum of |
[property] | string | null | Property name to iterate |
MathFunctions.calcMin(array, [property]) ⇒ Number
Returns min value in array
Kind: static method of MathFunctions
Returns: Number
- Min array value
Param | Type | Default | Description |
---|
array | Array | | Array to find min value of |
[property] | string | null | Property name to iterate |
MathFunctions.calcDomain(array, [property]) ⇒ Array.<number>
Returns min and max values in array
Kind: static method of MathFunctions
Returns: Array.<number>
- Min and max values in array
Param | Type | Default | Description |
---|
array | Array.<string> | Array.<number> | | Array to calc domain of |
[property] | string | null | Property name to iterate |
MathFunctions.calcMedian(array, [property]) ⇒ number
Returns median value of array
Kind: static method of MathFunctions
Returns: number
- Median of an array
Param | Type | Default | Description |
---|
array | Array | | Array to find median of |
[property] | string | null | Property name to iterate |
MathFunctions.calcMean(array, [property]) ⇒ Number
Returns mean value in array
Kind: static method of MathFunctions
Returns: Number
- Mean of an array
Param | Type | Default | Description |
---|
array | Array | | Array to find mean of |
[property] | string | null | Property name to iterate |
MathFunctions.calcPercent(toCalc, total) ⇒ Number
Calculate percentage using rule of three
Kind: static method of MathFunctions
Returns: Number
- Percentage
Param | Type | Description |
---|
toCalc | Number | Number to find percent of |
total | Number | Total |
MathFunctions.calcDistribution(array, [numOfBins]) ⇒ object
Gets array distribution
Kind: static method of MathFunctions
Returns: object
- Distribution of the array's values
Param | Type | Description |
---|
array | Array.<number> | Array.<string> | Array to find distribution of |
[numOfBins] | number | Number of bins to use (optional) |