3 ms·
Mathematica (wolfram language) uses asterisk () for general multiplication (scalar x scalar or scalar x matrix). But use the dot (.) for matrix multiplication.
by elashri 3y ago
Mathematica (wolfram language) uses asterisk () for general multiplication (scalar x scalar or scalar x matrix). But use the dot (.) for matrix multiplication. So if you have defined A as constant (or scalar in general) and B is a matrix then
AB will work
A.B will give dimension error
If both A and B is matrices then
A.B will give you matrix multiplication.
A*B will give you a element wise multiplication.
This behavior is actually confusing first but if you work a lot with mathematics you will find it makes sense after sometime.