Skip to content

Commit c47e337

Browse files
committed
Website build
1 parent 011b395 commit c47e337

15 files changed

+191
-131
lines changed
-273 Bytes
Binary file not shown.

L1_preliminaries.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,7 @@ <h2><span class="section-number">1.5. </span>Inner products and orthogonality<a
564564
<p>Let <span class="math notranslate nohighlight">\(x,y\in \mathbb{C}^m\)</span>. Then the inner product of <span class="math notranslate nohighlight">\(x\)</span> and <span class="math notranslate nohighlight">\(y\)</span> is</p>
565565
<div class="math notranslate nohighlight">
566566
\[x^*y = \sum_{i=1}^m \bar{x}_iy_i.\]</div>
567-
</div></div><p>(Exercise: check that the inner product is bilinear, i.e. linear in
568-
both of the arguments.)</p>
569-
<p>We will frequently use the natural norm derived from the inner product
567+
</div></div><p>We will frequently use the natural norm derived from the inner product
570568
to define size of vectors.</p>
571569
<div class="proof proof-type-definition" id="id19">
572570

L2_QR_factorisation.html

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ <h2><span class="section-number">2.2. </span>QR factorisation by classical Gram-
195195
<span class="proof-type">Exercise 2.4</span>
196196

197197
</div><div class="proof-content">
198-
<p><span class="math notranslate nohighlight">\((\ddagger)\)</span> The <a class="reference internal" href="cla_utils.html#cla_utils.exercises2.GS_classical" title="cla_utils.exercises2.GS_classical"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises2.GS_classical()</span></code></a> function has been
199-
left unimplemented. It should implement the classical Gram-Schmidt
200-
algorithm above, using Numpy slice notation so that only one Python
201-
for loop is used. The function should work “in place” by making a
202-
copy of <span class="math notranslate nohighlight">\(A\)</span> and then changing the values in the copy, without
203-
introducing additional intermediate arrays (you will need to create
204-
a new array to store <span class="math notranslate nohighlight">\(R\)</span>). The test script <code class="docutils literal notranslate"><span class="pre">test_exercises2.py</span></code>
205-
in the <code class="docutils literal notranslate"><span class="pre">test</span></code> directory will test this function.</p>
198+
<p><span class="math notranslate nohighlight">\((\ddagger)\)</span> The <a class="reference internal" href="cla_utils.html#cla_utils.exercises2.GS_classical" title="cla_utils.exercises2.GS_classical"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises2.GS_classical()</span></code></a> function
199+
has been left unimplemented. It should implement the classical
200+
Gram-Schmidt algorithm above, using Numpy slice notation so that
201+
only one Python for loop is used. The function should work “in
202+
place” by changing the values in <span class="math notranslate nohighlight">\(A\)</span>, without introducing
203+
additional intermediate arrays (you will need to create a new array
204+
to store <span class="math notranslate nohighlight">\(R\)</span>). The test script <code class="docutils literal notranslate"><span class="pre">test_exercises2.py</span></code> in the
205+
<code class="docutils literal notranslate"><span class="pre">test</span></code> directory will test this function.</p>
206206
</div></div><div class="admonition hint">
207207
<p class="admonition-title">Hint</p>
208208
<p>The <span class="math notranslate nohighlight">\((\ddagger)\)</span> symbol in an exercise indicates that the code for
@@ -321,9 +321,9 @@ <h2><span class="section-number">2.4. </span>Modified Gram-Schmidt<a class="head
321321
algorithm above, using Numpy slice notation where possible.
322322
What is the minimal number of Python
323323
for loops possible?</p>
324-
<p>The function should work “in place” by making a
325-
copy of <span class="math notranslate nohighlight">\(A\)</span> and then changing those values, without introducing
326-
additional intermediate arrays. The test script
324+
<p>The function should work “in place” by changing the values in <span class="math notranslate nohighlight">\(A\)</span>,
325+
without introducing additional intermediate arrays (you will need
326+
to create a new array to store <span class="math notranslate nohighlight">\(R\)</span>). The test script
327327
<code class="docutils literal notranslate"><span class="pre">test_exercises2.py</span></code> in the <code class="docutils literal notranslate"><span class="pre">test</span></code> directory will test this
328328
function.</p>
329329
</div></div><div class="proof proof-type-exercise" id="id6">
@@ -362,7 +362,7 @@ <h2><span class="section-number">2.5. </span>Modified Gram-Schmidt as triangular
362362
\underbrace{
363363
\begin{pmatrix}
364364
\frac{1}{r_{11}} &amp; -\frac{r_{12}}{r_{11}} &amp; \ldots &amp;
365-
\ldots &amp; -\frac{r_{11}}{r_{11}} \\
365+
\ldots &amp; -\frac{r_{1n}}{r_{11}} \\
366366
0 &amp; 1 &amp; 0 &amp; \ldots &amp; 0 \\
367367
0 &amp; 0 &amp; 1 &amp; \ldots &amp; 0 \\
368368
\vdots &amp; \ddots &amp; \ddots &amp; \ldots &amp; \vdots \\
@@ -392,7 +392,7 @@ <h2><span class="section-number">2.5. </span>Modified Gram-Schmidt as triangular
392392
\begin{pmatrix}
393393
1 &amp; 0 &amp; 0 &amp;
394394
\ldots &amp; 0 \\
395-
0 &amp; \frac{1}{r_{22}} &amp; -\frac{r_{23}}{r_{22}} &amp; \ldots &amp; -\frac{r_{2n}}{r_{nn}} \\ 0 &amp; 0 &amp; 1 &amp; \ldots &amp; 0 \\
395+
0 &amp; \frac{1}{r_{22}} &amp; -\frac{r_{23}}{r_{22}} &amp; \ldots &amp; -\frac{r_{2n}}{r_{22}} \\ 0 &amp; 0 &amp; 1 &amp; \ldots &amp; 0 \\
396396
\vdots &amp; \ddots &amp; \ddots &amp; \ldots &amp; \vdots \\
397397
0 &amp; 0 &amp; 0 &amp; \ldots &amp; 1 \\
398398
\end{pmatrix}}_{R_2}
@@ -660,7 +660,30 @@ <h2><span class="section-number">2.6. </span>Householder triangulation<a class="
660660
<summary>
661661
Supplementary video</summary><div class="video_wrapper" style="">
662662
<iframe allowfullscreen="true" src="https://player.vimeo.com/video/450202242" style="border: 0; height: 345px; width: 560px">
663-
</iframe></div></details><div class="proof proof-type-exercise" id="id9">
663+
</iframe></div></details><p>In this section we will frequently encounter systems of the form</p>
664+
<div class="math notranslate nohighlight">
665+
\[\hat{R}x = y.\]</div>
666+
<p>This is an upper triangular system that can be solved efficiently
667+
using back-substitution.</p>
668+
<p>Written in components, this equation is</p>
669+
<blockquote>
670+
<div><div class="math notranslate nohighlight">
671+
\[ \begin{align}\begin{aligned}R_{11}x_1 + R_{12}x_2 + \ldots + R_{1(m-1)}x_{m-1} + R_{1m}x_m = y_1,\\0x_1 + R_{22}x_2 + \ldots + R_{2(m-1)}x_{m-1} + R_{2m}x_m = y_2,\\\vdots\\0x_1 + 0x_2 + \ldots + R_{(m-1)(m-1)}x_{m-1} + R_{(m-1)m}x_m = y_{m-1},\\ 0x_1 + 0x_2 + \ldots + 0x_{m-1} + R_{mm}x_m = y_{m}.\end{aligned}\end{align} \]</div>
672+
</div></blockquote>
673+
<p>The last equation yields <span class="math notranslate nohighlight">\(x_m\)</span> directly by dividing by <span class="math notranslate nohighlight">\(R_{mm}\)</span>, then
674+
we can use this value to directly compute <span class="math notranslate nohighlight">\(x_{m-1}\)</span>. This is repeated
675+
for all of the entries of <span class="math notranslate nohighlight">\(x\)</span> from <span class="math notranslate nohighlight">\(m\)</span> down to 1. This procedure is
676+
called back substitution, which we summarise in the following
677+
pseudo-code.</p>
678+
<ul class="simple">
679+
<li><p><span class="math notranslate nohighlight">\(x_m \gets y_m/R_{mm}\)</span></p></li>
680+
<li><p>FOR <span class="math notranslate nohighlight">\(i= m-1\)</span> TO 1 (BACKWARDS)</p>
681+
<ul>
682+
<li><p><span class="math notranslate nohighlight">\(x_i \gets (y_i - \sum_{k=i+1}^mR_{ik}x_k)/R_{ii}\)</span></p></li>
683+
</ul>
684+
</li>
685+
</ul>
686+
<div class="proof proof-type-exercise" id="id9">
664687

665688
<div class="proof-title">
666689
<span class="proof-type">Exercise 2.9</span>
@@ -709,11 +732,7 @@ <h2><span class="section-number">2.6. </span>Householder triangulation<a class="
709732
<a class="reference internal" href="cla_utils.html#cla_utils.exercises3.householder" title="cla_utils.exercises3.householder"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises3.householder()</span></code></a>. If you have not already
710733
done so, you will need to modified
711734
<a class="reference internal" href="cla_utils.html#cla_utils.exercises3.householder" title="cla_utils.exercises3.householder"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises3.householder()</span></code></a> to use the <code class="docutils literal notranslate"><span class="pre">kmax</span></code>
712-
argument. You may make use of the built-in triangular solve
713-
algorithm <a class="reference external" href="http://scipy.github.io/devdocs/reference/generated/scipy.linalg.solve_triangular.html#scipy.linalg.solve_triangular" title="(in SciPy v1.10.0.dev0+1717.ebbd597)"><code class="xref py py-func docutils literal notranslate"><span class="pre">scipy.linalg.solve_triangular()</span></code></a> (we shall consider
714-
triangular matrix algorithms briefly later). The test script
715-
<code class="docutils literal notranslate"><span class="pre">test_exercises3.py</span></code> in the <code class="docutils literal notranslate"><span class="pre">test</span></code> directory will also test this
716-
function.</p>
735+
argument. You will also need <a class="reference internal" href="cla_utils.html#cla_utils.exercises3.solve_U" title="cla_utils.exercises3.solve_U"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises3.solve_U()</span></code></a>.</p>
717736
</div></div><p>If we really need <span class="math notranslate nohighlight">\(Q\)</span>, we can get it by matrix-vector products with
718737
each element of the canonical basis <span class="math notranslate nohighlight">\((e_1,e_2,\ldots,e_n)\)</span>. This
719738
means that first we need to compute a matrix-vector product <span class="math notranslate nohighlight">\(Qx\)</span> with
@@ -809,24 +828,7 @@ <h2><span class="section-number">2.7. </span>Application: Least squares problems
809828
\[\hat{R}x = \hat{Q}^*b.\]</div>
810829
</div></blockquote>
811830
<p>This is an upper triangular system that can be solved efficiently
812-
using back-substitution. Written in components, this equation is</p>
813-
<blockquote>
814-
<div><div class="math notranslate nohighlight">
815-
\[ \begin{align}\begin{aligned}R_{11}x_1 + R_{12}x_2 + \ldots + R_{1(m-1)}x_{m-1} + R_{1m}x_m = y_1,\\0x_1 + R_{22}x_2 + \ldots + R_{2(m-1)}x_{m-1} + R_{2m}x_m = y_2,\\\vdots\\0x_1 + 0x_2 + \ldots + R_{(m-1)(m-1)}x_{m-1} + R_{(m-1)m}x_m = y_{m-1},\\ 0x_1 + 0x_2 + \ldots + 0x_{m-1} + R_{mm}x_m = y_{m}.\end{aligned}\end{align} \]</div>
816-
</div></blockquote>
817-
<p>The last equation yields <span class="math notranslate nohighlight">\(x_m\)</span> directly by dividing by <span class="math notranslate nohighlight">\(R_{mm}\)</span>, then
818-
we can use this value to directly compute <span class="math notranslate nohighlight">\(x_{m-1}\)</span>. This is repeated
819-
for all of the entries of <span class="math notranslate nohighlight">\(x\)</span> from <span class="math notranslate nohighlight">\(m\)</span> down to 1. This procedure is
820-
called back substitution, which we summarise in the following
821-
pseudo-code.</p>
822-
<ul class="simple">
823-
<li><p><span class="math notranslate nohighlight">\(x_m \gets y_m/R_{mm}\)</span></p></li>
824-
<li><p>FOR <span class="math notranslate nohighlight">\(i= m-1\)</span> TO 1 (BACKWARDS)</p>
825-
<ul>
826-
<li><p><span class="math notranslate nohighlight">\(x_i \gets (y_i - \sum_{k=i+1}^mR_{ik}x_k)/R_{ii}\)</span></p></li>
827-
</ul>
828-
</li>
829-
</ul>
831+
using back-substitution.</p>
830832
<div class="proof proof-type-exercise" id="id12">
831833

832834
<div class="proof-title">
@@ -840,7 +842,7 @@ <h2><span class="section-number">2.7. </span>Application: Least squares problems
840842
by forming an appropriate augmented matrix <span class="math notranslate nohighlight">\(\hat{A}\)</span>, calling
841843
<a class="reference internal" href="cla_utils.html#cla_utils.exercises3.householder" title="cla_utils.exercises3.householder"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises3.householder()</span></code></a> and extracting appropriate
842844
subarrays using slice notation, before using
843-
<a class="reference external" href="http://scipy.github.io/devdocs/reference/generated/scipy.linalg.solve_triangular.html#scipy.linalg.solve_triangular" title="(in SciPy v1.10.0.dev0+1717.ebbd597)"><code class="xref py py-func docutils literal notranslate"><span class="pre">scipy.linalg.solve_triangular()</span></code></a> to solve the resulting upper
845+
<a class="reference internal" href="cla_utils.html#cla_utils.exercises3.solve_U" title="cla_utils.exercises3.solve_U"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises3.solve_U()</span></code></a> to solve the resulting upper
844846
triangular system, before returning the solution <span class="math notranslate nohighlight">\(x\)</span>. The test
845847
script <code class="docutils literal notranslate"><span class="pre">test_exercises3.py</span></code> in the <code class="docutils literal notranslate"><span class="pre">test</span></code> directory will also
846848
test this function.</p>

L3_analysing_algorithms.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,10 @@ <h2><span class="section-number">3.9. </span>Stability<a class="headerlink" href
731731
<div><div class="math notranslate nohighlight">
732732
\[\frac{\|\tilde{f}(x)-f(x)\|}{\|f(x)\|} \leq C\varepsilon,\]</div>
733733
</div></blockquote>
734-
<p>for sufficiently small <span class="math notranslate nohighlight">\(\varepsilon\)</span>. We shall see below that
735-
we have to lower our aspirations depending on the condition number of <span class="math notranslate nohighlight">\(A\)</span>.</p>
734+
<p>for sufficiently small <span class="math notranslate nohighlight">\(\varepsilon\)</span> (assuming, albeit
735+
unrealistically, that we have a sequence of computers with smaller and
736+
smaller $varepsilon$). We shall see below that we have to lower our
737+
aspirations depending on the condition number of <span class="math notranslate nohighlight">\(A\)</span>.</p>
736738
<div class="proof proof-type-definition" id="id21">
737739

738740
<div class="proof-title">
@@ -741,14 +743,12 @@ <h2><span class="section-number">3.9. </span>Stability<a class="headerlink" href
741743
<span class="proof-title-name">(Stability)</span>
742744

743745
</div><div class="proof-content">
744-
<p>An algorithm <span class="math notranslate nohighlight">\(\tilde{f}\)</span> for <span class="math notranslate nohighlight">\(f\)</span> is stable if for each <span class="math notranslate nohighlight">\(x\in X\)</span>,</p>
745-
<blockquote>
746-
<div><div class="math notranslate nohighlight">
747-
\[\frac{\|\tilde{f}(x)-f(\tilde{x})\|}{\|f(\tilde{x})\|} = \mathcal{O}(\varepsilon),\]</div>
748-
</div></blockquote>
749-
<p>there exists <span class="math notranslate nohighlight">\(\tilde{x}\)</span> with</p>
746+
<p>An algorithm <span class="math notranslate nohighlight">\(\tilde{f}\)</span> for <span class="math notranslate nohighlight">\(f\)</span> is stable if for each <span class="math notranslate nohighlight">\(x\in X\)</span>,
747+
there exists <span class="math notranslate nohighlight">\(\tilde{x}\)</span> with</p>
750748
<blockquote>
751749
<div><div class="math notranslate nohighlight">
750+
\[ \begin{align}\begin{aligned}\frac{\|\tilde{f}(x)-f(\tilde{x})\|}{\|f(\tilde{x})\|} = \mathcal{O}(\varepsilon),\\and\end{aligned}\end{align} \]</div>
751+
<div class="math notranslate nohighlight">
752752
\[\frac{\|\tilde{x}-x\|}{\|x\|} = \mathcal{O}(\varepsilon).\]</div>
753753
</div></blockquote>
754754
</div></div><p>We say that a stable algorithm gives nearly the right answer to nearly the

L5_eigenvalues.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ <h2><span class="section-number">5.4. </span>Rayleigh quotient<a class="headerli
499499
<li><p>Finding an eigenvector <span class="math notranslate nohighlight">\(v\)</span> of <span class="math notranslate nohighlight">\(A\)</span> with eigenvalue <span class="math notranslate nohighlight">\(\lambda\)</span> (you can use <a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.linalg.eig.html#numpy.linalg.eig" title="(in NumPy v1.23)"><code class="xref py py-func docutils literal notranslate"><span class="pre">numpy.linalg.eig()</span></code></a> for this),</p></li>
500500
<li><p>Choosing a perturbation vector <span class="math notranslate nohighlight">\(r\)</span>, and perturbation parameter <span class="math notranslate nohighlight">\(\epsilon&gt;0\)</span>,</p></li>
501501
<li><p>Comparing the Rayleigh quotient of <span class="math notranslate nohighlight">\(v + \epsilon r\)</span> with <span class="math notranslate nohighlight">\(\lambda\)</span>,</p></li>
502-
<li><p>Plotting (on a log-log graph, use <a class="reference external" href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.loglog.html#matplotlib.pyplot.loglog" title="(in Matplotlib v3.5.3)"><code class="xref py py-func docutils literal notranslate"><span class="pre">matplotlib.pyplot.loglog()</span></code></a>) the error in estimating the eigenvalue as a function of <span class="math notranslate nohighlight">\(\epsilon\)</span>.</p></li>
502+
<li><p>Plotting (on a log-log graph, use <a class="reference external" href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.loglog.html#matplotlib.pyplot.loglog" title="(in Matplotlib v3.6.0)"><code class="xref py py-func docutils literal notranslate"><span class="pre">matplotlib.pyplot.loglog()</span></code></a>) the error in estimating the eigenvalue as a function of <span class="math notranslate nohighlight">\(\epsilon\)</span>.</p></li>
503503
</ol>
504504
<p>The best way to do this is to plot the computed data values as points,
505505
and then superpose a line plot of <span class="math notranslate nohighlight">\(a\epsilon^k\)</span> for appropriate
@@ -773,7 +773,7 @@ <h2><span class="section-number">5.8. </span>The pure QR algorithm<a class="head
773773
<a class="reference internal" href="cla_utils.html#cla_utils.exercises9.get_B100" title="cla_utils.exercises9.get_B100"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises9.get_B100()</span></code></a>,
774774
<a class="reference internal" href="cla_utils.html#cla_utils.exercises9.get_C100" title="cla_utils.exercises9.get_C100"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises9.get_C100()</span></code></a>, and
775775
<a class="reference internal" href="cla_utils.html#cla_utils.exercises9.get_D100" title="cla_utils.exercises9.get_D100"><code class="xref py py-func docutils literal notranslate"><span class="pre">cla_utils.exercises9.get_D100()</span></code></a>. You can use
776-
<a class="reference external" href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pcolor.html#matplotlib.pyplot.pcolor" title="(in Matplotlib v3.5.3)"><code class="xref py py-func docutils literal notranslate"><span class="pre">matplotlib.pyplot.pcolor()</span></code></a> to visualise the entries,
776+
<a class="reference external" href="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.pcolor.html#matplotlib.pyplot.pcolor" title="(in Matplotlib v3.6.0)"><code class="xref py py-func docutils literal notranslate"><span class="pre">matplotlib.pyplot.pcolor()</span></code></a> to visualise the entries,
777777
or compute norms of the components of the matrices below the diagonal,
778778
for example. What do you observe? How does this relate to the structure
779779
of the four matrices?</p>

0 commit comments

Comments
 (0)