Special functions and common mathematical operations. 100% pure JavaScript.
JavaScript Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Nontrivial mathematics in the browser. 100% pure JavaScript. For modern mathematical physicists and their ilk.

All mathematical functions are exposed in the global context for ease of use. While this is contrary to most JavaScript development, it makes life much simpler for the end user. This library is not intended to be sliced and diced by Node users, so please do not complain to me about namespace pollution. The current behavior is intended: mathematics is a global phenomenon.

Complex numbers are supported as dictionaries with real and imaginary attributes. Fully complex functions include exponentials, logarithms, circular and hyperbolic functions, all implemented with built-in JavaScript functions. Also available on the entire complex plane are the gamma and beta functions, implemented with the Lanczos approximation.

Hypergeometric functions 0F1, 1F1 and 2F1 of real or complex arguments are currently supported as power series. These make available Bessel J, Y, I and K functions on the complex plane, as well as Airy Ai and Bi functions and Hankel functions. Elliptic integrals and elliptic functions of real or complex arguments are available using Carlson symmetric integrals and Jacobi theta function power series.

Integration of functions and ordinary differential equations is available for real values, as well as eigensystems of real symmetric matrices, root finding and cubic splines.

This library and MathCell power the interactive elements of Analytic Physics.


Download the complete library and include it in the body of a page:

<script src="math.js"></script>

See the documentation for details of special functions and common mathematical operations.