Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I recover the command to generate an object already created randomly?

I'm working in Sage side by side with a linear algebra test I'm writing in LaTeX (using sagetex). I'm generating random matrices until I find one I really like. Say I get this in Sage:

B = random_matrix(ZZ, 3, 3, algorithm='echelonizable', rank=3, upper_bound=10); B 
[ 1 -2  1]
[ 0  1 -2]
[-1 -2  8]

Is there a way to get Sage to generate the command to generate this matrix nonrandomly, i.e, return the command

B = matrix(QQ, [[1, -2 ,1], [0, 1, -2], [-1, -2, 8]])

so that I can copy and paste it into a sagesilent environment in my .tex file?

I can't think of what I might search for in the Sage documentation for such a command so I must ask here. Many thanks.