Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How are list of matrices printed by sage?

If I construct a list of matrices and let sage print it, the matrices are (correctly) aligned on the top:

sage: A=matrix([[1,2],[3,4]])
sage: [A,A]
[
[1 2]  [1 2]
[3 4], [3 4]
]

Howewer, this is not the result of the __repr__ function of a list: compare:

sage: print [A,A].__repr__()
[[1 2]
[3 4], [1 2]
[3 4]]

I would like to construct an object whose output is on more than one lines (like a matrix), and I would like a list of these objects to be printed aligned on the top (like with the matrices in the first example above). How can I do that?

How are list of matrices printed by sage?

If I construct a list of matrices and let sage print it, the matrices are (correctly) aligned on the top:

sage: A=matrix([[1,2],[3,4]])
sage: [A,A]
[
[1 2]  [1 2]
[3 4], [3 4]
]

Howewer, this is not the result output of the __repr__ function of a list: compare:

sage: print [A,A].__repr__()
[[1 2]
[3 4], [1 2]
[3 4]]

I would like to construct an object whose output is on more than one lines (like a matrix), and I would like a list of these objects to be printed aligned on the top (like with the matrices in the first example above). How can I do that?