gitmyhub

stdlib

JavaScript ★ 5.9k updated 7h ago

✨ The fundamental numerical library for JavaScript and TypeScript. ✨

A massive standard library for JavaScript and TypeScript that brings numerical and scientific computing tools, math functions, probability distributions, and random number generators, to both browsers and Node.js.

JavaScriptTypeScriptNode.jsCnpmWebpackBrowserifysetup: easycomplexity 3/5

stdlib is a comprehensive standard library for JavaScript and TypeScript focused on numerical and scientific computing. It brings to JavaScript much of the mathematical functionality you would expect from specialized languages like Python with NumPy, R, or MATLAB, making it possible to do serious number crunching in a browser or in Node.js without switching languages.

The library covers a wide range of mathematical tools. It includes over 150 special math functions (things like gamma functions, Bessel functions, and other advanced calculations), more than 35 probability distributions with support for probability density functions, cumulative distribution functions, and quantiles, and over 40 random number generators with configurable seeds. It also includes tools for statistics, data transformation, functional programming, input validation, a plotting API for visualizing data, and over 50 sample datasets for testing and development.

A core design goal is full decomposability. Rather than one large package, the library is split into thousands of small individual packages, each available separately on npm. You install only what you need. TypeScript declaration files are provided for every function, which means your code editor can offer accurate autocomplete suggestions. Many of the core math routines also have native C add-ons for performance, with pure JavaScript fallbacks when those are not available.

The library can run in Node.js or be bundled for browser use with standard tools like Webpack or Browserify. It includes an interactive REPL environment for experimenting with functions directly, a built-in benchmarking framework, and extensive documentation.

Installation is via npm, and the project maintains an active community with public office hours, a Zulip chat, and financial support through Open Collective. The full README is longer than what was shown.

Where it fits