Ask Your Question

jmcshan1's profile - activity

2016-09-05 00:22:38 -0500 received badge  Notable Question (source)
2016-05-23 13:42:23 -0500 received badge  Popular Question (source)
2013-04-04 05:42:36 -0500 commented answer Convert a text file into a matrix

Nevermind, I got it: sage_eval(my_string, locals={'x':x})

2013-04-04 05:33:10 -0500 commented answer Convert a text file into a matrix

This does not seem to work with variable names, such as sage: my_string = '[[x, 3 - x],[x, 3+x]]' Is there a way to make sage_eval work with these variables?

2013-04-04 04:32:52 -0500 received badge  Supporter (source)
2013-04-02 06:00:00 -0500 received badge  Student (source)
2013-04-02 05:42:35 -0500 asked a question Convert a text file into a matrix

I have a file with a list of elements inside the square of a Quadratic field, i.e. QQ(sqrt[13])^2. The file looks like [[2 + sqrt[13],4 - 2*sqrt[13]],[2,sqrt[13]],...]. I want to import this file into a single matrix over the field, in the previous example F.<a> = QuadraticField(13). Currently, I read everything in as a string then convert to the matrix, but there must be an easier way to do this. I am somewhat new to python programming in general.