Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To answer John, you can use span_of_basis to preserve the basis:

sage: aa = [0,-1,1/5,-1/19,1/15,-35/57,7/5]
sage: bb = [1,0,-6/5,20/19,-7/5,56/19,-12/5]
sage: cc = [3, -3, -3, 3, -4, 7, -3]
sage: M7=(ZZ^7).span_of_basis([vector(aa),vector(bb)])
sage: M7
Free module of degree 7 and rank 2 over Integer Ring
User basis matrix:
[     0     -1    1/5  -1/19   1/15 -35/57    7/5]
[     1      0   -6/5  20/19   -7/5  56/19  -12/5]
sage: cc in M7
False
sage: M7.coordinates(cc)
[3, 3]

To answer John, you can use span_of_basis to preserve the basis:

sage: aa = [0,-1,1/5,-1/19,1/15,-35/57,7/5]
sage: bb = [1,0,-6/5,20/19,-7/5,56/19,-12/5]
sage: cc = [3, -3, -3, 3, -4, 7, -3]
sage: M7=(ZZ^7).span_of_basis([vector(aa),vector(bb)])
sage: M7
Free module of degree 7 and rank 2 over Integer Ring
User basis matrix:
[     0     -1    1/5  -1/19   1/15 -35/57    7/5]
[     1      0   -6/5  20/19   -7/5  56/19  -12/5]
sage: cc in M7
False
sage: M7.coordinates(cc)
[3, 3]

Huh, I just noticed that cc in M7 returns the wrong value!

To answer John, you can use span_of_basis to preserve the basis:

sage: aa = [0,-1,1/5,-1/19,1/15,-35/57,7/5]
sage: bb = [1,0,-6/5,20/19,-7/5,56/19,-12/5]
sage: cc = [3, -3, -3, 3, -4, 7, -3]
sage: M7=(ZZ^7).span_of_basis([vector(aa),vector(bb)])
sage: M7
Free module of degree 7 and rank 2 over Integer Ring
User basis matrix:
[     0     -1    1/5  -1/19   1/15 -35/57    7/5]
[     1      0   -6/5  20/19   -7/5  56/19  -12/5]
sage: cc vector(cc) in M7
False
True
sage: M7.coordinates(cc)
[3, 3]

Huh, I just noticed that cc in M7 returns the wrong value!