📚 The CoCalc Library - books, templates and other resources
License: OTHER
<?xml version="1.0" encoding="UTF-8" ?>12<!-- Sage and Linear Algebra Worksheets -->3<!-- Robert A. Beezer -->4<!-- Copyright 2017-2019 License: CC BY-SA -->5<!-- See COPYING for more information -->67<pretext xmlns:xi="http://www.w3.org/2001/XInclude">89<xi:include href="../worksheetinfo.xml" />1011<article xml:id="ILT">12<title>Sage and Linear Algebra Worksheet</title>13<subtitle>FCLA Section ILT</subtitle>1415<!-- header inclusion needs -xinclude switch on xsltproc -->16<frontmatter>17<xi:include href="../header.xml" />18</frontmatter>1920<section>21<title>Injective Linear Transformations</title>2223<p>Two carefully-crafted linear transformations: <c>T</c> is injective, <c>S</c> is not.</p>2425<sage><input>26A = matrix(QQ, [[1, 2, 2], [3, 7, 6], [1, 2, 1], [2, 5, 7]])27T = linear_transformation(QQ^3, QQ^4, A, side='right')28</input></sage>2930<sage><input>31T.is_injective()32</input></sage>3334<sage><input>35T.kernel()36</input></sage>3738<sage><input>39B = matrix(QQ, [[0, 1, -2], [-1, 1, 3], [-2, 5, 0], [0, 2, -4]])40S = linear_transformation(QQ^3, QQ^4, B, side='right')41</input></sage>4243<sage><input>44S.is_injective()45</input></sage>4647<sage><input>48K = S.kernel()49K50</input></sage>5152<p>We create two different inputs, which differ by a random vector from the kernel (which we hope is not simply the zero vector, a distinct possibility). We always get the same output from <c>S</c>, predictably. If we try this with <c>T</c> then the kernel vector is <em>always</em> the zero vector and the demonstration is very uninteresting.</p>5354<sage><input>55z = K.random_element()56u = random_vector(QQ, 3)57w = u + z58u, w, S(u), S(w), S(u) == S(w)59</input></sage>6061</section>6263<xi:include href="../legal.xml" />6465</article>66</pretext>676869