Math.js: Versatile Math Library For JavaScript

Math.js is an open source Math library for JavaScript and Node.js for working with numbers, big numbers, complex numbers, units and matrices. It also features a flexible expression parser. InfoQ got in touch with the project founder, Jos De Jong, to know more.

Jos explains the motivation behind the project –

For JavaScript there are nice libraries out there to work with matrices, complex numbers, statistics, etc. What is lacking though is an integrated solution to do advanced mathematics. Most of the existing libraries come with a chained API, which works very intuitive, but only accepts data types known by the library itself. Hence the integration issue: matrix libraries can't handle complex numbers, and vice versa. You can't combine them. The API of math.js is the same as that of JavaScript's Math object and built in operators: static functions accepting various types of input. Math.js extends this API with support for advanced data types, functions, and constants.

I hope math.js will help making maths in application development trivial and more fun, and helps bridging the gap between the the world of developers and the academic world.

Jos is hoping to reach the first stable version 1.0 within a couple of months.

What's left before 1.0 is writing a reference documentation, reaching 100% code coverage with the unit tests and resolving some rough edges here and there.

1.0 will also see the API getting stabilized, after which the focus might shift to optimization. Jos identifies several possibilities such as using typed arrays, parallelization, asm.js for potential performance improvements.

On why Jos chose JavaScript instead of something like Python which already has libraries such as NumPi/SciPi -

Latest years we have seen an enormous push towards the cloud and web applications, and I'm fully into this myself too. Browsers and JavaScript engines are becoming faster and faster. Since a couple of years you can run JavaScript server side using node.js. This opens up a lot of new possibilities, which has resulted in an explosion of the JavaScript ecosystem and its popularity. It looks like JavaScript is becoming the most ubiquitous language ever. JavaScript is far from the perfect language, but I like JavaScript and its community a lot.

There are already several end-user projects using math.js. Jos’s own project, mathnotepad is powered by math.js and in early stages of development. Math.js is also used by numerics, a popular calculator project.

Is your profile up-to-date? Please take a moment to review and update.

Email Address

Note: If updating/changing your email, a validation request will be sent

Company name:

Keep current company name

Update Company name to:

Company role:

Keep current company role

Update company role to:

Company size:

Keep current company Size

Update company size to:

Country/Zone:

Keep current country/zone

Update country/zone to:

State/Province/Region:

Keep current state/province/region

Update state/province/region to:

Subscribe to our newsletter?

Subscribe to our industry email notices?

You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.