<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/9.3.2/math.js"></script>
<body>
<h1>JavaScript</h1>
<p>Adding matrices with math.js</p>
<div id="demo"></div>
<script>
const mA = math.matrix([[1, 2], [3, 4], [5, 6]]);
const mB = math.matrix([[1,-1], [2,-2], [3,-3]]);
// Matrix Addition
const matrixAdd = math.add(mA, mB);
// Result [ [2, 1], [5, 2], [8, 3] ]
document.getElementById("demo").innerHTML = matrixAdd;
</script>
</body>
</html>