Ask Your Question

Revision history [back]

Mapping abstract vector spaces

This might be a very basic question, but I’ve been struggling with it for days and haven't found any helpful information in the Sage manual. I want to define two abstract vector spaces over a field k, and a linear map between them (and examine the kernel of this map).

Let R be the k-vector space with a basis {v_1, ..., v_n}, and let S be the k-vector space with a basis given by the pairs {[v_1, i_1], ..., [v_t, i_t]}, where each v_j is in R and i_j are some integers. I want to define the linear map f: S -> R that maps [v, i] to v. Let's take a simple example to illustrate the situation:

Let R be the vector space with the basis {u, v}, and let S be the space with the basis {[u, 7], [v, 8], [u+v, 9]}. The map f: S-> R is defined such that f([u, 7]) = u, f([v, 8]) = v, and f([u+v, 9]) = u+v. In this case, a possible basis for the kernel of f is {q = [u, 7] + [v, 8] - [u+v, 9]}. I would also like to recover the coordinates of the kernel vectors in S. For example, something like q.coefficients() = (1, 1, -1) in S.

I have defined the abstract variables v_i using the var(' ') function, but when I try to define the map (using module_morphism), it never works.

Any help would be greatly appreciated (including references to the manual).
Thanks in advance.