2
$\begingroup$

How can I construct an infinite matrix with finite sub-matrices of the form

A = (B0,  0, B1
      0, B2,  0
      0,  0, B3)

where each Bi is a rectangular or a square matrix?

$\endgroup$
4

1 Answer 1

2
$\begingroup$

Mathematica is very flexible when it comes to constructing matrices.

This below shows how to create as many tiling of matrices as you want. The tools to use are Band and SparseArray and ConstantArray

Starting with the 4 basic matrices b0,b1,b2,b3. To make the display small, small sizes will be used.

b0 = N@{{1, 2}, {3, 4}};
b1 = N@{{5, 6}, {7, 8}};
b2 = N@{{9, 10}, {11, 12}};
b3 = N@{{13, 14}, {15, 16}};

Mathematica graphics

Now the first iteration is build

s = SparseArray[{Band[{1, 1}] -> ConstantArray[b0, 1], 
    Band[{3, 3}] -> ConstantArray[b2, 1], 
    Band[{5, 5}] -> ConstantArray[b3, 1], 
    Band[{1, 5}] -> ConstantArray[b1, 1]}];
MatrixForm[s]

Mathematica graphics

Now using the above, it is in turn is used to build another iteration. Here it is used on the diagonal only, but using Band you can put it in any other location

s2 = SparseArray[Band[{1, 1}] -> ConstantArray[s, 3]];
MatrixForm[s2]

Mathematica graphics

The processes can continue as much as you need

$\endgroup$
2
  • 1
    $\begingroup$ you could also use ArrayFlatten like in ArrayFlatten[{{b0, 0, b1} , {0, b2, 0}, {0, 0, b3}}] // MatrixForm $\endgroup$
    – user21
    Jul 31, 2013 at 7:53
  • $\begingroup$ ...and following up on user21's suggestion, use KroneckerProduct[] to construct the larger matrix: KroneckerProduct[IdentityMatrix[3], ArrayFlatten[{{b0, 0, b1}, {0, b2, 0}, {0, 0, b3}}]] $\endgroup$ Jul 30, 2017 at 14:57

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.