Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/9.3.2/math.js"></script>
<body>
<h2>JavaScript</h2>
<p>Multiply matrices with math.js</p>
<div id="demo"></div>
<script>
const mA = math.matrix([[1, 2], [3, 4], [5, 6]]);
// Matrix Scalar Multiplication
const matrixMult = math.multiply(2, mA);
// Result [ [2, 4], [6, 8], [10, 12] ]
document.getElementById("demo").innerHTML = matrixMult;
</script>
</body>
<!-- Mirrored from www.w3schools.com/ai/tryit.asp?filename=tryai_matrix_mult_scalar by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 16:51:32 GMT -->
</html>