Thanks, Francis. Very astute.

> This makes no sense at all; the function is not a homomorphism:

Right.

So K^2 is a 4-dimensional vector space over the rationals. But you've

represented f with a 2 x 2 matrix.

Despite f above acting as a homomorphism, we are not in the clear.

The following (on top of above) works:

sage: x = vector(K, [2, 2])

sage: f.lift(x)

But the following still goes boom:

sage: b = K.0

sage: x = vector(K, [b, b])

sage: f.lift(x)

despite

sage: f.is_surjective()

True

Is there a way in Sage to recognize K^2 as QQ^4? Should we? Can we?

sage: P = K^2

sage: P.vector_space(base_field=QQ)

Vector space of dimension 2 over Rational Field

Not what I would have hoped.

However,

sage: X, fromX, toX = K.vector_space()

sage: a = K.0

sage: toX(5 + 4*a)

(5, 4)

sage: fromX([9, -3])

-3*a + 9

Is there an easy way to extend these mappings with K to the obvious

ones with K^2? If not, maybe this would be a nice enhancement for

the .vector_space() method.

In any event, even with such a mapping, recognizing/identifying K^2 as

QQ^4 seems a bit of work, and then all of the morphism code would have

to translate at the appropriate junctures?

Which brings me back to my original question, just a bit wiser.

Should we explicitly reject constructing morphisms between free

modules if their *obvious* base rings differ, so as to not get

erroneous or conflicting behavior? While leaving the door open to a

big project to be more clever about recognizing constructions like K^2

as free modules over less-obvious rings? (By obvious and less-

obvious, I mean in terms of implementation.) My inclination is to say

"yes."

--

To post to this group, send an email to sage-devel@googlegroups.com

To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com

For more options, visit this group at http://groups.google.com/group/sage-devel

URL: http://www.sagemath.org