UNPKG

extra-math

Version:

**Mathematics** is the classification and study of all possible patterns [(1)].

29 lines (28 loc) • 1.45 kB
export { floor, ceil, round, floorDiv, ceilDiv, roundDiv, rem, mod, modp, constrain, constrain as clamp, normalize, normalize as norm, lerp, remap, remap as map, isPow, prevPow, nextPow, root, log, properDivisors, properDivisors as aliquotParts, aliquotSum, minPrimeFactor, minPrimeFactor as leastPrimeFactor, maxPrimeFactor, maxPrimeFactor as greatestPrimeFactor, primeFactors, primeExponentials, isPrime, gcd, gcd as hcf, lcm, factorial, binomial, multinomial, degrees, radians, sum, product, median, modes, range, variance, arithmeticMean, arithmeticMean as mean, geometricMean, harmonicMean, quadriaticMean, quadriaticMean as rootMeanSquare, cubicMean } from "@nodef/extra-number"; /** * Calculate the magnitude (length) of a vector. * @param xs vector ([x, y, z, ...]) * @returns √(x² + y² + z²) * @example * ```javascript * xmath.magnitude([5, 9]); * // → 10.295630140987 * * xmath.magnitude([10, 2, -1]); * // → 10.246950765959598 * ``` */ export declare function magnitude(xs: number[]): number; /** * Calculate the distance between two points. * @param xs first point ([x, y, z, ...]) * @param ys second point ([x, y, z, ...]) * @returns √(Δx² + Δy² + Δz²) * @example * ```javascript * xmath.distance([2, -6], [7, 3]); * // → 10.295630140987 * * xmath.distance([7, 4, 3], [17, 6, 2]); * // → 10.246950765959598 * ``` */ export declare function distance(xs: number[], ys: number[]): number;