2
$\begingroup$

enter image description here How do I output the matrix form like the RHS without the tensor product sign remaining $\otimes$?

enter image description here

I need it for display purpose where I can see easily what the form of the whole product matrix is.

$\endgroup$
  • $\begingroup$ Why can't you post more than two image links? Anyway, you should post code, properly formatted in code blocks, rather than screenshots. Please edit your post and click on the grey question mark on the right-side of the toolbar for help with formatting. Finally, look up KroneckerProduct. TensorProduct is for symbolic manipulation, and you seem to want to actually make the matrices: that is implemented as KroneckerProduct in Mathematica. $\endgroup$ – march May 13 '16 at 5:42
  • 1
    $\begingroup$ I have under 10 reputations so I cannot post more than two image links. $\endgroup$ – diff May 13 '16 at 5:46
  • 1
    $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 May 13 '16 at 6:14
  • 1
  • 1
    $\begingroup$ @march Yes. I need it for display purpose where I can see easily what the form of the whole product matrix is. $\endgroup$ – diff May 13 '16 at 6:16
1
$\begingroup$

Since you say that you still do not get the output you desire using KroneckerProduct, I am guessing that you should try restarting the kernel. In any case, this should also fit your needs:

mat1 = Array[m1, {2, 2}];
mat2 = Array[m2, {2, 2}];
KroneckerProduct[mat1, mat2] // MatrixForm

enter image description here

$\endgroup$
  • $\begingroup$ Thanks. Do you use Array to create elements of matrix? Is {2,2} a two by two matrix? $\endgroup$ – diff May 15 '16 at 22:52
  • $\begingroup$ @diff yes. But of course you can also do it like {{a,b},{c,d}} $\endgroup$ – Lukas May 16 '16 at 8:08
0
$\begingroup$

Perhaps

 X = IdentityMatrix[2]
 Y = Array[y, {2, 2}]
 TensorProduct[X, Y] // MatrixForm

$\left( \begin{array}{cc} \left( \begin{array}{cc} y(1,1) & y(1,2) \\ y(2,1) & y(2,2) \\ \end{array} \right) & \left( \begin{array}{cc} 0 & 0 \\ 0 & 0 \\ \end{array} \right) \\ \left( \begin{array}{cc} 0 & 0 \\ 0 & 0 \\ \end{array} \right) & \left( \begin{array}{cc} y(1,1) & y(1,2) \\ y(2,1) & y(2,2) \\ \end{array} \right) \\ \end{array} \right)$

$\endgroup$
  • $\begingroup$ Thanks. But $Y$ here is an array. Is this the same as list, which is a matrix? $\endgroup$ – diff May 15 '16 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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