[Mathematica] Ordered matrix multiplication

In summary, the conversation discusses the creation of a matrix M by applying MatrixExp to each element of a list L1 and then multiplying them in reverse order. A solution is provided using the Dot function to combine the elements of L1 after applying MatrixExp to them. It is noted that for large matrices, an alternative solution may be needed to avoid storing each element in MatrixExp.
  • #1
guerom00
93
0
Hello everyone,

I have a list, let's call it L1, of length N. Each element of this list is a square matrix.
I would like to :
1/ Apply MatrixExp[] to each element of L1 (I know how to do that)
2/ Multiply each element of the subsequent list _in an ordred fashion_ i.e. from element N to element 1. In this order (!) because none of the matrices commute.

To recap, I have

L1={L1[[1]],L1[[2]],...,L1[[N]]}

and want the matrix M equal to

M=MatrixExp[L1[[N]]].MatrixExp[L1[[N-1]]]...MatrixExp[L1[[1]]]

What would be a nice "one liner" which does that ?
Thanks in advance :)
 
Physics news on Phys.org
  • #2
This isn't elegant...
First create an example list of 5 random 2x2 matrices
(working symbolically would be very slow)
In[1]:= l[i_][__]:=-Random[]
In[2]:= L[i_]:=Array[l,{2,2}]
In[3]:= LL=Array[L,5];

Now combine them together the way you wanted:
In[4]:= MatrixExp[Dot@@(MatrixExp/@Reverse[LL])]
Out[4]= {{1.12427,-0.100453},{-0.206832,1.17472}}

Note that for very many large matrices, you might want to use a different solution that does not have to store each element in MatrixExp/@Reverse[LL].
 
  • #3
Thanks for your message :)
Yeah, I ended up doing more or less what you suggested. I wrote M=L1//MatrixExp/@#&//Reverse//Dot@@#&.
That was the Dot part I wasn't sure about : I thought for some reason that Dot[] accepted only two arguments. But no... It nicely "threads" over any number of arguments :)
 

FAQ: [Mathematica] Ordered matrix multiplication

What is ordered matrix multiplication?

Ordered matrix multiplication is a mathematical operation that involves multiplying two matrices in a specific order. The columns of the first matrix are multiplied with the rows of the second matrix to produce a new matrix.

How is ordered matrix multiplication different from regular matrix multiplication?

In regular matrix multiplication, the order of multiplication does not matter. However, in ordered matrix multiplication, the order of multiplication is crucial and can result in different outcomes.

What is the significance of ordered matrix multiplication?

Ordered matrix multiplication is important in various fields such as engineering, physics, and computer science. It is used in solving systems of equations, data analysis, and image processing.

What are the steps for performing ordered matrix multiplication?

The steps for performing ordered matrix multiplication are as follows: 1) Make sure that the number of columns in the first matrix is equal to the number of rows in the second matrix. 2) Multiply the first column of the first matrix with the first row of the second matrix, and then add the products. 3) Repeat this process for each column of the first matrix and each row of the second matrix. 4) The resulting values form the elements of the new matrix.

Are there any special properties of ordered matrix multiplication?

Yes, ordered matrix multiplication is associative and distributive, but not commutative. This means that changing the order of the matrices being multiplied will not affect the outcome, but changing the order of the elements within the matrices will result in a different outcome. Also, ordered matrix multiplication follows the same rules as regular matrix multiplication, such as the distributive property and the existence of an identity matrix.

Similar threads

Replies
2
Views
3K
Replies
13
Views
3K
Replies
2
Views
1K
Replies
1
Views
1K
Replies
1
Views
2K
Replies
1
Views
1K
Replies
2
Views
2K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
8
Views
713
Back
Top