Ask Your Question

Revision history [back]

How well print a list of matrices ?

In a program, I use the function "print" for printing lists of matrices.
Unfortunately, the display is not as well as it could, see the following example :

sage: MM=[identity_matrix(QQ,3) for i in range(3)]
sage: MM
[
[1 0 0]  [1 0 0]  [1 0 0]
[0 1 0]  [0 1 0]  [0 1 0]
[0 0 1], [0 0 1], [0 0 1]
]
sage: print(MM)
[[1 0 0]
[0 1 0]
[0 0 1], [1 0 0]
[0 1 0]
[0 0 1], [1 0 0]
[0 1 0]
[0 0 1]]

Is there a way to print a list of matrices as the first above ?

(Perhaps by saving it on an external file, what would be the line code for that ?)

click to hide/show revision 2
I add the tag matrix.

How well print a list of matrices ?

In a program, I use the function "print" for printing lists of matrices.
Unfortunately, the display is not as well as it could, see the following example :

sage: MM=[identity_matrix(QQ,3) for i in range(3)]
sage: MM
[
[1 0 0]  [1 0 0]  [1 0 0]
[0 1 0]  [0 1 0]  [0 1 0]
[0 0 1], [0 0 1], [0 0 1]
]
sage: print(MM)
[[1 0 0]
[0 1 0]
[0 0 1], [1 0 0]
[0 1 0]
[0 0 1], [1 0 0]
[0 1 0]
[0 0 1]]

Is there a way to print a list of matrices as the first above ?

(Perhaps by saving it on an external file, what would be the line code for that ?)

How well print a list of matrices ?

In a program, I use the function "print" for printing lists of matrices.
Unfortunately, the display displaying is not as well as it could, see the following example :

sage: MM=[identity_matrix(QQ,3) for i in range(3)]
sage: MM
[
[1 0 0]  [1 0 0]  [1 0 0]
[0 1 0]  [0 1 0]  [0 1 0]
[0 0 1], [0 0 1], [0 0 1]
]
sage: print(MM)
[[1 0 0]
[0 1 0]
[0 0 1], [1 0 0]
[0 1 0]
[0 0 1], [1 0 0]
[0 1 0]
[0 0 1]]

Is there a way to print a list of matrices as the first above ?

(Perhaps by saving it on an external file, what would be the line code for that ?)