diff --git a/source/common/sagemath/library.sage b/source/common/sagemath/library.sage index 4241ada9a..a9bf8f0e5 100644 --- a/source/common/sagemath/library.sage +++ b/source/common/sagemath/library.sage @@ -578,12 +578,12 @@ class TBIL: #Vector equation class class LinearCombinationFromMatrix(LinearCombination): - def __init__(self,A,vars=None): + def __init__(self,A,coefficients=None): A=A.subdivision(0,0) # ignores augmented matrices - if vars is None: + if coefficients is None: self.coefficients=[var(f"x_{i}") for i in range(1,len(A.columns())+1)] else: - self.coefficients=[vars[:len(A.columns())]] + self.coefficients=coefficients[:len(A.columns())] self.vectors=[column_matrix(v) for v in A.columns()] self.length=min(len(self.coefficients),len(self.vectors)) self.parentheses=False diff --git a/source/linear-algebra/exercises/outcomes/AT/AT2/generator.sage b/source/linear-algebra/exercises/outcomes/AT/AT2/generator.sage index df21f8cf7..875b490e6 100644 --- a/source/linear-algebra/exercises/outcomes/AT/AT2/generator.sage +++ b/source/linear-algebra/exercises/outcomes/AT/AT2/generator.sage @@ -39,6 +39,7 @@ class Generator(BaseGenerator): "Tcols": Tcolumns, "Tstandardmatrix": B, "vector": v, - "Tvector": B*v + "Tvector": B*v, + "Tcombo": TBIL.LinearCombinationFromMatrix(B,coefficients=list(v)) } diff --git a/source/linear-algebra/exercises/outcomes/AT/AT2/template.xml b/source/linear-algebra/exercises/outcomes/AT/AT2/template.xml index 917ec0e61..677ac346a 100644 --- a/source/linear-algebra/exercises/outcomes/AT/AT2/template.xml +++ b/source/linear-algebra/exercises/outcomes/AT/AT2/template.xml @@ -2,11 +2,13 @@ -

Explain and demonstrate how to compute - the standard matrix for the linear transformation - S:\mathbb{R}^{{Scols}} \to \mathbb{R}^{{Srows}} given by - S\left( {{varvector}} \right) = {{varmap}} - by computing transformations of the standard basic vectors.

+

+Explain and demonstrate how to compute +the standard matrix for the linear transformation +S:\mathbb{R}^{{Scols}} \to \mathbb{R}^{{Srows}} given by +S\left( {{varvector}} \right) = {{varmap}} +by computing transformations of the standard basic vectors. +

{{Sstandardmatrix}}

@@ -14,15 +16,29 @@
-

Let T:\mathbb{R}^{{Tcols}} \to \mathbb{R}^{{Trows}} - be the linear transformation given by the standard matrix - {{Tstandardmatrix}}. - Explain and demonstrate how to compute - T\left({{vector}}\right) by using the values of - transformed standard basic vectors.

+

+Let T:\mathbb{R}^{{Tcols}} \to \mathbb{R}^{{Trows}} +be the linear transformation given by the standard matrix +{{Tstandardmatrix}}. +Compute T\left({{vector}}\right) using technology. +

T\left({{vector}}\right)={{Tvector}}

+ + +

+Now explain and demonstrate how to compute +T\left({{vector}}\right) by using the values of +transformed standard basic vectors. +

+
+ +

+T\left({{vector}}\right)={{Tcombo}}={{Tvector}} +

+
+
diff --git a/source/linear-algebra/source/03-AT/02.ptx b/source/linear-algebra/source/03-AT/02.ptx index ff6671ac5..875b659a8 100644 --- a/source/linear-algebra/source/03-AT/02.ptx +++ b/source/linear-algebra/source/03-AT/02.ptx @@ -59,6 +59,7 @@ can be applied before or after the transformation without affecting the result. Class Activities +

@@ -227,7 +228,7 @@ create a spanning and linearly independent set along with \left[\begin{array}{c} 0 \\ 0 \\ 1 \end{array}\right], they each may be used to compute T\left(\left[\begin{array}{c}0\\4\\-1\end{array}\right]\right): - + T\left(\left[\begin{array}{c}0\\4\\-1\end{array}\right]\right) = T\left(\left[\begin{array}{c}0\\4\\0\end{array}\right]\right) @@ -239,8 +240,8 @@ to compute \left[\begin{array}{c} -3 \\ 2 \end{array}\right] = \left[\begin{array}{c} -1 \\ 14 \end{array}\right] - - + + T\left(\left[\begin{array}{c}0\\4\\-1\end{array}\right]\right) = 4 @@ -254,8 +255,8 @@ to compute \left[\begin{array}{c} -3 \\ 2 \end{array}\right] = \left[\begin{array}{c} -1 \\ 14 \end{array}\right] - - + + T\left(\left[\begin{array}{c}0\\4\\-1\end{array}\right]\right) = 4 @@ -264,8 +265,8 @@ to compute T\left(\left[\begin{array}{c}0\\0\\1\end{array}\right]\right) -4 T\left(\left[\begin{array}{c}1\\0\\0\end{array}\right]\right) - - + + = 4 \left[\begin{array}{c} -2 \\ 7\end{array}\right] @@ -277,7 +278,7 @@ to compute \left[\begin{array}{c} -8+15-8 \\ 28-10-4 \end{array}\right] = \left[\begin{array}{c} -1 \\ 14 \end{array}\right] - +

@@ -288,10 +289,10 @@ Consider any basis \{\vec b_1,\dots,\vec b_n\} for V. Since every vector \vec v can be written as a linear combination of basis vectors, \vec v = x_1\vec b_1+\dots+ x_n\vec b_n, we may compute T(\vec v) as follows: - + T(\vec v)=T(x_1\vec b_1+\dots+ x_n\vec b_n)= x_1T(\vec b_1)+\dots+x_nT(\vec b_n) -. +. Therefore any linear transformation T:V \rightarrow W can be defined by just describing the values of T(\vec b_i).

@@ -313,7 +314,7 @@ store this information in an m\times n matrix, called the standard For example, let T: \IR^3 \rightarrow \IR^2 be the linear map determined by the following values for T applied to the standard basis of \IR^3. -\scriptsize +\scriptsize T\left(\vec e_1 \right) = T\left(\left[\begin{array}{c} 1 \\ 0 \\ 0 \end{array}\right] \right) @@ -331,13 +332,13 @@ the following values for T applied to the standard basis of \IR^3. T\left(\left[\begin{array}{c} 0 \\ 0 \\ 1 \end{array}\right] \right) = \left[\begin{array}{c} -3 \\ 2\end{array}\right] - + Then the standard matrix corresponding to T is - + \left[\begin{array}{ccc}T(\vec e_1) & T(\vec e_2) & T(\vec e_3)\end{array}\right] = \left[\begin{array}{ccc}2 & -1 & -3 \\ 1 & 4 & 2 \end{array}\right] -. +.

@@ -346,23 +347,23 @@ Then the standard matrix corresponding to T is

Let T: \IR^4 \rightarrow \IR^3 be the linear transformation given by - + T\left(\vec e_1 \right) = \left[\begin{array}{c} 0 \\ 3 \\ -2\end{array}\right] - \hspace{2em} + \hspace{1em} T\left(\vec e_2 \right) = \left[\begin{array}{c} -3 \\ 0 \\ 1\end{array}\right] - \hspace{2em} + \hspace{1em} T\left(\vec e_3 \right) = \left[\begin{array}{c} 4 \\ -2 \\ 1\end{array}\right] - \hspace{2em} + \hspace{1em} T\left(\vec e_4 \right) = \left[\begin{array}{c} 2 \\ 0 \\ 0\end{array}\right] - + Write the standard matrix [T(\vec e_1) \,\cdots\, T(\vec e_n)] for T.

@@ -372,7 +373,7 @@ Write the standard matrix [T(\vec e_1) \,\cdots\, T(\vec e_n)] for T

Let T: \IR^3 \rightarrow \IR^2 be the linear transformation given by -T\left(\left[\begin{array}{c} x\\ y \\ z \end{array}\right] \right) = \left[\begin{array}{c} x+3z \\ 2x-y-4z \end{array}\right] +T\left(\left[\begin{array}{c} x\\ y \\ z \end{array}\right] \right) = \left[\begin{array}{c} x+3z \\ 2x-y-4z \end{array}\right]

@@ -395,7 +396,7 @@ Find the standard matrix for T. T(\vec e_i) yields exactly the coefficients of x_i, the standard matrix for T is simply an array of the coefficients of the x_i: - + T\left(\left[\begin{array}{c}x\\y\\z\\w\end{array}\right]\right) = \left[\begin{array}{c} @@ -409,14 +410,14 @@ Find the standard matrix for T. a & b & c & d \\ e & f & g & h \end{array}\right] - +

Since the formula for a linear transformation T and its standard matrix A may both be used to compute the transformation of a vector \vec x, we will often write T(\vec x) and A\vec x interchangeably: - + T\left(\left[\begin{array}{c}x_1\\x_2\\x_3\\x_4\end{array}\right]\right) = \left[\begin{array}{c} @@ -425,43 +426,209 @@ of a vector \vec x, we will often write \end{array}\right] = A\left[\begin{array}{c}x_1\\x_2\\x_3\\x_4\end{array}\right] + + = \left[\begin{array}{cccc} a & b & c & d \\ e & f & g & h \end{array}\right] \left[\begin{array}{c}x_1\\x_2\\x_3\\x_4\end{array}\right] - + = + x_1 + \left[\begin{array}{c} + a \\ + e + \end{array}\right] + +x_2 + \left[\begin{array}{c} + b \\ + f + \end{array}\right] + +x_3 + \left[\begin{array}{c} + c \\ + g + \end{array}\right] + +x_4 + \left[\begin{array}{c} + d \\ + h + \end{array}\right] +

+ + +

+The convention of writing T(\vec v)=A\vec v for a transformation T +and its standard matrix A also matches how transformations are implemented +in mathematics software such as Octave. Let's use Octave to compute a transformation +for us. +

+
+ + +

+Find the standard matrix for +T\left(\left[\begin{array}{c} x\\ y \end{array}\right] \right) = \left[\begin{array}{c} -x+2y \\ -3y \\ 4x+y \end{array}\right] +and assign it to the variable A in Octave. +

+
+ +

+ +A = \left[\begin{array}{cc} -1 & 2 \\ 0 & -3 \\ 4 & 1 \end{array}\right] + +

+ +A = [ +-1 2 + 0 -3 + 4 1 +] + +
+
+ + +

+Assign the vector \left[\begin{array}{c} -2 \\ 5 \end{array}\right] +to the variable v, then compute A*v. +

+
+ + + +format rat +A = [ +-1 2 + 0 -3 + 4 1 +] +v = [-2;5] +A*v + + +A = + + -1 2 + 0 -3 + 4 1 + +v = + + -2 + 5 + +ans = + + 12 + -15 + -3 + + + +
+ + +

+Confirm that the resulting vector A\vec v is correct by +computing T\left(\left[\begin{array}{c} -2 \\ 5 \end{array}\right]\right) +by hand. +

+
+ +

+ +T\left(\left[\begin{array}{c} -2 \\ 5 \end{array}\right]\right) += -2\left[\begin{array}{c} -1 \\ 0 \\ 4 \end{array}\right] + + 5\left[\begin{array}{c} 2 \\ -3 \\ 1 \end{array}\right] += \left[\begin{array}{c} 12 \\ -15 \\ -3 \end{array}\right] + +

+
+
+
+ + -

Explain and demonstrate how to compute the standard matrix for the linear transformation S:\mathbb{R}^2 \to \mathbb{R}^4 given by S\left( \left[\begin{array}{c} x_{1} \\ x_{2} \end{array}\right] \right) = \left[\begin{array}{c} 9 \, x_{1} - 2 \, x_{2} \\ -3 \, x_{1} \\ 5 \, x_{1} - x_{2} \\ -6 \, x_{2} \end{array}\right] by computing transformations of the standard basic vectors:

-

S(\vec e_1)=\left[\begin{array}{c} \unknown \\ \unknown \\ \unknown \\ \unknown \end{array}\right]\hspace{1em}S(\vec e_2)=\left[\begin{array}{c} \unknown \\ \unknown \\ \unknown \\ \unknown\end{array}\right]\hspace{1em}\rightarrow\hspace{1em}\left[\begin{array}{cc} \unknown & \unknown \\ \unknown & \unknown \\ \unknown & \unknown \\\unknown & \unknown \end{array}\right]

+

Explain and demonstrate how to compute the standard matrix for the linear transformation S:\mathbb{R}^2 \to \mathbb{R}^4 given by S\left( \left[\begin{array}{c} x_{1} \\ x_{2} \end{array}\right] \right) = \left[\begin{array}{c} 9 \, x_{1} - 2 \, x_{2} \\ -3 \, x_{1} \\ 5 \, x_{1} - x_{2} \\ -6 \, x_{2} \end{array}\right] by computing transformations of the standard basic vectors:

+

S(\vec e_1)=\left[\begin{array}{c} \unknown \\ \unknown \\ \unknown \\ \unknown \end{array}\right]\hspace{1em}S(\vec e_2)=\left[\begin{array}{c} \unknown \\ \unknown \\ \unknown \\ \unknown\end{array}\right]\hspace{1em}\rightarrow\hspace{1em}\left[\begin{array}{cc} \unknown & \unknown \\ \unknown & \unknown \\ \unknown & \unknown \\\unknown & \unknown \end{array}\right]

- \left[\begin{array}{cc} 9 & -2 \\ -3 & 0 \\ 5 & -1 \\ 0 & -6 \end{array}\right] + \left[\begin{array}{cc} 9 & -2 \\ -3 & 0 \\ 5 & -1 \\ 0 & -6 \end{array}\right]

-

Let T:\mathbb{R}^4 \to \mathbb{R}^3 be the linear transformation given by the standard matrix \left[\begin{array}{cccc} -2 & -4 & 2 & -2 \\ -4 & 3 & -3 & 2 \\ 5 & 0 & 2 & -6 \end{array}\right]. Explain and demonstrate how to compute T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right) by using the values of transformed standard basic vectors:

-

T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right)=\unknown T(\vec e_1)+\unknown T(\vec e_2)+\unknown T(\vec e_3)+\unknown T(\vec e_4)

+

Let T:\mathbb{R}^4 \to \mathbb{R}^3 be the linear transformation given by the standard matrix \left[\begin{array}{cccc} -2 & -4 & 2 & -2 \\ -4 & 3 & -3 & 2 \\ 5 & 0 & 2 & -6 \end{array}\right].

+

Compute T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right) using technology.

+
+ + + +format rat +A = [ +-2 -4 2 -2 +-4 3 -3 2 +5 0 2 -6 +] +v = [-5;0;-3;-2] +A*v + + +A = + + -2 -4 2 -2 + -4 3 -3 2 + 5 0 2 -6 + +v = + + -5 + 0 + -3 + -2 + +ans = + + 8 + 25 + -19 + + + +
+ + +

+ Now explain and demonstrate how to compute T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right) by using the values of transformed standard basic vectors:

+

T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right)=\unknown T(\vec e_1)+\unknown T(\vec e_2)+\unknown T(\vec e_3)+\unknown T(\vec e_4)

- T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right)=\left[\begin{array}{c} 8 \\ 25 \\ -19 \end{array}\right] + +T\left(\left[\begin{array}{c} -5 \\ 0 \\ -3 \\ -2 \end{array}\right]\right) +=-5\left[\begin{array}{c} -2 \\ -4 \\ -3 \end{array}\right] ++0\left[\begin{array}{c} -4 \\ 3 \\ 0 \end{array}\right] +-3\left[\begin{array}{c} 2 \\ -3 \\ 2 \end{array}\right] +-2\left[\begin{array}{c} -2 \\ 2 \\ -6 \end{array}\right] +=\left[\begin{array}{c} 8 \\ 25 \\ -19 \end{array}\right] +

+