Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 12 years ago

jmcshan1 gravatar image

Importing file to Quadratic field

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. = 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.

click to hide/show revision 2
improved style

updated 12 years ago

fidbc gravatar image

Importing file to Quadratic field

I have a file with a list of elements inside the square of a Quadratic field, i.e. QQ(sqrt[13])^2. QQ(sqrt[13])^2. The file looks like [[2 + sqrt[13],4 - 2*sqrt[13]],[2,sqrt[13]],...]. 2*sqrt[13]],[2,sqrt[13]],...]. I want to import this file into a single matrix over the field, in the previous example F. F.<a> = QuadraticField(13). 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.

click to hide/show revision 3
clearer title

Importing Convert a text file to Quadratic fieldinto 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.

click to hide/show revision 4
retagged

updated 10 years ago

FrédéricC gravatar image

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.