2
$\begingroup$

I want to calculate an expression like $\left( M_1\otimes I+I\otimes M_2 \right) ^l$ with $M_i$'s symbolic matrices and $I$ the identity matrix with Mathematica. $M_i$'s are of the same dimension and my problem is how can I realize such an identity matrix without specifying the dimension of it, it should just work like a matrix multiply any matrix will still be the matrix itself(although it should be the same dimension as all the $M_i$)? Or is there some method that I can specify the dimension of the symbolic matrix $M_i$?

Thanks in advance!

$\endgroup$
3
  • 3
    $\begingroup$ After seeing the final edit, you can do something like this I guess. I forgot the exponent, but you get the general idea I think $\endgroup$
    – bmf
    Feb 6, 2023 at 0:59
  • $\begingroup$ @bmf Thanks very much. I mean, is there some method that I can do not see the component of the matrix? For example, for $\left( M_1\otimes I+I\otimes M_2 \right) ^2$, the result I hope to see is $M_{1}^{2}\otimes I+I\otimes M_{2}^{2}+2M_1\otimes M_2$. $\endgroup$
    – narip
    Feb 6, 2023 at 1:11
  • 1
    $\begingroup$ I guess you could try some global assumptions on the matrices and then do MatrixPower and TensorExpand or their cousins, but I have not managed to make it work. $\endgroup$
    – bmf
    Feb 6, 2023 at 2:48

2 Answers 2

2
$\begingroup$

I think you can use KroneckerProduct and TensorExpand. Define:

e = KroneckerProduct[M1, IdentityMatrix[d]] + KroneckerProduct[IdentityMatrix[d], M2];

Then:

TensorExpand[e . e, Assumptions -> (M1|M2) ∈ Matrices[{d, d}]]

2 KroneckerProduct[M1, M2] + KroneckerProduct[IdentityMatrix[d], MatrixPower[M2, 2]] + KroneckerProduct[MatrixPower[M1, 2], IdentityMatrix[d]]

$\endgroup$
3
  • $\begingroup$ What about MatrixPower[e,l]? $\endgroup$
    – narip
    Feb 7, 2023 at 0:22
  • $\begingroup$ @narip Can you be more specific about your question? Is it that you want to see M1 . M1 instead of MatrixPower[M1, 2]? $\endgroup$
    – Carl Woll
    Feb 7, 2023 at 0:30
  • $\begingroup$ Oh, thanks. I mean, if I want to see e.e.e or more e.e.e.e, how can I do this? I try MatrixPower[e,3], but the result of Mathematica also contains MatrixPower[e,3]. $\endgroup$
    – narip
    Feb 7, 2023 at 1:19
1
$\begingroup$

Note that the symbol "[CircleTimes]" has not predefined meaning.Therefore, the terms are algebraically simply treated as one object. Further, "I" has built in meaning of Sqrt[-1], do not use it for a variable name. Therefore, by writing e.g.:

(M1⊗II + II⊗M2)^2 // Expand

you get:

enter image description here

However, to get your expected result, you assume some properties that you did not declare.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.