Ask Your Question

Revision history [back]

There is no direct way to do that. Nevertheless, you may use the command sage_eval to convert your string to a list of lists.

sage: my_string = '[[sqrt(2),sqrt(3)], [sqrt(5),sqrt(7)]]'
sage: matrix(sage_eval(my_string))
[sqrt(2) sqrt(3)]
[sqrt(5) sqrt(7)]