Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Numbers - an advanced mathematics toolkit for JavaScript and Node.js developed by Steve Kaliski, @sjkaliski
Numbers provides a comprehensive set of mathematical tools that currently are not offered in JavaScript. These tools include:
A few things to note before using: JavaScript, like many languages, does not necessarily manage floating points as well as we'd all like it to. For example, if adding decimals, the addition tool won't return the exact value. This is an unfortunate error. Precautions have been made to account for this. After including numbers, you can set an error bound. Anything in this will be considered an "acceptable outcome."
The primary uses cases are client side operations which the DOM will recognize (e.g. 1.1px == 1px). It can be used for data analysis, calculations, etc. on the server as well.
Numeric.ly is pretty straightforward to use.
For example, if we wanted to estimate the integral of sin(x) from -2 to 4, we could:
Use riemann integrals (with 200 subdivisions)
var numbers = require('numbers');
var func = function(x) {
return Math.sin(x);
}
numbers.calculus.riemann(func, -2, 4, 200);
Or adaptive simpson quadrature (with epsilon .0001)
numbers.calculus.adaptiveSimpson(func, -2, 4, .0001);
Say we wanted to run some matrix calculations:
We can add two matrices
var array1 = [0, 1, 2];
var array2 = [3, 4, 5];
numbers.matrix.addition(array1, array2);
We can transpose a matrix
numbers.matrix.transpose(array);
Numeric.ly also includes some basic prime number analysis. We can check if a number is prime:
//basic check
numbers.prime.simple(number);
//elliptic analysis (good for huge numbers)
numbers.prime.elliptic(number);
The statistics tools include mean, median, mode, standard deviation, random sample generator, correlation, confidence intervals, t-test, chi-square, and more.
numbers.statistic.mean(array);
numbers.statistic.median(array);
numbers.statistic.mode(array);
numbers.statistic.standardDev(array);
numbers.statistic.randomSample(lower, upper, n);
numbers.statistic.correlation(array1, array2);
For further documentation, check out our JSDoc
To execute, run:
npm test
FAQs
Advanced Mathematics Library for JavaScript
The npm package numbers receives a total of 2,112 weekly downloads. As such, numbers popularity was classified as popular.
We found that numbers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.