MathLib.js is a JavaScript library for doing mathematical computations in a browser. It is written in the JavaScript superset TypeScript and supports all modern browsers (Chrome, Firefox 10+, Safari 5+, Opera 11+, IE 9+). The library is about 371.55 KB big (155.69 KB minified). But since it is constructed in a very modular way, you are able to create your own builds consisting only of the methods you want.

MathLib.js is released under the terms of the MIT License and hosted on GitHub.


Possibilities of MathLib.js

MathLib.js can handle circles, complex numbers, integers, lines, matrices, permutations, points, polynomials, rational numbers, sets and vectors. MathLib.js is designed to handle (almost) every request which makes (mathematical) sense. It's for example possible to have complex numbers in matrices as well as putting matrices in polynomials.
2d plotting

Interactive Plots

MathLib.js is not only good in computations but also in plotting. MathLib has build in SVG and Canvas renderers for two dimensional plotting. The plots can be made interactive, so they can be zoomed and paned by the user. Three dimensional plots are supported using the excellent THREE.js WebGL framework.
Content MathML example to describe a complex number

MathML and LaTeX integration

MathLib.js can parse mathematical expressions and content MathML and can write content MathML, presentation MathML and LaTeX. It can detect MathML support and load MathJax if MathML is not supported.
Matrices can also be created using a MatLab like syntax.
QUnit logo

Excellent code quality

MathLib.js has an extensive testing suite build upon QUnit with 2500+ tests. The complete test suite is run on every commit using continuous integration with Travis CI and Open Sauce by Sauce Labs. New test are added constantly to improve the test coverage of MathLib. Furthermore MathLib.js also makes use of TypeScript's type annotations to reduce the number of possible errors.

The formal code quality is defined by a styleguide and assured by jscs and JSHint.


Current work and near future

  • Improvements for the Matrix module
  • Improvements for the Functn module
  • Integer module (done)