Question: I tried solving this question but i till can't find where I am making a mistake... need ur help pls

Q1: Write a procedure named MULTIPLYMATRIX to find the product of an n x m matrix by an
m x q matrix. Your procedure should print the result matrix. The dimensions n, m, q should be
input parameters in your procedure. Test your procedure by demonstrating multiplication of a 2 x
3 with a 3 x 4 matrix of your choice

 

and here is my soln
>with(LinearAlgebra);
>Multiplymatrix:=proc(M,N);
local r1,r2,c1,c2, MM, finalmatrix, n, m, q;
r1:=RowDimension(M);
r2:=RowDimension(N);
c1:=ColumnDimension(M);
C2:=ColumnDimesion(N);
finalmatrix:=matrix(1..r1,1..c2);
for n from 1 to r1 do;
for m from 1 to c1 do;
for q from 1 to c2 do;
MM:=0;
MM:=MM+ M[n,q]*N[q,m];
finalmatrix:=MM
end do;
end do;
end do;
end proc;


I got the proc alright but it is not working for any example.. I want to if I am right and also if u can help me out if am wrong;

Please Wait...