Ask Your Question

Li Yutong's profile - activity

2017-12-09 12:12:13 -0500 received badge  Student (source)
2017-12-09 11:59:40 -0500 received badge  Notable Question (source)
2016-11-27 00:08:38 -0500 received badge  Popular Question (source)
2013-11-03 06:59:04 -0500 commented answer How to input data in SAGE and deal with them

@ndomes, Thank you very very much!!! You answer is fabulous, I know how to do it now!!!

2013-11-03 05:24:30 -0500 marked best answer How to input data in SAGE and deal with them

Copy and paste the data from "K3/3d" to a text file. Upload that file to your worksheet (I use Sage Notebook). (I name the file 'k3_d3_data.txt')

Open the file in your worksheet. Now you can iterate through the lines and convert the appropriate lines to matrices.

data_file = file(DATA+'k3_d3_data.txt','r')   
matrix_list = []    
while True:
    try: 
        data_file.next()
    except StopIteration:
        break
    row1 = [int(z) for z in data_file.next().split()]
    row2 = [int(z) for z in data_file.next().split()]
    row3 = [int(z) for z in data_file.next().split()]
    matrix_list.append(matrix(ZZ,[row1,row2,row3]))  

for M in matrix_list:
    print M
2013-11-03 05:24:30 -0500 received badge  Scholar (source)
2013-11-03 05:24:22 -0500 received badge  Supporter (source)
2013-11-02 15:25:05 -0500 received badge  Editor (source)
2013-11-02 15:20:45 -0500 asked a question How to input data in SAGE and deal with them

I wish to calculate the width of the certain polytopes, the data for these polytopes can be found here (please click "K3/3d" on the left, and then click "list of all 4319" on the top of new page, for some reason, I could not cite the exact URL).

For example, the first one is

3 4 M:5 4 N:35 4 Pic:19 Cor:0

1    0    0   -1
0    1    0   -1
0    0    1   -1

However, only the number in the matrix will be used in the calculation. My questions are:

(1) How to input these data in SAGE (I use a windows system, and run Virtualbox for SAGE)?

(2) How to use sage to deal with each matrix?

For each of matrix, I have a program as the follows

sage: m = matrix(ZZ, [[1,0,0,-1],
....:        [0,1,0,-1],
....:        [0,0,1,-1]])
sage: p = LatticePolytope(m)
sage: d = p.distances()
sage: l = p.nfacets()
sage: for i in range(l):
....:     max(d.row(i))

After input the data, how to let sage use the same program deal with each matrix?

Thank you very much for your help!!!