1 | initial version |
Since you want to discard the first entry of L
, you can make the slice :
sage: L[1:]
[['1.46', '0.738', '0.532', '0.72', '19.9959'],
['0.64', '0.664', '0.03', '0.236', '6.0996 '],
['3.29', '1.15', '0.134', '1.54', '24.9655'],
['3.94', '1.33', '0.466', '1.94', '37.4436'],
['3.18', '2.14', '0.243', '1.47', '30.183 '],
['2.43', '1.3', '0.137', '1.31', '20.8036'],
['3.94', '3.49', '0.208', '0.876', '41.3818'],
['3.38', '1.04', '0.477', '2.46', '29.478 '],
['2.21', '0.966', '0.457', '1.14', '24.2387'],
['2.49', '1.59', '0.298', '1.18', '26.3198'],
['0.86', '0.395', '0.02', '0.406', '8.591'],
['3.38', '1.85', '0.539', '1.5', '36.4229'],
['7.39', '4.42', '0.707', '3.55', '66.4108'],
['2.49', '1.59', '0.298', '1.18', '26.3198'],
['0.86', '0.395', '0.02', '0.406', '8.591'],
['3.38', '1.85', '0.539', '1.5', '36.4229'],
['7.39', '4.42', '0.707', '3.55', '66.4108']]
Now, you can turn this list into a matrix over the RealDoubleField
(RDF
) as follows:
sage: M = matrix(RDF,L[1:])
sage: M
[ 1.46 0.738 0.532 0.72 19.9959]
[ 0.64 0.664 0.03 0.236 6.0996]
[ 3.29 1.15 0.134 1.54 24.9655]
[ 3.94 1.33 0.466 1.94 37.4436]
[ 3.18 2.14 0.243 1.47 30.183]
[ 2.43 1.3 0.137 1.31 20.8036]
[ 3.94 3.49 0.208 0.876 41.3818]
[ 3.38 1.04 0.477 2.46 29.478]
[ 2.21 0.966 0.457 1.14 24.2387]
[ 2.49 1.59 0.298 1.18 26.3198]
[ 0.86 0.395 0.02 0.406 8.591]
[ 3.38 1.85 0.539 1.5 36.4229]
[ 7.39 4.42 0.707 3.55 66.4108]
[ 2.49 1.59 0.298 1.18 26.3198]
[ 0.86 0.395 0.02 0.406 8.591]
[ 3.38 1.85 0.539 1.5 36.4229]
[ 7.39 4.42 0.707 3.55 66.4108]
sage: M.parent()
Full MatrixSpace of 17 by 5 dense matrices over Real Double Field
Sage automatically transforms the strings into elements of RDF
.