1
$\begingroup$

I'm a total beginner in Mathematica and I have been struggling with defining the following symbolic matrix with entries in $\mathbb{Z}_2$ enter image description here

Here, $\mathbb{1}_{m_i}$ and $\mathbb{0}_{m_i}$ stand for the unit and zero vectors of size $m_i$ respectively.

I first defined the integers $m_i$ using the Element function. Then, I defined each block $M_{ij}$ using the Array function. After that, I defined the unit and zero vectors using the ConstantArray and Transpose functions. But as I said, the tricky part is when I want to join everything together to form the matrix $M$. Frankly, I'm not even sure of my choice of functions or my usage of them (sixteen Array usages, one subblock at a time!!! feel like there must be a shortcut I need to know about here).
can someone make my life easier by taking me for the complete beginner that I am and detailing a good method for me? Thank you in advance.

$\endgroup$
2
  • $\begingroup$ I do not know how big and complicated your definitions are. Could you as an experiment try M={{0,1,1m1t,1m2t,0m3t,0m4t}, {1,0,1m1t,0m2t,1m3t,0m4t}, {1m1,1m1,M11,M12,M13,M14},...} You write each of your 36 definitions in the right place to create your M Then you can test M to see if it works. You might be able to define some functions before you begin to initialize M and use those functions as you construct the elements of M Do you understand what I have described? In some cases Mathematica will use a vector as a column or as a row as needed if that helps. $\endgroup$
    – Bill
    Commented Apr 10 at 5:43
  • $\begingroup$ Thank you @bill. $\endgroup$ Commented Apr 10 at 17:12

1 Answer 1

0
$\begingroup$

You can create a block matrix like:

The top right block is simply:

IdentityMatrix[2]

For simplicity I assume that all dimensions are 2. However, I give the dimensions explicitely, so that you can adapt them to your needs. Then the top right block is (note that a vector and its transposed is the same in MMA)

zeros = Array[0 &, #] & /@ {2, 2, 2, 2};
ones =   Array[1 &, #] & /@ {2, 2, 2, 2}; 
block1 = {{ones[[1]], ones[[2]], zeros[[3]], zeros[[4]]}, {ones[[1]], 
   zeros[[2]], ones[[3]], zeros[[4]]}}

Then the lower left block is the transpose of block1. For the lower right block I assume that you already defined the matrices mij:

mats = Array[Subscript[m, #1, #2] &, #] & /@ {{2, 2}, {2, 2}, {2, 
     2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 
     2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}};
block2 = ArrayReshape[mats, {4, 4}]

Then for the final block matrix:

mat = {{IdentityMatrix[2], block1}, {Transpose[block1], block2}} // 
   ArrayFlatten;
mat // MatrixForm

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you @Daniel Huber. $\endgroup$ Commented Apr 10 at 17:49

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.