Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Do you need a plain string or latex representation?

sage: B = random_matrix(ZZ, 3, 3, algorithm='echelonizable', rank=3, upper_bound=10)
sage: print B
sage: S = "matrix(QQ,%s)"%B.rows(); S; B = eval(S); B; latex(B) 

[ 1  3 -9]
[-1 -2  6]
[ 0 -1  4]
'matrix(QQ,[(1, 3, -9), (-1, -2, 6), (0, -1, 4)])'
[ 1  3 -9]
[-1 -2  6]
[ 0 -1  4]
\left(\begin{array}{rrr}
1 & 3 & -9 \\
-1 & -2 & 6 \\
0 & -1 & 4
\end{array}\right)