/** * Add some lazy math that should have been available at first on JS. */ export declare class LazyMath { /** * Compute the remainder of a / b. a % b IS NOT modulo in JS for some reason. * @param {number} a What we want the remainder from. * @param {number} b What's dividing a. * @returns A value between 0 (included) and the remainder of the divisor (not included). */ static modulo(a: number, b: number): number; /** * Get the leftover to obtain an integer less or equal to n. * @param {number} n The number to get the fractional part from. * @returns {number} The fractional part of the number a. */ static frac(n: number): number; /** * Clamp a value between 0 and 1. * @param {number} a The number to clamp. * @returns {number} A value between 0 and 1. */ static saturate(a: number): number; /** * Iterative sum of f. * @param {number} k The start index. * @param {number} n The last index. * @param {(i: number) => number} f A function to execute. * @returns {number} The result of the sum. */ static sum(k: number, n: number, f: (i: number) => number): number; /** * Iterative product of f. * @param {number} k The start index. * @param {number} n The last index. * @param {(i: number) => number} f A function to execute. * @returns {number} The result of the product. */ static product(k: number, n: number, f: (i: number) => number): number; /** * A primary test that will return true if the number is prime. Since JS use floating point arithmetic on number, the number is floored before the test. * @param {number} n The number to test. * @returns {boolean} True if the number is prime. */ static isPrime(n: number): boolean; /** * Return 1 if x is gequal to n, otherwise n. * @param {number} n Number to apply step. * @param {number} x Step comparison. * @returns {number} The result of the operation. */ static step(n: number, x: number): number; /** * Do a linear interpolation between a and b using the parameter t for the interpolated distance. * @param {number} a The starting position. * @param {number} b The ending position. * @param {number} t A value between 0 and 1 (0 being 0% and 1 being 100%), determining how much we interpolate between a and b. * @returns {number} A number between a and b depending on t. */ static lerp(a: number, b: number, t: number): number; /** * Get the interpolated distance of p on the line from a to b. * @param {number} a The starting position. * @param {number} b The ending position. * @param {number} p A value between a and b. * @returns {number} A value between 0 and 1 representing the interpolated percentage between a and b. */ static unlerp(a: number, b: number, p: number): number; /** * Compute the number of ways to choose an unordered subset of k elements from a fixed set of n elements. n ≥ k ≥ 0. * @param {number} n Number of elements. * @param {number} k Number of subset. * @returns {number} The positive integers that occur as coefficients in the binomial theorem. */ static binomialCoefficient(n: number, k: number): number; /** * Evaluate the derivative of a function f at a point x. d/dx f(x) * @param {number} x Evaluation point. * @param {number} f Function f. * @returns {number} The result of f'(x). */ static derivative(x: number, f: (x: number) => number): number; /** * Evaluate the anti-derivative of a function f' at a point x. ∫ f'(x) dx * @param {number} x Evaluation point. * @param {number} f Function f'. * @param {number} subdivide The number of subdivision to use. The more you have, the better the approximation. * @returns {number} The result of F(x). */ static antiDerivative(x: number, f: (x: number) => number, subdivide?: number): number; /** * Evaluate the area under the curve of a function f' from a to b. ∫_a^b f'(x) dx * @param {number} a The point to start. * @param {number} b The point to end. * @param {number} f Function f'. * @param {number} subdivide The number of subdivision to use. The more you have, the better the approximation. * @returns {number} The result of F(b) - F(a). */ static integral(a: number, b: number, f: (x: number) => number, subdivide?: number): number; /** * Return an array of ordered combination without repetition of n objets (a string array) classified in k groups. * @param {T[]} objects An array of object to reorder. * @param {number} k The number of classified groups. * @returns {any[]} Return an array where each cell contain the grouping result of the object. */ static combinationArrayNRNO(objects: T[], k: number): T[][]; /*** * Generate an array of the entire set of element made out of binomial coefficient by taking the depth stack into account. */ private static combinationArrayDepthNRNO; } //# sourceMappingURL=lazyMath.d.ts.map