JSPM

  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q64343F
  • License MIT

Mathematics is the classification and study of all possible patterns.

Package Exports

  • extra-math.web

Readme

This package includes some common statistics functions.
๐Ÿ“ฆ Node.js, ๐ŸŒ Web, ๐Ÿ“œ Files, ๐Ÿ“ฐ JSDoc, ๐Ÿ“˜ Wiki.

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

This package is available in both Node.js and Web formats. The web format is exposed as extra_math standalone variable and can be loaded from jsDelivr CDN.

Stability: Experimental.


const math = require('extra-math');
// import * as math from "extra-math";
// import * as math from "https://unpkg.com/extra-math/index.mjs"; (deno)

math.sum(1, 2, 3, 4);
// 10

math.median(1, 7, 8);
// 7

math.variance(1, 2, 3, 4);
// 1.25

math.lcm(2, 3, 4);
// 12


Index

Property Description
rem Find the remainder of x/y with sign of x (truncated division).
mod Find the remainder of x/y with sign of y (floored division).
modp Find the remainder of x/y with +ve sign (euclidean division).
gcd Find the greatest common divisor of numbers.
lcm Find the least common multiple of numbers.
factorial Find the factorial of a number.
binomial Find the number of ways to choose k elements from a set of n elements.
multinomial Find the number of ways to put n objects in m bins (n=sum(kแตข)).
constrain Constrain a number within a minimum and a maximum value.
root Find the nth root of a number (โฟโˆš).
log Find the logarithm of a number with a given base.
norm Normalize a number from its current range into a value between 0 and 1.
map Re-map a number from one range to another.
lerp Linearly interpolate a number between two numbers.
gamma Compute the gamma function of a number (ฮ“).
lgamma Compute the natural logarithm of the absolute value of the gamma function of a number (log-ฮ“).
erf Find error function value of number (approximation).
erfc Find the complementary error function value of number (approximation).
degrees Convert radians to degrees.
radians Convert degrees to radians.
mag Calculate the magnitude (length) of a vector.
dist Calculate the distance between two points.
sum Find the sum of numbers (ฮฃ).
product Find the product of numbers (โˆ).
mean Find the average of numbers.
median Find the value separating the higher and lower halves of numbers.
modes Find the values that appear most often.
range Find the difference between the largest and smallest values.
variance Find the mean of squared deviation of numbers from its mean.


References