Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132936 views
License: OTHER
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<!-- Sage and Linear Algebra Worksheets -->
4
<!-- Robert A. Beezer -->
5
<!-- Copyright 2017-2019 License: CC BY-SA -->
6
<!-- See COPYING for more information -->
7
8
<pretext xmlns:xi="http://www.w3.org/2001/XInclude">
9
10
<xi:include href="../worksheetinfo.xml" />
11
12
<article xml:id="ILT">
13
<title>Sage and Linear Algebra Worksheet</title>
14
<subtitle>FCLA Section ILT</subtitle>
15
16
<!-- header inclusion needs -xinclude switch on xsltproc -->
17
<frontmatter>
18
<xi:include href="../header.xml" />
19
</frontmatter>
20
21
<section>
22
<title>Injective Linear Transformations</title>
23
24
<p>Two carefully-crafted linear transformations: <c>T</c> is injective, <c>S</c> is not.</p>
25
26
<sage><input>
27
A = matrix(QQ, [[1, 2, 2], [3, 7, 6], [1, 2, 1], [2, 5, 7]])
28
T = linear_transformation(QQ^3, QQ^4, A, side='right')
29
</input></sage>
30
31
<sage><input>
32
T.is_injective()
33
</input></sage>
34
35
<sage><input>
36
T.kernel()
37
</input></sage>
38
39
<sage><input>
40
B = matrix(QQ, [[0, 1, -2], [-1, 1, 3], [-2, 5, 0], [0, 2, -4]])
41
S = linear_transformation(QQ^3, QQ^4, B, side='right')
42
</input></sage>
43
44
<sage><input>
45
S.is_injective()
46
</input></sage>
47
48
<sage><input>
49
K = S.kernel()
50
K
51
</input></sage>
52
53
<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>
54
55
<sage><input>
56
z = K.random_element()
57
u = random_vector(QQ, 3)
58
w = u + z
59
u, w, S(u), S(w), S(u) == S(w)
60
</input></sage>
61
62
</section>
63
64
<xi:include href="../legal.xml" />
65
66
</article>
67
</pretext>
68
69