Sage LTS Linear Transformations, Symbolic

There are several ways to create a linear transformation in Sage, and many natural operations on these objects are possible. As previously, rather than use the complex numbers as our number system, we will instead use the rational numbers, since Sage can model them exactly. We will also use the following transformation repeatedly for examples, when no special properties are required: \begin{align*} &\ltdefn{T}{\complex{3}}{\complex{4}}\\ &\lt{T}{\colvector{x_1\\x_2\\x_3}}=\colvector{-x_1 + 2x_3\\x_1 + 3x_2 + 7x_3\\x_1 + x_2 + x_3\\2x_1 + 3x_2 + 5x_3} \end{align*} To create this linear transformation in Sage, we first create a “symbolic” function, which requires that we also first define some symbolic variables which are x1, x2 and x3 in this case. (You can bypass the intermediate variable outputs in your own work. We will use it consistently to allow us to spread the definition across several lines without the Sage preparser getting in the way. In other words, it is safe to combine the the two lines below and not use outputs.)



You can experiment with T_symbolic, evaluating it at triples of rational numbers, and perhaps doing things like calculating its partial derivatives. We will use it as input to the linear_transformation() constructor. We just need to specify carefully the domain and codomain, now as vector spaces over the rationals rather than the complex numbers.



You can now, of course, experiment with T via tab-completion, but we will explain the various properties of Sage linear transformations as we work through this chapter. Even some seemingly simple operations, such as printing T will require some explanation. But for starters, we can evaluate T.





Here is a small verification of Theorem LTTZZ.



Note that Sage will recognize some symbolic functions as not being linear transformations (in other words, inconsistent with Definition LT), but this detection is fairly easy to fool. We will see some safer ways to create a linear transformation shortly.