Group Abstract Group Abstract

Message Boards Message Boards

Displaying the lines in a block matrix

GROUPS:
How can we make block matrices that show the lines between some specified rows and columns such that also allow you to do computations with them. When using the Insert menu to insert a matrix, you can draw lines between rows and columns, but you have to do all or nothing. The FullForm of a matrix made from the Insert menu and selecting to add the lines is just a list of lists, so this does not help. I know that ArrayFlatten is useful for creating block matrices, but they do not display the lines as the Insert menu. I know how to add dividers using Grid, but the results don't seem to work in further computations. Does anybody have any suggestions?
POSTED BY: Benjamin Allgeier
Answer
1 year ago
From the FullForm you have seen that your expression is essentially Grid@List@List.
To work with the values you need to remove the Grid, probably best by using the Part function.

E.g. to compute the determinant of a random 4x4 matrix placed in a grid with some divider lines:
matrixInGrid = Grid[RandomReal[1, {4, 4}],
   Dividers -> {{False, True, {False}}, {True, True, {False}}}];
matrix = matrixInGrid[[1]];
Det@matrix

Hope this helps.
POSTED BY: Peter Fleck
Answer
1 year ago
Thanks,

that does help.

If I use the Insert menu to create a matrix with dividers, the fullform that is returned is not in a grid form. It is just List[List...]. So I am confused what is really going on there since there is no code mentioned for placing the lines. My preference is something that works like the Insert menu does with the except that I want to be able to be able to draw lines between only specified rows and columns as oppose to all of them or none of them. The main two reasons for this preference are that you don't have to use the part function to do any further computations with the matrices produced with Insert menu and also they have ( ) around them which look like the output of a typical matrixform expression.

Actually, I just realized that although the matrices created from the Insert menu allow for direct computation, the resulting matrices are displayed without any lines between rows and columns. So it would be nice to be able to see the "appropriate" lines in the result of multiplying two block matrices. I want to be able to do this to demonstrate to students multiplication of block (or partitioned) matrices.
POSTED BY: Updating Name
Answer
1 year ago