/numero

A friendly and intuitive math library for p5.js

Primary LanguageJavaScriptMIT LicenseMIT

número

número

A friendly and intuitive math library for p5.js

All Contributors

Build Status

This project aims to bring the mathematical chops of NumPy to the p5.js ecosystem. A few guiding principles are:

  • Focus on beginners.
  • Complement core p5.js math functions and play nicely with p5.Vector.
  • Make the API familiar (e.g., createTensor()).
  • Let ml5.js handle machine learning.
  • Encourage all kinds of contributions.

The library is written in TypeScript and uses TensorFlow.js as its linear algebra engine.

Why though?

Excellent libraries like math.js and p5.dimensions already exist. The idea is to study the masters while creating something new: a production grade library for numeric computation that beginners can grow into over time.

Also, math + code = awesome :)

Usage

// A little matrix-vector multiplication
const b = num.tidy(() => {
    const a = createTensor([[1, 2], [3, 4]]);
    const x = createTensor([5, 6]);
    return a.dot(x);
});

print(b.toString());

Demo

The fluid simulation below was created using a 2-dimensional lattice Boltzmann method.

A fluid simulation

Contributing

See CONTRIBUTING.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Ashneel Das
Ashneel Das

💻 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!