Ask Your Question

Revision history [back]

I like coordinate-free linear algebra, but your issue here may simply be that == is not the "is identical" operator. Consider the following examples:

sage: 3 == Mod(3,7)
True
sage: 3 == Mod(3,5)
True
sage: Mod(3,5) == Mod(3,7)
False
sage: Q = PolynomialRing(QQ,'t')
sage: 3 == Q(3)
True
sage: 3 in Q
True
sage: R = PolynomialRing(RR,'w,v')
sage: 3 == R(3)
True
sage: Q(3) == R(3)
False

Given this behavior, I don't find it particularly surprising that V == W returns True above!

Of course, id(V) == id(W) also returns True, which is a little more surprising (to me). And the free module documentation includes the following note:

Note: In Sage it is the case that there is only one dense and one sparse free ambient module of rank n over R.

So it seems it's not even _possible_ to make two separate copies of a free module with a given rank. That seems a little limiting, which is your original point, I guess :) Maybe it's more accurate to think of VectorSpace as short for "VectorSpaceWithCanonicalBasis".