summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/know/concept/convolution-theorem/index.pdc2
-rw-r--r--content/know/concept/dirac-delta-function/index.pdc2
-rw-r--r--content/know/concept/parsevals-theorem/index.pdc15
-rw-r--r--content/know/concept/repetition-code/bit-flip-detect.pngbin0 -> 22335 bytes
-rw-r--r--content/know/concept/repetition-code/bit-flip-encode.pngbin0 -> 11662 bytes
-rw-r--r--content/know/concept/repetition-code/index.pdc349
-rw-r--r--content/know/concept/repetition-code/phase-flip-detect.pngbin0 -> 30334 bytes
-rw-r--r--content/know/concept/repetition-code/phase-flip-encode.pngbin0 -> 14945 bytes
-rw-r--r--content/know/concept/repetition-code/shor-code-encode.pngbin0 -> 37994 bytes
-rw-r--r--content/know/concept/reynolds-number/index.pdc11
-rw-r--r--content/know/concept/shors-algorithm/index.pdc2
-rw-r--r--content/know/concept/stokes-law/index.pdc371
-rw-r--r--sources/know/concept/repetition-code/circuit.tex186
-rw-r--r--static/main.css1
14 files changed, 925 insertions, 14 deletions
diff --git a/content/know/concept/convolution-theorem/index.pdc b/content/know/concept/convolution-theorem/index.pdc
index fc96f30..86543d8 100644
--- a/content/know/concept/convolution-theorem/index.pdc
+++ b/content/know/concept/convolution-theorem/index.pdc
@@ -68,7 +68,7 @@ $$\begin{aligned}
\boxed{(f * g)(t) = \hat{\mathcal{L}}^{-1}\{\tilde{f}(s) \: \tilde{g}(s)\}}
\end{aligned}$$
-Because the inverse Laplace transform $\hat{\mathcal{L}}^{-1}$ is quite
+Because the inverse Laplace transform $\hat{\mathcal{L}}^{-1}$ is
unpleasant, the theorem is often stated using the forward transform
instead:
diff --git a/content/know/concept/dirac-delta-function/index.pdc b/content/know/concept/dirac-delta-function/index.pdc
index 6c9f2b0..97704d7 100644
--- a/content/know/concept/dirac-delta-function/index.pdc
+++ b/content/know/concept/dirac-delta-function/index.pdc
@@ -40,7 +40,7 @@ $$\begin{aligned}
}
\end{aligned}$$
-$\delta(x)$ is thus an effective weapon against integrals. This may not seem very
+$\delta(x)$ is thus quite an effective weapon against integrals. This may not seem very
useful due to its "unnatural" definition, but in fact it appears as the
limit of several reasonable functions:
diff --git a/content/know/concept/parsevals-theorem/index.pdc b/content/know/concept/parsevals-theorem/index.pdc
index 8f653f8..ae34bda 100644
--- a/content/know/concept/parsevals-theorem/index.pdc
+++ b/content/know/concept/parsevals-theorem/index.pdc
@@ -13,8 +13,8 @@ markup: pandoc
# Parseval's theorem
-**Parseval's theorem** relates the inner product of two functions $f(x)$ and $g(x)$ to the
-inner product of their [Fourier transforms](/know/concept/fourier-transform/)
+**Parseval's theorem** is a relation between the inner product of two functions $f(x)$ and $g(x)$,
+and the inner product of their [Fourier transforms](/know/concept/fourier-transform/)
$\tilde{f}(k)$ and $\tilde{g}(k)$.
There are two equivalent ways of stating it,
where $A$, $B$, and $s$ are constants from the Fourier transform's definition:
@@ -29,12 +29,11 @@ $$\begin{aligned}
}
\end{aligned}$$
-For this reason, physicists like to define their Fourier transform
-with $A = B = 1 / \sqrt{2\pi}$ and $|s| = 1$, because then the FT nicely
-conserves the total probability (quantum mechanics) or the total energy
-(optics).
+For this reason, physicists like to define the Fourier transform
+with $A\!=\!B\!=\!1 / \sqrt{2\pi}$ and $|s|\!=\!1$, because then it nicely
+conserves the functions' normalization.
-To prove this, we insert the inverse FT into the inner product
+To prove the theorem, we insert the inverse FT into the inner product
definition:
$$\begin{aligned}
@@ -55,7 +54,7 @@ $$\begin{aligned}
\end{aligned}$$
Where $\delta(k)$ is the [Dirac delta function](/know/concept/dirac-delta-function/).
-Note that we can just as well do it in the opposite direction,
+Note that we can equally well do the proof in the opposite direction,
which yields an equivalent result:
$$\begin{aligned}
diff --git a/content/know/concept/repetition-code/bit-flip-detect.png b/content/know/concept/repetition-code/bit-flip-detect.png
new file mode 100644
index 0000000..0532421
--- /dev/null
+++ b/content/know/concept/repetition-code/bit-flip-detect.png
Binary files differ
diff --git a/content/know/concept/repetition-code/bit-flip-encode.png b/content/know/concept/repetition-code/bit-flip-encode.png
new file mode 100644
index 0000000..7c78667
--- /dev/null
+++ b/content/know/concept/repetition-code/bit-flip-encode.png
Binary files differ
diff --git a/content/know/concept/repetition-code/index.pdc b/content/know/concept/repetition-code/index.pdc
new file mode 100644
index 0000000..7245cbc
--- /dev/null
+++ b/content/know/concept/repetition-code/index.pdc
@@ -0,0 +1,349 @@
+---
+title: "Repetition code"
+firstLetter: "R"
+publishDate: 2021-05-07
+categories:
+- Quantum information
+
+date: 2021-05-07T15:10:43+02:00
+draft: false
+markup: pandoc
+---
+
+# Repetition code
+
+A **repetition code** is a simple approach to error correction:
+to protect a bit $x$, make two copies:
+
+$$\begin{aligned}
+ 0 \to 000
+ \qquad \quad
+ 1 \to 111
+\end{aligned}$$
+
+If a single-bit error occurs, e.g. $000 \to 100$,
+a majority vote resets the minority bit.
+Clearly, this does not protect against multi-bit errors,
+but that is usually not necessary.
+
+In quantum computing, where error correction is much more important,
+repetition codes can also be used,
+albeit with some complications,
+as discussed below.
+
+
+## Bit flip code
+
+Suppose that we want to detect errors in
+the following arbitrary qubit state $\ket{\psi}$:
+
+$$\begin{aligned}
+ \ket{\psi}
+ = \alpha \ket{0} + \beta \ket{1}
+\end{aligned}$$
+
+For now, let us limit ourselves to detecting **bit flips**,
+where $\alpha$ and $\beta$ get switched:
+
+$$\begin{aligned}
+ \alpha \ket{0} + \beta \ket{1}
+ \quad \to \boxed{\mathrm{Error}} \to \quad
+ \beta \ket{0} \!+\! \alpha \ket{1}
+\end{aligned}$$
+
+One way to defend against this is
+the quantum version of a classical repetition code:
+
+$$\begin{aligned}
+ \ket{\psi}
+ \quad \to \boxed{\mathrm{Encoder}} \to \quad
+ \ket*{\overline{\psi}}
+ = \alpha \ket{000} + \beta \ket{111}
+\end{aligned}$$
+
+In other words, a *logical* $\ket{0}$ (written $\ket*{\overline{0}}$)
+is represented by 3 *physical* qubits, and vice versa:
+
+$$\begin{aligned}
+ \boxed{
+ \ket{0}
+ \to
+ \ket*{\overline{0}}
+ = \ket{000}
+ \qquad \quad
+ \ket{1}
+ \to
+ \ket*{\overline{1}}
+ = \ket{111}
+ }
+\end{aligned}$$
+
+Such a transformation is easy to achieve with the following sequence
+of [quantum gates](/know/concept/quantum-gate/):
+
+<a href="bit-flip-encode.png">
+<img src="bit-flip-encode.png" style="width:32%;display:block;margin:auto;">
+</a>
+
+So, a little while after encoding the state $\ket{\psi}$ like that,
+a bit flip occurs on the 2nd qubit:
+
+$$\begin{aligned}
+ \ket*{\overline{\psi}}
+ \quad \to \boxed{\mathrm{Error}} \to \quad
+ \alpha \ket{010} + \beta \ket{101}
+\end{aligned}$$
+
+But now there is a problem: how do we detect this error?
+We could measure the state, but that would make it collapse,
+which is probably not what we want.
+
+The trick is to use operators called **stabilizers**,
+in this case for example $ZZI = Z_1 \otimes Z_2 \otimes I_3$,
+where $I$ is identity and $Z$ is the Pauli-$Z$ gate.
+The 3-qubit basis states are its eigenvectors:
+
+$$\begin{alignedat}{2}
+ ZZI \ket{000}
+ &= + \ket{000}
+ \qquad
+ ZZI \ket{001}
+ &&= + \ket{001}
+ \\
+ ZZI \ket{010}
+ &= - \ket{010}
+ \qquad
+ ZZI \ket{011}
+ &&= - \ket{011}
+ \\
+ ZZI \ket{100}
+ &= - \ket{100}
+ \qquad
+ ZZI \ket{101}
+ &&= - \ket{101}
+ \\
+ ZZI \ket{110}
+ &= + \ket{110}
+ \qquad
+ ZZI \ket{111}
+ &&= + \ket{111}
+\end{alignedat}$$
+
+We could measure $ZZI$ for $\ket*{\overline{\psi}}$,
+and if the eigenvalue is $-1$,
+we know that a bit flip has occurred,
+whereas if the eigenvalue is $+1$,
+there is *maybe* no error ($\ket{001}$ and $\ket{110}$ are false negatives).
+
+These false negatives are fixed by including another stabilizer $IZZ$,
+with these eigenvectors:
+
+$$\begin{alignedat}{2}
+ IZZ \ket{000}
+ &= + \ket{000}
+ \qquad
+ IZZ \ket{001}
+ &&= - \ket{001}
+ \\
+ IZZ \ket{010}
+ &= - \ket{010}
+ \qquad
+ IZZ \ket{011}
+ &&= + \ket{011}
+ \\
+ IZZ \ket{100}
+ &= + \ket{100}
+ \qquad
+ IZZ \ket{101}
+ &&= - \ket{101}
+ \\
+ IZZ \ket{110}
+ &= - \ket{110}
+ \qquad
+ IZZ \ket{111}
+ &&= + \ket{111}
+\end{alignedat}$$
+
+In which case $\ket{100}$ and $\ket{011}$ are false negatives.
+In other words, $IZZ$ cannot detect if the 1st qubit was flipped,
+while $ZZI$ cannot protect the 3rd qubit.
+But by using both, we know exactly which qubit was flipped
+thanks to the eigenvalues:
+
+<table style="width:30%;margin:auto;text-align:center;">
+ <tr>
+ <th>Error</th>
+ <th>$ZZI$</th>
+ <th>$IZZ$</th>
+ </tr>
+ <tr>
+ <td>$I$</td>
+ <td>$+1$</td>
+ <td>$+1$</td>
+ </tr>
+ <tr>
+ <td>$X_1$</td>
+ <td>$-1$</td>
+ <td>$+1$</td>
+ </tr>
+ <tr>
+ <td>$X_2$</td>
+ <td>$-1$</td>
+ <td>$-1$</td>
+ </tr>
+ <tr>
+ <td>$X_1$</td>
+ <td>$+1$</td>
+ <td>$-1$</td>
+ </tr>
+</table>
+
+Where e.g. $X_3$ denotes that the 3rd qubit was flipped.
+The measurement outcomes on the last three rows are called **error syndromes**,
+and are obtained by a **syndrome measurement**.
+
+Fortunately, we can measure $ZZI$ and $IZZ$
+without affecting $\ket*{\overline{\psi}}$ itself,
+by applying $\mathrm{CNOT}$s to some ancillary qubits
+and then measuring those:
+
+<a href="bit-flip-detect.png">
+<img src="bit-flip-detect.png" style="width:62%;display:block;margin:auto;">
+</a>
+
+The two measurements, respectively representing $ZZI$ and $IZZ$,
+yield $\ket{1}$ if a bit flip definitely occurred,
+and $\ket{0}$ otherwise.
+There is no entanglement,
+so the input is untouched.
+
+
+## Phase flip code
+
+The above system protects us against all single-qubit bit flips.
+Unfortunately, that is not enough:
+qubits can also experience a **phase flip**:
+
+$$\begin{aligned}
+ \alpha \ket{0} + \beta \ket{1}
+ \quad \to \boxed{\mathrm{Error}} \to \quad
+ \alpha \ket{0} - \beta \ket{1}
+\end{aligned}$$
+
+How to detect that?
+If we want to protect against phase flips *instead of* bit flips,
+we can simply do the same as before,
+but along the $X$-axis intead of the $Z$-axis:
+
+$$\begin{aligned}
+ \boxed{
+ \ket{0}
+ \to
+ \ket*{\overline{0}}
+ = \ket{+\!+\!+}
+ \qquad \quad
+ \ket{1}
+ \to
+ \ket*{\overline{1}}
+ = \ket{-\!-\!-}
+ }
+\end{aligned}$$
+
+Such that an arbitrary state $\ket{\psi}$ is encoded as follows,
+by the circuit shown below:
+
+$$\begin{aligned}
+ \ket{\psi}
+ \quad \to \boxed{\mathrm{Encoder}} \to \quad
+ \ket*{\overline{\psi}}
+ = \alpha \ket{+\!+\!+} + \beta \ket{-\!-\!-}
+\end{aligned}$$
+
+<a href="phase-flip-encode.png">
+<img src="phase-flip-encode.png" style="width:40%;display:block;margin:auto;">
+</a>
+
+A phase flip along the $Z$-axis
+corresponds to a bit flip along the $X$-axis $\ket{+} \to \ket{-}$.
+In this case, the stabilizers are $XXI$ and $IXX$,
+and the error detection circuit is as follows:
+
+<a href="phase-flip-detect.png">
+<img src="phase-flip-detect.png" style="width:70%;display:block;margin:auto;">
+</a>
+
+This system protects us against all single-qubit phase flips,
+but not against bit flips.
+
+
+## Shor code
+
+What kind of repetition code would we need
+if we want to detect both bit flips *and* phase flips?
+The most straightforward option is the **Shor code**.
+Starting from a phase flip encoding:
+
+$$\begin{aligned}
+ \ket{0} \to
+ \ket*{\overline{0}}
+ &= \ket{+\!+\!+}
+ = \bigg( \frac{\ket{0} + \ket{1}}{\sqrt{2}} \bigg)^{\otimes 3}
+ \\
+ \ket{1} \to
+ \ket*{\overline{1}}
+ &= \ket{-\!-\!-}
+ = \bigg( \frac{\ket{0} - \ket{1}}{\sqrt{2}} \bigg)^{\otimes 3}
+\end{aligned}$$
+
+We add protection against bit flips
+by using a repetition code for each physical qubit:
+
+$$\begin{aligned}
+ \boxed{
+ \ket*{\overline{0}}
+ = \bigg( \frac{\ket{000} + \ket{111}}{\sqrt{2}} \bigg)^{\otimes 3}
+ \qquad \quad
+ \ket*{\overline{1}}
+ = \bigg( \frac{\ket{000} - \ket{111}}{\sqrt{2}} \bigg)^{\otimes 3}
+ }
+\end{aligned}$$
+
+This encoding is achieved by the following quantum circuit,
+which simply consists of the phase flip encoder,
+followed by 3 copies of the bit flip encoder:
+
+<a href="shor-code-encode.png">
+<img src="shor-code-encode.png" style="width:55%;display:block;margin:auto;">
+</a>
+
+We thus use 9 physical qubits to store 1 logical qubit.
+Fortunately, more efficient schemes exist.
+
+The bit flip stabilizers $ZZI$ and $IZZ$
+are applied on a per-block basis, like so:
+
+$$\begin{aligned}
+ ZZI \: III \: III \qquad\quad III \: ZZI \: III \qquad\quad III \: III \: ZZI
+ \\
+ IZZ \: III \: III \qquad\quad III \: IZZ \: III \qquad\quad III \: III \: IZZ
+\end{aligned}$$
+
+Whereas the phase flip stabilizers $XXI$ and $IXX$
+are applied to entire blocks at once:
+
+$$\begin{aligned}
+ XXX \: XXX \: III
+ \qquad \quad
+ III \: XXX \: XXX
+\end{aligned}$$
+
+
+
+## References
+1. J.S. Neergaard-Nielsen,
+ *Quantum information: lectures notes*,
+ 2021, unpublished.
+2. S. Aaronson,
+ *Introduction to quantum information science: lecture notes*,
+ 2018, unpublished.
+
diff --git a/content/know/concept/repetition-code/phase-flip-detect.png b/content/know/concept/repetition-code/phase-flip-detect.png
new file mode 100644
index 0000000..fe0243b
--- /dev/null
+++ b/content/know/concept/repetition-code/phase-flip-detect.png
Binary files differ
diff --git a/content/know/concept/repetition-code/phase-flip-encode.png b/content/know/concept/repetition-code/phase-flip-encode.png
new file mode 100644
index 0000000..04de8ce
--- /dev/null
+++ b/content/know/concept/repetition-code/phase-flip-encode.png
Binary files differ
diff --git a/content/know/concept/repetition-code/shor-code-encode.png b/content/know/concept/repetition-code/shor-code-encode.png
new file mode 100644
index 0000000..ab1a01e
--- /dev/null
+++ b/content/know/concept/repetition-code/shor-code-encode.png
Binary files differ
diff --git a/content/know/concept/reynolds-number/index.pdc b/content/know/concept/reynolds-number/index.pdc
index bd18f2f..ff5e793 100644
--- a/content/know/concept/reynolds-number/index.pdc
+++ b/content/know/concept/reynolds-number/index.pdc
@@ -25,6 +25,12 @@ $$\begin{aligned}
= - \frac{\nabla p}{\rho} + \nu \nabla^2 \va{v}
\end{aligned}$$
+In this case, the gravity term $\va{g}$
+has been absorbed into the pressure term:
+$p \to p\!+\!\rho \Phi$,
+where $\Phi$ is the gravitational scalar potential,
+i.e. $\va{g} = - \nabla \Phi$.
+
Let us introduce the dimensionless variables $\va{v}'$, $\va{r}'$, $t'$ and $p'$,
where $U$ and $L$ are respectively a characteristic velocity and length
of the system at hand:
@@ -108,7 +114,7 @@ such that redimensionalizing yields:
$$\begin{aligned}
\pdv{\va{v}}{t} + (\va{v} \cdot \nabla) \va{v}
- = - \nabla p
+ = - \frac{\nabla p}{\rho}
\end{aligned}$$
Which is simply the main [Euler equation](/know/concept/euler-equations/)
@@ -133,7 +139,8 @@ $$\begin{aligned}
This equation is called the **unsteady Stokes equation**.
Usually, however, such flows are assumed to be steady
-(i.e. time-invariant), leading to the **steady Stokes equation**:
+(i.e. time-invariant), leading to the **steady Stokes equation**,
+with $\eta = \rho \nu$:
$$\begin{aligned}
\boxed{
diff --git a/content/know/concept/shors-algorithm/index.pdc b/content/know/concept/shors-algorithm/index.pdc
index 0700408..3e3c05a 100644
--- a/content/know/concept/shors-algorithm/index.pdc
+++ b/content/know/concept/shors-algorithm/index.pdc
@@ -243,7 +243,7 @@ which is $\mathcal{O}(q^2 (\log{q}) \log{\log{q}})$
and therefore worse than the QFT,
yielding a total complexity of $\mathcal{O}(q^2 (\log{q})^2 \log{\log{q}})$.
-OK, but what does $s$ have to do factorizing integers?
+OK, but what does $s$ have to do with factorizing integers?
Well, recall that $f$ is given by:
$$\begin{aligned}
diff --git a/content/know/concept/stokes-law/index.pdc b/content/know/concept/stokes-law/index.pdc
new file mode 100644
index 0000000..acc98af
--- /dev/null
+++ b/content/know/concept/stokes-law/index.pdc
@@ -0,0 +1,371 @@
+---
+title: "Stokes' law"
+firstLetter: "S"
+publishDate: 2021-05-04
+categories:
+- Physics
+- Fluid mechanics
+- Fluid dynamics
+
+date: 2021-05-04T19:28:30+02:00
+draft: false
+markup: pandoc
+---
+
+# Stokes' law
+
+**Stokes' law** describes the size of the drag force $D$
+at low [Reynolds number](/know/concept/reynolds-number/) $\mathrm{Re} \ll 1$
+experienced by a spherical object in a steady, uniform flow at velocity $U$.
+
+
+## Flow field
+
+Imagine a sphere with radius $a$ sinking in a viscous liquid.
+To model this situation, let us pretend that the sphere is fixed instead,
+and the fluid comes from infinity at velocity $U$ along the $z$-axis,
+flows past the sphere, and continues to infinity at the same $U$.
+The Reynolds number is:
+
+$$\begin{aligned}
+ \mathrm{Re}
+ = \frac{2 a U}{\nu}
+\end{aligned}$$
+
+We assume that $\mathrm{Re} \ll 1$, in which case
+the incompressible [Navier-Stokes equations](/know/concept/navier-stokes-equations/)
+are reduced to the **steady Stokes equations**:
+
+$$\begin{aligned}
+ \nabla p
+ = \eta \nabla^2 \va{v}
+ \qquad \quad
+ \nabla \cdot \va{v}
+ = 0
+\end{aligned}$$
+
+The goal is to solve for $p$ and $\va{v}$.
+We make the following ansatz in
+[spherical coordinates](/know/concept/spherical-coordinates/) $(r, \theta, \phi)$,
+where $q(r)$, $f(r)$ and $g(r)$ are unknown functions:
+
+$$\begin{gathered}
+ p
+ = \eta U q(r) \cos\theta
+ \\
+ v_r
+ = U f(r) \cos\theta
+ \qquad
+ v_\theta
+ = - U g(r) \sin\theta
+ \qquad
+ v_\phi
+ = 0
+\end{gathered}$$
+
+The fluid hits the sphere head on,
+so the solution is taken to be $\phi$-independent due to symmetry.
+Note that $\theta$ is the angle to the positive $z$-axis,
+which is the direction of $\va{U} = U \vu{e}_z$.
+Moreover, note that $\va{U} \cdot \vu{e}_r = U \cos\theta$
+and $\va{U} \cdot \vu{e}_\theta = - U \sin\theta$,
+where $\vu{e}_r$ and $\vu{e}_\theta$ are basis vectors.
+
+To begin with, we insert this ansatz into the incompressibility condition,
+yielding:
+
+$$\begin{aligned}
+ 0
+ = \nabla \cdot \va{v}
+ &= \pdv{v_r}{r} + \frac{1}{r} \pdv{v_\theta}{\theta} + \frac{2 v_r}{r} + \frac{v_\theta}{r \tan \theta}
+ \\
+ &= U \dv{f}{r} \cos\theta - \frac{U g}{r} \cos\theta + \frac{2 U f}{r} \cos\theta - \frac{U g}{r} \cos\theta
+ \\
+ &= U \cos\theta \Big( \dv{f}{r} + \frac{2}{r} f - \frac{2}{r} g \Big)
+\end{aligned}$$
+
+The parenthesized expression must be zero for all $r$,
+leading us to the following relation:
+
+$$\begin{aligned}
+ g(r)
+ = f + \frac{r}{2} \dv{f}{r}
+\end{aligned}$$
+
+Next, we take the divergence of the first Stokes equation,
+and insert incompressibility:
+
+$$\begin{aligned}
+ \nabla^2 p
+ = \eta \nabla \cdot (\nabla^2 \va{v})
+ = \eta \nabla^2 (\nabla \cdot \va{v})
+ = 0
+\end{aligned}$$
+
+This is simply the Laplace equation,
+which is as follows for our ansatz $p(r, \theta)$:
+
+$$\begin{aligned}
+ 0
+ = \nabla^2 p
+ &= \frac{1}{r^2} \pdv{r} \Big( r^2 \pdv{p}{r} \Big) + \frac{1}{r^2 \sin\theta} \pdv{\theta} \Big( \sin\theta \pdv{p}{\theta} \Big)
+ \\
+ 0
+ &= \frac{\eta U \cos\theta}{r^2} \dv{r} \Big( r^2 \dv{q}{r} \Big)
+ - \frac{\eta U q}{r^2 \sin\theta} \pdv{\theta} \Big( \sin^2\theta \Big)
+ \\
+ &= \frac{\eta U \cos\theta}{r^2} \dv{r} \Big( r^2 \dv{q}{r} \Big)
+ - \frac{2 \eta U q}{r^2 \sin\theta} \sin\theta \cos\theta
+ \\
+ &= \eta U \cos\theta \Big( \dv[2]{q}{r} + \frac{2}{r} \dv{q}{r} - \frac{2}{r^2} q \Big)
+\end{aligned}$$
+
+Again, the parenthesized expression must be zero for all $r$,
+meaning it is an ODE for $q(r)$,
+whose solution is straightforwardly found to be:
+
+$$\begin{aligned}
+ q(r)
+ = \frac{C_3}{r^2} + C_4 r
+\end{aligned}$$
+
+Where $C_3$ and $C_4$ are linearity constants ($C_1$ and $C_2$ appear later).
+The pressure is therefore:
+
+$$\begin{aligned}
+ p
+ = \eta U \cos\theta \Big( \frac{C_3}{r^2} + C_4 r \Big)
+\end{aligned}$$
+
+Consequently, its gradient $\nabla p$ in spherical coordinates is as follows:
+
+$$\begin{aligned}
+ \nabla p
+ = \vu{e}_r \pdv{p}{r} + \vu{e}_\theta \frac{1}{r} \pdv{p}{\theta}
+ = \vu{e}_r \Big( \eta U \cos\theta \dv{q}{r} \Big) - \vu{e}_\theta \Big( \eta U \sin\theta \frac{q}{r} \Big)
+\end{aligned}$$
+
+According to the Stokes equation, this equals $\eta \nabla^2 \va{v}$.
+Let us look at the $r$-component of $\nabla^2 \va{v}$:
+
+$$\begin{aligned}
+ (\nabla^2 \va{v})_r
+ &= \pdv[2]{v_r}{r} + \frac{1}{r^2} \pdv[2]{v_r}{\theta} + \frac{2}{r} \pdv{v_r}{r}
+ + \frac{\cot\theta}{r^2} \pdv{v_r}{\theta} - \frac{2}{r^2} \pdv{v_\theta}{\theta} - \frac{2}{r^2} v_r - \frac{2 \cot\theta}{r^2} v_\theta
+ \\
+ &= U \cos\theta \Big( \dv[2]{f}{r} - \frac{1}{r^2} f + \frac{2}{r} \dv{f}{r} - \frac{1}{r^2} f
+ + \frac{2}{r^2} g - \frac{2}{r^2} f + \frac{2}{r^2} g \Big)
+ \\
+ &= U \cos\theta \Big( \dv[2]{f}{r} + \frac{2}{r} \dv{f}{r} - \frac{4}{r^2} f + \frac{4}{r^2} g \Big)
+\end{aligned}$$
+
+Substituting $g$ for the expression we found from incompressibility lets us simplify this:
+
+$$\begin{aligned}
+ \eta (\nabla^2 \va{v})_r
+ &= \eta U \cos\theta \Big( \dv[2]{f}{r} + \frac{4}{r} \dv{f}{r} \Big)
+\end{aligned}$$
+
+The Stokes equation says that this must be equal to the $r$-component of $\nabla p$:
+
+$$\begin{aligned}
+ \eta U \cos\theta \Big( \dv[2]{f}{r} + \frac{4}{r} \dv{f}{r} \Big)
+ = \eta U \cos\theta \Big( \!-\! \frac{2 C_3}{r^3} + C_4 \Big)
+\end{aligned}$$
+
+Where we have inserted $\dv*{q}{r}$.
+Dividing out $\eta U \cos\theta$ leaves an ODE for $f(r)$,
+satisfied by:
+
+$$\begin{aligned}
+ f(r)
+ = C_1 + \frac{C_2}{r^3} + \frac{C_3}{r} + \frac{C_4 r^2}{10}
+\end{aligned}$$
+
+Then, thanks to our earlier relation again,
+we know that $g(r)$ is as follows:
+
+$$\begin{aligned}
+ g(r)
+ = C_1 - \frac{C_2}{2 r^3} + \frac{C_3}{2 r} + \frac{C_4 r^2}{5}
+\end{aligned}$$
+
+So what about $C_1$, $C_2$, $C_3$ and $C_4$?
+For $r\!\to\!\infty$, we expect that $\va{v}\!\to\!\va{U}$,
+meaning that $f(r)\!\to\!1$ and $g(r)\!\to\!1$.
+This implies that $C_4 = 0$ and $C_1 = 1$, leaving:
+
+$$\begin{aligned}
+ f(r)
+ = 1 + \frac{C_2}{r^3} + \frac{C_3}{r}
+ \qquad \quad
+ g(r)
+ = 1 - \frac{C_2}{2 r^3} + \frac{C_3}{2 r}
+\end{aligned}$$
+
+Furthermore, the viscous *no-slip* condition demands
+that $\va{v} = 0$ at the sphere's surface $r = a$, so $f(a) = g(a) = 0$ there.
+Inserting $a$ into $f$ and $g$, setting them to zero,
+and solving the resulting system of equations
+yields $C_2 = a^3 / 2$ and $C_3 = -3 a / 2$.
+Therefore the full solution is:
+
+$$\begin{gathered}
+ \boxed{
+ p
+ = - \frac{3 \eta U a}{2 r^2} \cos\theta
+ }
+ \\
+ \boxed{
+ v_r
+ = U \cos\theta \Big( 1 + \frac{a^3}{2 r^3} - \frac{3 a}{2 r} \Big)
+ \qquad
+ v_\theta
+ = - U \sin\theta \Big( 1 - \frac{a^3}{4 r^3} - \frac{3 a}{4 r} \Big)
+ }
+\end{gathered}$$
+
+
+## Drag force
+
+From the definition of [viscosity](/know/concept/viscosity/),
+we know that there must be shear stresses at the sphere surface,
+described by the fluid's [Cauchy stress tensor](/know/concept/cauchy-stress-tensor/) $\hat{\sigma}$.
+The drag force $\va{D}$ on the surface is:
+
+$$\begin{aligned}
+ \va{D}
+ = \oint \hat{\sigma} \cdot \dd{\va{S}}
+ = \int_0^{2\pi} \!\!\!\! \int_0^\pi \big( \hat{\sigma} \cdot \vu{e}_r \big) \:a^2 \sin\theta \dd{\theta} \dd{\phi}
+\end{aligned}$$
+
+Where $\vu{e}_r$ is the sphere's surface normal vector.
+The integrand can be expanded as follows:
+
+$$\begin{aligned}
+ \hat{\sigma} \cdot \vu{e}_r
+ = \vu{e}_r \sigma_{rr} + \vu{e}_\theta \sigma_{\theta r}
+\end{aligned}$$
+
+To calculate this, we start by taking the gradient of the velocity field $\va{v}$:
+
+$$\begin{aligned}
+ \nabla\va{v}
+ &= \vu{e}_r \vu{e}_r \pdv{v_r}{r} + \vu{e}_r \vu{e}_\theta \pdv{v_\theta}{r}
+ + \vu{e}_\theta \vu{e}_r \Big( \frac{1}{r} \pdv{v_r}{\theta} - \frac{v_\theta}{r} \Big)
+ \\
+ &\qquad + \vu{e}_\theta \vu{e}_\theta \Big( \frac{1}{r} \pdv{v_\theta}{\theta} - \frac{v_r}{r} \Big)
+ + \vu{e}_\phi \vu{e}_\phi \Big( \frac{v_\theta}{r \tan\theta} + \frac{v_r}{r} \Big)
+\end{aligned}$$
+
+Some of these terms are necessary to calculate the stress elements $\sigma_{rr}$ and $\sigma_{\theta r}$:
+
+$$\begin{aligned}
+ \sigma_{rr}
+ &= - p + 2 \eta (\nabla\va{v})_{rr}
+ = - p + 2 \eta \pdv{v_r}{r}
+ \\
+ &= \frac{3 \eta U a}{2 r^2} \cos\theta + 2 \eta U \cos\theta \: \Big( \!-\! \frac{3 a^3}{2 r^4} + \frac{3 a}{2 r^2} \Big)
+ \\
+ &= \frac{3 \eta U a}{2 r^2} \cos\theta \: \Big( 3 - 2 \frac{a^2}{r^2} \Big)
+\end{aligned}$$
+$$\begin{aligned}
+ \sigma_{\theta r}
+ &= \eta \big( (\nabla\va{v})_{\theta r} + (\nabla\va{v})_{r \theta} \big)
+ = \eta \: \Big( \pdv{v_\theta}{r} + \frac{1}{r} \pdv{v_r}{\theta} - \frac{v_\theta}{r} \Big)
+ \\
+ &= \eta U \sin\theta \: \Big( \!-\! \frac{3 a^3}{4 r^4} - \frac{3 a}{4 r^2}
+ - \frac{1}{r} - \frac{a^3}{2 r^4} + \frac{3 a}{2 r^2}
+ + \frac{1}{r} - \frac{a^3}{4 r^4} - \frac{3 a}{4 r^2} \Big)
+ \\
+ &= - \frac{3 \eta U a^3}{2 r^4} \sin\theta
+\end{aligned}$$
+
+At the sphere's surface we set $r = a$, so these expressions reduce to the following:
+
+$$\begin{aligned}
+ \sigma_{rr}
+ = \frac{3 \eta U}{2 a} \cos\theta
+ \qquad \quad
+ \sigma_{\theta r}
+ = - \frac{3 \eta U}{2 a} \sin\theta
+\end{aligned}$$
+
+Now we can finally calculate the effective stress on the surface,
+by converting the basis vectors $\vu{e}_r$ and $\vu{e}_\theta$ to Cartesian coordinates:
+
+$$\begin{aligned}
+ \hat{\sigma} \cdot \vu{e}_r
+ &= \vu{e}_r \frac{3 \eta U}{2 a} \cos\theta - \vu{e}_\theta \frac{3 \eta U}{2 a} \sin\theta
+ \\
+ &= \Big( \vu{e}_x \sin\theta \cos\phi + \vu{e}_y \sin\theta \sin\phi + \vu{e}_z \cos\theta \Big) \frac{3 \eta U}{2 a} \cos\theta
+ \\
+ &\qquad - \Big( \vu{e}_x \cos\theta \cos\phi + \vu{e}_y \cos\theta \sin\phi - \vu{e}_z \sin\theta \Big) \frac{3 \eta U}{2 a} \sin\theta
+ \\
+ &= \Big( \vu{e}_z \cos^2\theta + \vu{e}_z \sin^2\theta \Big) \frac{3 \eta U}{2 a}
+ = \vu{e}_z \frac{3 \eta U}{2 a}
+\end{aligned}$$
+
+Remarkably, the stress at every point on the sphere is purely in the $z$-direction!
+This is not entirely unexpected though: symmetry cancels out all other components.
+
+With this, we can do the integrals for $\va{D}$,
+which reduce to a surface area factor $4 \pi a^2$:
+
+$$\begin{aligned}
+ \va{D}
+ %= \int_0^{2\pi} \!\!\! \int_0^\pi \big( \hat{\sigma} \cdot \vu{e}_r \big) \:r^2 \sin\theta \dd{\theta} \dd{\phi}
+ = \vu{e}_z \frac{3 \eta U}{2 a} \int_0^{2\pi} \!\!\!\! \int_0^\pi a^2 \sin\theta \dd{\theta} \dd{\phi}
+ = \vu{e}_z \frac{3 \eta U}{2 a} 2 \pi a^2 \int_0^\pi \sin\theta \dd{\theta}
+ = \vu{e}_z \: 6 \pi \eta U a
+\end{aligned}$$
+
+At last, we arrive at Stokes' law,
+which simply expresses the magnitude of $\va{D}$:
+
+$$\begin{aligned}
+ \boxed{
+ D
+ = 6 \pi \eta U a
+ }
+\end{aligned}$$
+
+To arrive at this result,
+we assumed that the sphere was fixed, and the fluid was flowing past it.
+We can equally well let the fluid be at rest,
+with the sphere falling through it at $U$.
+The force of gravity then exerts the following force $G$ on it,
+subtracting [buoyancy](/know/concept/archimedes-principle/):
+
+$$\begin{aligned}
+ G
+ = \frac{4 \pi a^3}{3} (\rho_s - \rho_f) g_0
+\end{aligned}$$
+
+Where $\rho_s$ and $\rho_f$ are the sphere's and fluid's densities,
+and $g_0$ is the gravitational acceleration.
+Since $D$ acts in the opposite sense of $G$,
+after some time, they cancel out:
+
+$$\begin{aligned}
+ 6 \pi \eta U a
+ = \frac{4 \pi a^3}{3} (\rho_s - \rho_f) g_0
+\end{aligned}$$
+
+This is an equation for the **terminal velocity** $U_t$,
+which we find to be as follows:
+
+$$\begin{aligned}
+ U_t
+ = \frac{2 a^2 (\rho_s - \rho_f) g_0}{9 \eta}
+\end{aligned}$$
+
+The falling sphere will accelerate until $U_t$,
+and then continue falling at constant speed.
+
+
+
+## References
+1. B. Lautrup,
+ *Physics of continuous matter: exotic and everyday phenomena in the macroscopic world*, 2nd edition,
+ CRC Press.
diff --git a/sources/know/concept/repetition-code/circuit.tex b/sources/know/concept/repetition-code/circuit.tex
new file mode 100644
index 0000000..8b30dde
--- /dev/null
+++ b/sources/know/concept/repetition-code/circuit.tex
@@ -0,0 +1,186 @@
+\documentclass[11pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath}
+\usepackage{amsfonts}
+\usepackage{physics}
+\usepackage{yquant}
+
+
+\begin{document}
+
+\yquantdefinebox{dots}[inner sep=0pt]{$\vdots$}
+
+\section{Spacer}
+
+\begin{tikzpicture}
+ \begin{yquant}[operator/separation=5mm, register/separation=0mm]
+ qubit {$\ket{\psi}$} q;
+ qubit {$\ket{0}$} z1;
+ qubit {$\ket{0}$} z2;
+
+ cnot z1 | q;
+ cnot z2 | q;
+
+ [value=$\ket{\overline{\psi}}$]
+ output (q, z1, z2);
+ \end{yquant}
+\end{tikzpicture}
+
+\section{Spacer}
+
+\begin{tikzpicture}
+ \begin{yquant}[operator/separation=5mm, register/separation=0mm]
+ qubit {$\ket{\psi}$} q;
+ qubit {$\ket{0}$} z1;
+ qubit {$\ket{0}$} z2;
+
+ cnot z1 | q;
+ cnot z2 | q;
+
+ h q;
+ h z1;
+ h z2;
+
+ [value=$\ket{\overline{\psi}}$]
+ output (q, z1, z2);
+ \end{yquant}
+\end{tikzpicture}
+
+\section{Spacer}
+
+\begin{tikzpicture}
+ \begin{yquant}[operator/separation=2mm, register/separation=0mm]
+ qubit {} q1;
+ qubit {} q2;
+ qubit {} q3;
+ init {$\ket{\overline{\psi}}$} (q1, q2, q3);
+ qubit {$\ket{0}$} z;
+
+ cnot z | q2;
+ cnot z | q3;
+
+ measure z;
+ \end{yquant}
+\end{tikzpicture}
+
+\section{Spacer}
+
+\begin{tikzpicture}
+ \begin{yquant}[operator/separation=2mm, register/separation=0mm]
+ qubit {} q1;
+ qubit {} q2;
+ qubit {} q3;
+ init {$\ket{\overline{\psi}}$} (q1, q2, q3);
+ qubit {$\ket{0}$} z1;
+ qubit {$\ket{0}$} z2;
+
+ cnot z1 | q1;
+ cnot z1 | q2;
+
+ cnot z2 | q2;
+ cnot z2 | q3;
+
+ measure z1;
+ measure z2;
+
+ box {$\mathrm{Correction}$} (q1, q2, q3) | z1, z2;
+ discard z1;
+ discard z2;
+ \end{yquant}
+\end{tikzpicture}
+
+\section{Spacer}
+
+\begin{tikzpicture}
+ \begin{yquant}[operator/separation=2mm, register/separation=1mm]