Ask Your Question

Revision history [back]

Here's one idea: pass the matrix to a low-precision ring before printing it -- this won't change the original matrix, just the printed version:

sage: CC10 = ComplexField(prec=10)
sage: MatPrint = MatrixSpace(CC10,3,3)
sage: M = Matrix(CC,3,3,[sqrt(-n) for n in range(9)])
sage: M.parent()
Full MatrixSpace of 3 by 3 dense matrices over Complex Field with 53 bits of precision
sage: M
[                                        0                        1.00000000000000*I 8.65956056235493e-17 + 1.41421356237309*I]
[1.06057523872491e-16 + 1.73205080756888*I                        2.00000000000000*I 1.36919674566051e-16 + 2.23606797749979*I]
[1.49987988652185e-16 + 2.44948974278318*I 1.62005543721758e-16 + 2.64575131106459*I 1.73191211247099e-16 + 2.82842712474619*I]
sage: MatPrint(M)
[              0           1.0*I 8.7e-17 + 1.4*I]
[1.1e-16 + 1.7*I           2.0*I 1.4e-16 + 2.2*I]
[1.5e-16 + 2.4*I 1.6e-16 + 2.6*I 1.7e-16 + 2.8*I]
sage: MatPrint(M).parent()
Full MatrixSpace of 3 by 3 dense matrices over Complex Field with 10 bits of precision
sage: M.parent()
Full MatrixSpace of 3 by 3 dense matrices over Complex Field with 53 bits of precision

There is also a Trac ticket for this, with a patch, but work on it seems to have stalled . . . if you decide you need to use it, you can check the developer guide for how to apply patches to Sage.