运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/9.3.2/math.js"></script> <body> <h1>JavaScript</h1> <p>Subtraction 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 Subtraction const matrixSub = math.subtract(mA, mB); // Result [ [0, 3], [1, 6], [2, 9] ] document.getElementById("demo").innerHTML = matrixSub; </script> </body> </html>