Install #
Math.js can be installed via npm:
npm install mathjs
When installed globally with npm (using the -g option), math.js is available as a command line application mathjs, see documentation on Command Line Interface. Math.js ships with built-in TypeScript type definitions.
Download #
Math.js can be downloaded or linked from various content delivery networks:
| CDN | Url |
|---|---|
| unpkg | https://unpkg.com/mathjs@15.1.0/ |
| cdnjs | https://cdnjs.com/libraries/mathjs |
| jsDelivr | https://www.jsdelivr.com/package/npm/mathjs |
| PageCDN | https://pagecdn.com/lib/mathjs |
Or download the full bundle directly from unpkg:
math.js (version 15.1.0, 172 kB, minified and gzipped) and if needed the source map
Too large for you? Create your own custom bundle.
Web Service #
Math.js is available as a RESTful web service: https://api.mathjs.org
Extensions #
Here some notable extensions for mathjs:
| Extension | Description |
|---|---|
| mathsteps | A step-by-step math solver library that is focused on pedagogy (how best to teach). The math problems it focuses on are pre-algebra and algebra problems involving simplifying expressions. |
| mathjs‑expression‑parser | This custom build of mathjs contains just the expression parser and basic arithmetic functions for numbers. About four times as small as the full mathjs library. |
| mathjs-simple-integral | Extends Math.js to be able to compute simple integrals. |
| math.diff.js | Symbolic differentiation plugin for Math.js |
| postcss-math | PostCSS plugin for making calculations with math.js |
Other math libraries #
Here some other interesting JavaScript math libraries. Some can be imported into math.js using math.import.
| Extension | Description |
|---|---|
| math‑expression‑evaluator | An extremely efficient, flexible and amazing evaluator for Math expression in Javascript. |
| numbers.js | Advanced Mathematics Library for Node.js and JavaScript |
| numeric.js | Numerical analysis in Javascript |
| decimal.js | An arbitrary-precision Decimal type for JavaScript. Used by mathjs for BigNumber support. |
| ndarray | Multidimensional arrays for JavaScript |
| Algebrite | Computer Algebra System in Javascript (Coffeescript) |
| algebra.js | Build, display, and solve algebraic equations |
| Nerdamer | Symbolic Math for Javascript |
| numeral-js | A javascript library for formatting and manipulating numbers |
| Cortex Compute Engine | The Cortex Compute Engine can parse LaTeX to MathJSON, serialize MathJSON to LaTeX, format, simplify and evaluate MathJSON expressions |
History #
A changelog describing the changes with each release is available on the page History.
Browser support #
Math.js works on any ES5 compatible JavaScript engine: node.js, Chrome, Firefox, Safari, Edge, and IE11.
Though there is no official support for older browsers, math.js should still work on older browsers when using the es5-shim.
Source code #
The source code of math.js is available on GitHub: https://github.com/josdejong/mathjs.
License #
Math.js is open source and licensed under the Apache 2.0 License