1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Question (Matrix Multiplication)

  1. Jul 8, 2009 #1
    I am trying to compute the following,


    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.
  2. jcsd
  3. Jul 8, 2009 #2
    Use a . to multiply matrices: A.B
  4. Jul 8, 2009 #3
    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.
  5. Jul 8, 2009 #4
    The command MatrixPower[m,n] is what you're looking for!
  6. Jul 9, 2009 #5
    Ahh, thank you very much.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook