6
$\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$
7
  • 1
    $\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
    Commented May 13, 2016 at 5:42
  • 1
    $\begingroup$ I have under 10 reputations so I cannot post more than two image links. $\endgroup$
    – diff
    Commented May 13, 2016 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
    Commented May 13, 2016 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
    Commented May 13, 2016 at 6:16

2 Answers 2

5
$\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$
2
  • $\begingroup$ Thanks. Do you use Array to create elements of matrix? Is {2,2} a two by two matrix? $\endgroup$
    – diff
    Commented May 15, 2016 at 22:52
  • $\begingroup$ @diff yes. But of course you can also do it like {{a,b},{c,d}} $\endgroup$
    – Lukas
    Commented May 16, 2016 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$
1
  • 1
    $\begingroup$ Thanks. But $Y$ here is an array. Is this the same as list, which is a matrix? $\endgroup$
    – diff
    Commented May 15, 2016 at 22:51

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.