chika
chika

Reputation: 177

How to multiply matrices in JavaScript

How can i perform a matrix multiplication of a and b because when I do a + b, it combines the two matrices. And also how to create a matrix of n*n dimensions. Thank you as you help.

<html>
<body></body>
<script>
Var a=[1,2,3]
Var b=[4,5,6]
Var e=a + b
Var c=[]
C.push(e)
Console.log(c)
Document.write(e)
</script>
</html>

Upvotes: 0

Views: 2303

Answers (1)

derp
derp

Reputation: 2318

Expanding on @A.Rossi's answer:

  var a = math.matrix([1,2,3]);
  var b = math.matrix([4,5,6]);
  var e = math.add(a,b);
  document.write(e);

Demo here

Upvotes: 1

Related Questions