Mathematica Question (Matrix Multiplication)

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 8K views
jeffreydk
Messages
133
Reaction score
0
I am trying to compute the following,

[tex]\prod_{j=0}^{N-1}\left[\hat{I}+\hat{M(j)}\left(\frac{T}{N}\right)\right][/tex]

where [itex]\hat{I}, \hat{M(j)}[/itex] are matrices. My problem is that Mathematica interprets this product as element-wise with respect to the matrices, but I of course want it to use matrix multiplication. Is there any simple way to do this or do I need to write a code using some kind of do-loop?

Thanks for any help, I appreciate it.
 
Physics news on Phys.org
Use a . to multiply matrices: A.B
 
I figured it out now using a Do[] command, but my point was that if you want to multiply many matrices and not write out the long stretch of A1.A2.A3.A4...AN, then you cannot use the product command on Mathematica because that will just multiply the matrices element-wise. I wanted to know if there was any way of using the product command for a dot product.
 
The command MatrixPower[m,n] is what you're looking for!
 
Ahh, thank you very much.