Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can round floating-point matrices easily:

sage: random_matrix(RDF,4)         
[  0.249460263401   0.560301434409  -0.663582797018   0.932897872107]
[  0.334365993609  -0.868997217291  -0.546936618217  -0.636108817037]
[ -0.555384416581   0.961681767214  -0.146447558808   0.700186827417]
[-0.0701126985289   0.611616686035   0.890061111172   -0.22607396116]
sage: random_matrix(RDF,4).round(3)
[ 0.246  0.673 -0.168  0.239]
[ 0.869 -0.043  0.646  -0.36]
[ 0.467 -0.309   0.25  -0.35]
[ 0.508  0.671 -0.597 -0.583]