mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
359 B
359 B
Complex
Math.js supports complex numbers. Most functions can be executed with complex numbers as arguments.
var a = math.complex(2, 3); // 2 + 3i
a.re; // 2
a.im; // 3
var b = math.complex('4 - 2i'); // 4 - 2i
math.add(a, b); // 6 + i
math.sqrt(-4); // 2i