Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
williamgilpin committed Dec 27, 2023
1 parent f12d719 commit 8dddd56
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 255 deletions.
18 changes: 15 additions & 3 deletions talks/html_static/convex_optimization_univariate.html
Original file line number Diff line number Diff line change
Expand Up @@ -7475,7 +7475,19 @@
</style>
<!-- End of mermaid configuration --></head>
<body class="jp-Notebook" data-jp-theme-light="true" data-jp-theme-name="JupyterLab Light">
<main><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=9ee03d2d-906b-4dee-aee1-b48f2a17a887">
<main>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=cdf7e10b">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h1 id="Convex-Optimization">Convex Optimization<a class="anchor-link" href="#Convex-Optimization">¶</a></h1><p>Preamble: Run the cells below to import the necessary Python packages</p>
<p><em>This notebook created by William Gilpin. Consult the <a href="https://www.wgilpin.com/cphy">course website</a> for all content and <a href="https://github.com/williamgilpin/cphy">GitHub repository</a> for raw files and runnable online code.</em></p>
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=9ee03d2d-906b-4dee-aee1-b48f2a17a887">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
Expand All @@ -7500,7 +7512,7 @@
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h1 id="Convex-Optimization">Convex Optimization<a class="anchor-link" href="#Convex-Optimization">¶</a></h1><ul>
<h3 id="Optimization">Optimization<a class="anchor-link" href="#Optimization">¶</a></h3><ul>
<li>The cost function, fitness, or empirical risk is usually well-defined</li>
<li><ul>
<li>Error of a neural network on training data</li>
Expand Down Expand Up @@ -7662,7 +7674,7 @@ <h1 id="One-dimensional-optimization:-fixed-point-methods-and-rootfinding">One d
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=20a3e4c6">
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=2a50808d">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
Expand Down
2 changes: 1 addition & 1 deletion talks/html_static/fast_fourier.html
Original file line number Diff line number Diff line change
Expand Up @@ -8162,7 +8162,7 @@ <h3 id="A-symmetry-in-the-discrete-equations">A symmetry in the discrete equatio
$$
because $\exp[2\pi~i~n] = 1$ for all $n$. Using this property, we can derive the following symmetry
$$
X_{k + i \cdot N} = X_k
X_{k + N} = X_k
$$</p>
<p>We can now see that it's possible to divide our Fourier transform calculation into two parts by splitting the index $n$ into even and odd parts:
$$
Expand Down
5 changes: 2 additions & 3 deletions talks/html_static/first_passage_and_inheritance.html
Original file line number Diff line number Diff line change
Expand Up @@ -7482,9 +7482,8 @@
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h2 id="Imports-and-preamble">Imports and preamble<a class="anchor-link" href="#Imports-and-preamble">¶</a></h2><p>These are external libraries, including your own code stored in separate .py files, that you want to import in order to run the notebook. Since our notebook environment is running in Python, we don't need to import the language itself.</p>
<p>However, it's worth checking that you are using the right version of Python (usually Python 3)</p>
<p>For larger projects, you will want to use separate virtual environments for different projects. It's a good idea to double check your environment</p>
<h1 id="Python-Functions-and-Ornstein-Uhlenbeck-processes">Python Functions and Ornstein-Uhlenbeck processes<a class="anchor-link" href="#Python-Functions-and-Ornstein-Uhlenbeck-processes">¶</a></h1><p>Preamble: Run the cells below to import the necessary Python packages</p>
<p><em>This notebook created by William Gilpin. Consult the <a href="https://www.wgilpin.com/cphy">course website</a> for all content and <a href="https://github.com/williamgilpin/cphy">GitHub repository</a> for raw files and runnable online code.</em></p>
</div>
</div>
</div>
Expand Down
45 changes: 2 additions & 43 deletions talks/html_static/gmm_mle_em.html

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions talks/html_static/hyperbolic_pde.html
Original file line number Diff line number Diff line change
Expand Up @@ -7482,7 +7482,8 @@
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h2 id="Preamble">Preamble<a class="anchor-link" href="#Preamble">¶</a></h2><p>Import the necessary modules to run the notebook.</p>
<h1 id="Simulating-shockwaves-and-partial-differential-equations">Simulating shockwaves and partial differential equations<a class="anchor-link" href="#Simulating-shockwaves-and-partial-differential-equations">¶</a></h1><p>Preamble: Run the cells below to import the necessary Python packages</p>
<p><em>This notebook created by William Gilpin. Consult the <a href="https://www.wgilpin.com/cphy">course website</a> for all content and <a href="https://github.com/williamgilpin/cphy">GitHub repository</a> for raw files and runnable online code.</em></p>
</div>
</div>
</div>
Expand Down Expand Up @@ -7552,10 +7553,13 @@ <h2 id="Preamble">Preamble<a class="anchor-link" href="#Preamble">¶</a></h2><p>
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h2 id="Practical-approach:-ODEs-vs-PDEs">Practical approach: ODEs vs PDEs<a class="anchor-link" href="#Practical-approach:-ODEs-vs-PDEs">¶</a></h2><ul>
<li>ODEs you can usually get away with using built-in integration functions, unless you have a special type of equation (delay, integro-differential, etc.)</li>
<li>In my experience, you rarely have the same luck with PDEs. You usually have to write your own discretization and solver.</li>
<li>If you are solving a very common PDE (Navier Stokes, Laplace, etc.) there might be external libraries that work in certain regimes, or which can help with meshing, etc. But even in very restricted regimes, the design of these tools is expensive and narrow (using Ansys, COMSOL, etc. is a whole specialization in itself)</li>
<h2 id="ODEs-vs-PDEs">ODEs vs PDEs<a class="anchor-link" href="#ODEs-vs-PDEs">¶</a></h2><ul>
<li><p>For ODEs you can usually get away with using built-in integration functions, unless you have a special type of equation (delay, integro-differential, etc.)</p>
</li>
<li><p>In my experience, you rarely have the same luck with PDEs. You usually have to write your own discretization or solver.</p>
</li>
<li><p>If you are solving a very common PDE (Navier Stokes, Laplace, etc.) there might be external libraries that work in certain regimes, or which can help with meshing, etc. But even in very restricted regimes, the design of these tools is expensive and narrow (using Ansys, COMSOL, etc. is a whole specialization in itself)</p>
</li>
</ul>
<p>There are several types of PDEs, elliptical, hyperbolic, and parabolic.</p>
<table>
Expand Down Expand Up @@ -7609,7 +7613,7 @@ <h2 id="Practical-approach:-ODEs-vs-PDEs">Practical approach: ODEs vs PDEs<a cla
</div>
<div class="jp-InputArea jp-Cell-inputArea"><div class="jp-InputPrompt jp-InputArea-prompt">
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<p>Since PDEs are coupled ODEs, let's start by defining an ODE solver:</p>
<p>In order to demonstrate the connections between simulating ODEs and simulating ODES, we will first implement an ODE solver, simular to the ones in previous lectures.</p>
</div>
</div>
</div>
Expand Down
32 changes: 4 additions & 28 deletions talks/html_static/lu_decomposition.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion talks/html_static/optimization_multivariate.html
Original file line number Diff line number Diff line change
Expand Up @@ -10315,7 +10315,7 @@ <h2 id="Any-tricks-to-do-it-faster?">Any tricks to do it faster?<a class="anchor
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=19ff4e57">
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=962c9bda">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
Expand Down
28 changes: 9 additions & 19 deletions talks/html_static/svd_decomp.html
Original file line number Diff line number Diff line change
Expand Up @@ -7878,20 +7878,24 @@ <h2 id="What-am-I-leaving-out?">What am I leaving out?<a class="anchor-link" hre
</div><div class="jp-RenderedHTMLCommon jp-RenderedMarkdown jp-MarkdownOutput" data-mime-type="text/markdown">
<h2 id="What-about-non-square-matrices?-Singular-Value-Decomposition">What about non-square matrices? Singular Value Decomposition<a class="anchor-link" href="#What-about-non-square-matrices?-Singular-Value-Decomposition">¶</a></h2><ul>
<li><p>$A \in \mathbb R^{N \times M}$.</p>
</li>
<li><ul>
<ul>
<li>For example, if we have a video of a fluid flow or sensor readings, we might have $N$ frames from $M$ sensors/pixels</li>
</ul>
</li>
<li><p>$A$ can be overdetermined ($N &gt; M$) or underdetermined ($N &lt; M$).</p>
</li>
<li><p>However, we can instead calculate the eigenspectrum of the square matrices $A^\dagger A \in \mathbb R^{M \times M}$ or $A A^\dagger \in \mathbb R^{N \times N}$,</p>
<li><p>However, we can instead calculate the eigenspectrum of the square matrices $A^\dagger A \in \mathbb R^{M \times M}$ or $A A^\dagger \in \mathbb R^{N \times N}$. We refer to the eigenvectors as the "right" or "left" singular vectors, respectively, and their associated eigenvalues are called the singular values.</p>
<ul>
<li>Note: $A^\dagger A$ and $A A^\dagger$ share the same eigenvalues. Let $\mathbf{x}$ be an eigenvector of $A^\dagger A$ with corresponding eigenvalue $a$:
$$A^\dagger A \mathbf{x} = a \mathbf{x} \implies A A^\dagger A \mathbf{x} = a \mathbf{x}$$</li>
<li>Consequently, $a$ is also an eigenvalue of $A A^\dagger$ with corresponding eigenvector $A \mathbf{x}$.</li>
</ul>
</li>
<li><p>We refer to the eigenvectors as the "right" or "left" singular vectors, respectively, and their associated eigenvalues are called the singular values. $$ A = U \Sigma V^\dagger $$ where the columns of $U$ are the right singular vectors, the columns of $V$ are the left singular vectors, and $\Sigma$ is a square diagonal matrix with the eigenvalues along the diagonal. Since the eigenvalues and eigenvectors can be listed in any order, by convention we normally list the elements in descending order of eigenvalue magnitude.</p>
<li><p>We can now factorize $A$ as: $$ A = U \Sigma V^\dagger $$ where the columns of $U$ are the right singular vectors, the columns of $V$ are the left singular vectors, and $\Sigma$ is a square diagonal matrix. The non-zero entries of $\Sigma$ are the square roots of the non-zero eigenvalues of $A^\dagger A$ or $A A^\dagger$. Since the eigenvalues and eigenvectors can be listed in any order, by convention we normally list the elements in descending order of eigenvalue magnitude.</p>
</li>
<li><p>Decompose a dataset into characteristic directions in rowspace (left eigenvectors) and characteristic directions in columnspace (right eigenvectors)</p>
</li>
<li><p>Unlike traditional eigenvalue decomposition, SVD applies to non-square matrices</p>
<li><p>Unlike traditional eigenvalue decomposition, SVD applies to non-square matrices. We can also apply SVD to complex matrices!</p>
</li>
<li><p>Different interpretations: (1) Geometric, (2) Dynamical, (3) Data compression, pattern discovery</p>
</li>
Expand Down Expand Up @@ -7921,20 +7925,6 @@ <h2 id="What-about-non-square-matrices?-Singular-Value-Decomposition">What about
</div>
</div>
</div>
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs" id="cell-id=7bbaccf5">
<div class="jp-Cell-inputWrapper" tabindex="0">
<div class="jp-Collapser jp-InputCollapser jp-Cell-inputCollapser">
</div>
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In [ ]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="cm-editor cm-s-jupyter">
<div class="highlight hl-ipython3"><pre><span></span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<div class="jp-Cell jp-MarkdownCell jp-Notebook-cell" id="cell-id=b988cb74">
<div class="jp-Cell-inputWrapper" tabindex="0">
Expand Down
Loading

0 comments on commit 8dddd56

Please sign in to comment.