Import math.js in node.js repl

Is there a way to import math.js, available at or local, to a node.js repl? If so, how do I do that?

Hey @nikodemus, welcome to the community!

You can do this, just follow these steps :

  1. Install math.js via npm :
    npm install mathjs
  2. The require it :
    const math = require('mathjs');
  3. And here is an example code I found :
    const matrix = math.matrix([[1, 2], [3, 4]]);
    const transpose = math.transpose(matrix);

Hope this works!


Works perfect, thanks!

1 Like

No problem, great to hear!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.