| 1 | initial version |
You can try the sage_input function:
sage: m = matrix(QQ, [[1,2,3], [4,5,6], [7,8,9]])
sage: m
[1 2 3]
[4 5 6]
[7 8 9]
sage: sage_input(m)
matrix(QQ, [[1, 2, 3], [4, 5, 6], [7, 8, 9]])
Save the last line to a file instead of just
[1 2 3]
[4 5 6]
[7 8 9]
The sage_input function is documented here
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.