Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132935 views
License: OTHER
%auto %html(hide=True) <div class="mathbook-content"> <link rel="stylesheet" type="text/css" href="http://buzzard.ups.edu/mathbook-content.css"> <link rel="stylesheet" type="text/css" href="https://aimath.org/mathbook/mathbook-add-on.css"> </div>
%auto %html(hide=True) <div class="mathbook-content"><div class="hidden-content" style="display:none">\( \newcommand{\lt}{&lt;} \newcommand{\gt}{&gt;} \newcommand{\amp}{&amp;} \)</div></div>
%auto %html(hide=True) <div class="mathbook-content"><table width="90%" style="font-size: 200%;"><tr></tr></table></div>
%auto %html(hide=True) <div class="mathbook-content"><section class="article" id="SS"></section></div>
%auto %html(hide=True) <div class="mathbook-content"><section class="frontmatter" id="frontmatter-1"></section></div>
%auto %html(hide=True) <div class="mathbook-content"> <h2 class="heading"> <span class="title">Sage and Linear Algebra Worksheet:</span> <span class="subtitle">FCLA Section SS</span> </h2> <div class="author"> <div class="author-name">Robert Beezer</div> <div class="author-info">Department of Mathematics and Computer Science<br>University of Puget Sound</div> </div> <div class="date">Fall 2019</div> </div>
%auto %html(hide=True) <div class="mathbook-content"><section class="section" id="section-1"><h6 class="heading hide-type"> <span class="type">Section</span> <span class="codenumber">1</span> <span class="title">Vector Spaces</span> </h6></section></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-1">It is easy in Sage to make a reasonable facsimile of \(\mathbf{C}^n\text{.}\) We just restrict our attention to rational entries rather than complex entries. This vector space contains vectors with 4 slots, each filled with a rational number.</p></div>
V = QQ^4 V
%auto %html(hide=True) <div class="mathbook-content"><article class="exercise-like" id="exercise-1"><h6 class="heading"> <span class="type">Demonstration</span> <span class="codenumber">1</span>.</h6> <p id="p-2">We can test membership using the word/command <code class="code-inline tex2jax_ignore">in</code>. Try vectors with different numers of slots, and perhaps include the complex number <code class="code-inline tex2jax_ignore">2 + 3*I</code> as an entry.</p></article></div>
%auto %html(hide=True) <div class="mathbook-content"><section class="section" id="section-2"><h6 class="heading hide-type"> <span class="type">Section</span> <span class="codenumber">2</span> <span class="title">Vector Form of Solutions to Homogeneous Systems</span> </h6></section></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-3">These are the coefficient matrix and vector of constants from yesterday's big system that led to a colored matrix in reduced row-echelon form.</p></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-4">The <code class="code-inline tex2jax_ignore">.right_kernel()</code> method will give the vectors of the vector form of the solutions to a homogeneous system when used with the <code class="code-inline tex2jax_ignore">basis='pivot'</code> option.</p></div>
A = matrix(QQ, [[ 1, 2, 12, 1, 13, 5, 2], [ -2, -3, -21, 0, -13, 2, -5], [ 1, 3, 15, 4, 28, 25, 0], [ -2, -3, -21, -1, -15, -6, -3], [ 1, 1, 9, 1, 4, 9, 1]]) b = vector(QQ, [8, -15, 7, -10, 3])
A.right_kernel(basis='pivot')
%auto %html(hide=True) <div class="mathbook-content"><p id="p-5">Rows of the “basis matrix” are vectors in yesterday's linear combination (with scalars \(x_3\text{,}\) \(x_5\text{,}\) \(x_6\)). This is a spanning set for the null space of the matrix \(A\text{.}\) See Theorem VFSLS and Theorem SSNS.</p></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-6">Theorem PSPHS can explain how to use a single solution to the non-homogeneous system and the spanning set of the null space of the coefficient matrix to arrive at all solutions to the system. Here is a single solution to the system.</p></div>
A.solve_right(b)
%auto %html(hide=True) <div class="mathbook-content"><p id="p-7">Notice that this vector is the solution when we set each free variable to zero, which is the “other” vector from yesterday that is not part of the linear combination.</p></div>
%auto %html(hide=True) <div class="mathbook-content"><section class="section" id="section-3"><h6 class="heading hide-type"> <span class="type">Section</span> <span class="codenumber">3</span> <span class="title">Spanning Sets</span> </h6></section></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-8">Example ABS from FCLA.</p></div>
x1 = vector(QQ,[1,1,3,1]) x2 = vector(QQ,[2,1,2,-1]) x3 = vector(QQ,[7,3,5,-5]) x4 = vector(QQ,[1,1,-1,2]) x5 = vector(QQ,[-1,0,9,0]) W = span([x1, x2, x3, x4, x5]) W
%auto %html(hide=True) <div class="mathbook-content"><article class="exercise-like" id="exercise-2"><h6 class="heading"> <span class="type">Demonstration</span> <span class="codenumber">2</span>.</h6> <p id="p-9">Make a “random” linear combination of the five vectors and test for membership (which will be trivially true, repeatedly). Remember to use the <code class="code-inline tex2jax_ignore">*</code> operator for vector scalar multiplication.</p></article></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-10">But not any old vector is in \(W\text{.}\)</p></div>
v = vector(QQ, [1, 1, -3, 2]) v in W
%auto %html(hide=True) <div class="mathbook-content"><p id="p-11">It should make sense that arbitrary linear combinations are in the span. How did we manufacture a vector <em class="emphasis">not</em> in the span? Stay tuned.</p></div>
%auto %html(hide=True) <div class="mathbook-content"><article class="conclusion" id="conclusion-1"><h5 class="heading"><span></span></h5></article></div>
%auto %html(hide=True) <div class="mathbook-content"><p id="p-12">This work is Copyright 2016–2019 by Robert A. Beezer. It is licensed under a <a class="external" href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</p></div>
%auto %html(hide=True) <div class="mathbook-content"><table width="90%" style="font-size: 200%;"><tr></tr></table></div>