Sage SS Spanning Sets

A strength of Sage is the ability to create infinite sets, such as the span of a set of vectors, from finite descriptions. In other words, we can take a finite set with just a handful of vectors and Sage will create the set that is the span of these vectors, which is an infinite set. Here we will show you how to do this, and show how you can use the results. The key command is the vector space method .span().













Most of the above should be fairly self-explanatory, but a few comments are in order. The span, W, is created in the first compute cell with the .span() method, which accepts a list of vectors and needs to be employed as a method of a vector space. The information about W printed when we just input the span itself may be somewhat confusing, and as before, we need to learn some more theory to totally understand it all. For now you can see the number system (Rational Field) and the number of entries in each vector (degree 4). The dimension may be more complicated than you first suspect.

Sets are all about membership, and we see that we can easily check membership in a span. We know the vector x will be in the span W since we built it as a linear combination of v1 and v2. The vectors y and u are a bit more mysterious, but Sage can answer the membership question easily for both.

The last compute cell is something new. The symbol <= is meant here to be the “subset of” relation, i.e. a slight abuse of the mathematical symbol $\subseteq$, and then we are not surprised to learn that W really is a subset of V.

It is important to realize that the span is a construction that begins with a finite set, yet creates an infinite set. With a loop (the for command) and the .random_element() vector space method we can create many, but not all, of the elements of a span. In the examples below, you can edit the total number of random vectors produced, and you may need to click through to another file of output if you ask for more than about 100 vectors.

Each example is designed to illustrate some aspect of the behavior of the span command and to provoke some questions. So put on your mathematician's hat, evaluate the compute cells to create some sample elements, and then study the output carefully looking for patterns and maybe even conjecture some explanations for the behavior. The puzzle gets just a bit harder for each new example. (We use the Sequence() command to get nicely-formatted line-by-line output of the list, and notice that we are only providing a portion of the output here. You will want to evalaute the computation of vecs and then evaluate the next cell in the Sage notebook for maximum effect.)