es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
19 lines (18 loc) • 768 B
TypeScript
/**
* Calculates the variance of a set of numbers.
* @param {number[]} numbers - The array of numbers to calculate variance for.
* @returns {number} The variance of the numbers.
* @example
* console.log(variance([1, 2, 3, 4, 5])); // 2
* console.log(variance([10, 10, 10])); // 0
*/
export declare function variance(numbers: number[]): number;
/**
* Calculates the standard deviation of a set of numbers.
* @param {number[]} numbers - The array of numbers to calculate standard deviation for.
* @returns {number} The standard deviation of the numbers.
* @example
* console.log(standardDeviation([2, 4, 4, 4, 5, 5, 7, 9])); // 2
* console.log(standardDeviation([10, 10, 10])); // 0
*/
export declare function standardDeviation(numbers: number[]): number;