Content with notebooks#

You can also create content with Jupyter Notebooks. This means that you can include code blocks and their outputs in your book.

Markdown + notebooks#

As it is markdown, you can embed images, HTML, etc into your posts!

Satz: Mittelwertsatz

Some Content

Bemerkung

Hier ist eine Bemerkung

Definition

Eine Definition

Lemma

Inhalt

Warnung

Inhalt

Beispiel

Inhalt

You can also \(add_{math}\) and

\[ math^{blocks} \]

or

\[\begin{split} \begin{aligned} \mbox{mean} la_{tex} \\ \\ math blocks \end{aligned} \end{split}\]

But make sure you $Escape $your $dollar signs $you want to keep!

MyST markdown#

MyST markdown works in Jupyter Notebooks as well. For more information about MyST markdown, check out the MyST guide in Jupyter Book, or see the MyST markdown documentation.

Code blocks and outputs#

Jupyter Book will also embed your code blocks and output in your book. For example, here’s some sample Matplotlib code:

from matplotlib import rcParams, cycler
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
<contextlib.ExitStack at 0x717cdc07f170>
# Fixing random state for reproducibility
np.random.seed(19680801)

N = 10
data = [np.logspace(0, 1, 100) + np.random.randn(100) + ii for ii in range(N)]
data = np.array(data).T
cmap = plt.cm.coolwarm
rcParams['axes.prop_cycle'] = cycler(color=cmap(np.linspace(0, 1, N)))


from matplotlib.lines import Line2D
custom_lines = [Line2D([0], [0], color=cmap(0.), lw=4),
                Line2D([0], [0], color=cmap(.5), lw=4),
                Line2D([0], [0], color=cmap(1.), lw=4)]

fig, ax = plt.subplots(figsize=(10, 5))
lines = ax.plot(data)
ax.legend(custom_lines, ['Cold', 'Medium', 'Hot']);
../_images/cefbdee9d4d9534f9d0e2dd4b010de5710848a972bd31d1a9a8f407309bfdae1.png

Proof. We’ll omit the full proof.

But we will prove sufficiency of the asserted conditions.

To this end, let \(y \in \mathbb R^n\) and let \(S\) be a linear subspace of \(\mathbb R^n\).

Let \(\hat y\) be a vector in \(\mathbb R^n\) such that \(\hat y \in S\) and \(y - \hat y \perp S\).

Let \(z\) be any other point in \(S\) and use the fact that \(S\) is a linear subspace to deduce

\[\| y - z \|^2 = \| (y - \hat y) + (\hat y - z) \|^2 = \| y - \hat y \|^2 + \| \hat y - z \|^2\]

Hence \(\| y - z \| \geq \| y - \hat y \|\), which completes the proof.

There is a lot more that you can do with outputs (such as including interactive outputs) with your book. For more information about this, see the Jupyter Book documentation

Definition 1

The economical expansion problem (EEP) for \((A,B)\) is to find a semi-positive \(n\)-vector \(p>0\) and a number \(\beta\in\mathbb{R}\), such that

\[\begin{split} &\min_{\beta} \hspace{2mm} \beta \\ &\text{s.t. }\hspace{2mm}Bp \leq \beta Ap \end{split}\]

Bemerkung

Here is a note

This admonition was styled…

With a tip class!