matrix algebra problem

how to solve matrix algebra problem Z=A^(-1)*(B*B) + 3*(A*A)*B^(-1).
i especially do not know how to write code fragment if a number is being multiply by a matrix.this is problem of putting the pieces together.for example is it we define M=3 and then write g.MatMultiply(Q,M,R)
I don't really understand your problem. You could do g.MatMultiply(Q,M,R) (btw, what is 'g' supposed to be?). It would probably be more comfortable to do R = MatMultiply(Q, M). Though the most comfortable thing would be to overload * and + operators (I don't think it's logical to overload ^, since ^(-1) is sort of a special case). Then your could could simply be Z=inverse(A)*(B*B) + 3*(A*A)*Inverse(B);
Topic archived. No new replies allowed.