~jzck/physics-notes

28a670ee93783ac4030cc9dbcb49038f67266267 — Jack Halford 1 year, 23 days ago 5b29759
reference tooltips
8 files changed, 87 insertions(+), 47 deletions(-)

M Makefile
M formularies/LL3/6.1.tex
D formularies/Makefile
M md/erf.md
M md/quantum-operator.md
M tools/math.tex
M tools/pf-filter.py
M tools/tex_to_html.sh
M Makefile => Makefile +2 -4
@@ 10,10 10,8 @@ TEX	=	$(subst md/,www-data/,$(MD:.md=.tex))
HTML	=	$(subst md/,www-data/,$(MD:.md=.html)) www-data/index.html www-data/style.css

all: $(HTML) $(SVG) www-data/graph.svg
form:
> $(MAKE) -f formularies/Makefile

www-data/%.html: md/%.md | www-data/colors.css www-data form
www-data/%.html: md/%.md | www-data/colors.css www-data
> @printf '$@\n'
> pandoc	-s --filter tools/pf-filter.py \
		-H tools/header.html \


@@ 48,4 46,4 @@ clean:

re: clean all

.PHONY: clean all re form
.PHONY: clean all re

M formularies/LL3/6.1.tex => formularies/LL3/6.1.tex +1 -1
@@ 1,1 1,1 @@
$$ \ptag[LL3]{6.1} \Psi=ae^{iS/\hbar} $$
\Psi=ae^{iS/\hbar}

D formularies/Makefile => formularies/Makefile +0 -14
@@ 1,14 0,0 @@
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.RECIPEPREFIX = >

TEX	=	$(shell ls -1 formularies/*/*.tex)
HTML	=	$(subst formularies/, www-data/,$(TEX:.tex=.html))

all: $(HTML)

www-data/%.html: formularies/%.tex
> @echo $@
> @mkdir -p $(shell dirname $@)
> @tools/tex_to_html.sh $^ > $@

M md/erf.md => md/erf.md +38 -1
@@ 1,4 1,41 @@
---
title: Exponential response function
title: exponential response function
type: math
sources: MIT 18.031x
---

## First order ERF

This trick works for finding a particular solution to $n^{th}$ order ODE with constant factors when the input is of exponential form.

Consider the following $n^th$ order constant factor ODE.

$$ P(D)z=e^{rt} $$

where $P(D)$ is a polynomial of the derivative operator $D$.

because of the property of exponential we have

$$ \tag{1} P(D)e^{rt}=P(r)e^{rt} $$

If $P(D)\neq 0$, by linearity of the operator $P(D)$ we have immediately

$$ P(D)\left(\frac{e^{rt}}{P(r)}\right)=e^{rt} $$

Therefore we have the particular solution to our ODE

$$ z_p=\frac{e^{rt}}{P(r)} $$

## Generalized ERF

When $P(r)=0$ can simply take the derivative of $(1)$ with respect to $r$.

$$ P(D)te^{rt}=P'(r)e^{rt} $$

or more generally if all the $P^{(i<m)}(r)=0$

$$ \tag{2} P(D)t^me^{rt}=P^{(m)}(r)e^{rt} $$

In which case our particular solution is

$$ z_p=\frac{t^{m}e^{rt}}{P^{(m)}(r)} $$

M md/quantum-operator.md => md/quantum-operator.md +10 -10
@@ 39,7 39,7 @@ we can find a simple form for $a_n$
LL3/3.5
```

if we substitute $(3.2)$ we find $a_n=\sum a_m\int\Psi_m\Psi_n^*\dd{q}$, from which it is evident the eigenfunctions must satisfy be an orthogonal set
if we substitute `LL3/3.2` we find $a_n=\sum a_m\int\Psi_m\Psi_n^*\dd{q}$, from which it is evident the eigenfunctions must satisfy be an orthogonal set

```eq
LL3/3.6


@@ 59,15 59,15 @@ Let $(\qop{f}\Psi)$ be the result of the operator acting on the function $\Psi$.
LL3/3.8
```

In general $\qop{f}$ is linear, if we plug $(3.5)$ in $(3.7)$ we find $\overline{f}=\sum_n f_na_na_n^*=\int\Psi(\sum_n a_nf_n\Psi_n)\dd{q}$
In general $\qop{f}$ is linear, if we plug `LL3/3.5` in `LL3/3.7` we find $\overline{f}=\sum_n f_na_na_n^*=\int\Psi(\sum_n a_nf_n\Psi_n)\dd{q}$

Comparing with $(3.8)$ we get that the effect of $\qop{f}$ on $\Psi$ is
Comparing with `LL3/3.8` we get that the effect of $\qop{f}$ on $\Psi$ is

```eq
LL3/3.9
```

If we substitute in $(3.5)$ for $a_n$, we find that $\qop{f}$ is an integral operator of the form
If we substitute in `LL3/3.5` for $a_n$, we find that $\qop{f}$ is an integral operator of the form

```eq
LL3/3.10


@@ 209,7 209,7 @@ The subject of normalisation of the eigenfunctions of a continuous spectrum is m
LL3/5.2
```

In the same way we found $(3.5)$, we can write
In the same way we found `LL3/3.5`, we can write

\begin{align}
\int\Psi\Psi^*\dd{q}&=\int|a_f|^2\dd{f}\\


@@ 222,9 222,9 @@ By comparing these two we find the expression for the expansion coefficients
LL3/5.3
```

in exact analogy to $(3.5)$.
in exact analogy to `LL3/3.5`.

To derive the normalisation condition, we substitute $(5.1)$ in $(5.3)$
To derive the normalisation condition, we substitute `LL3/5.1` in `LL3/5.3`

$$ a_f=\int a_{f'}(\Psi_{f'}\Psi_f^*\dd{q})\dd{f'} $$



@@ 234,7 234,7 @@ This relation must hold for any $a_f$. The only solution is
LL3/5.4
```

This gives the normalisation rule for the eigenfunctions; replacing condition $(3.6)$. Similarly, we have $\Psi_f$ and $\Psi_{f'}$ orthogonal for $f\neq f'$. However the integrals of $|\Psi_f|^2$ diverge for a continuous system. The eigenfunctions satisfy another relation by subsituting the other way around
This gives the normalisation rule for the eigenfunctions; replacing condition `LL3/3.6`. Similarly, we have $\Psi_f$ and $\Psi_{f'}$ orthogonal for $f\neq f'$. However the integrals of $|\Psi_f|^2$ diverge for a continuous system. The eigenfunctions satisfy another relation by subsituting the other way around

$$ \Psi(q)=\int\Psi(q')\left(\int\Psi_f^*(q')\Psi_f(q)\dd{f}\right)\dd{q'} $$



@@ 250,7 250,7 @@ The analogous for a discrete spectrum is
LL3/5.12
```

$(5.1)$ and $(5.3)$ are analogous: $\Psi(q)$ can be expanded in terms of the functions $\Psi_f(q)$ with expansion coefficients $a_f$, or otherwise we can expand $a_f\equiv a(f)$ in terms of the functions $\Psi_f^*(q)$ while $\Psi(q)$ play the expansion coefficients. The function $a(f)$, like $\Psi(q)$ completely determines the state of the system. Just as $|\Psi(q)|^2$ determines the probability for the system to have coordinates lying in an interval $\dd{q}$, so $|a(f)|^2$ determines the probability for the values of the quantity $f$ to lie in a given interval $\dd{f}$.
`LL3/5.1` and `LL3/5.3` are analogous: $\Psi(q)$ can be expanded in terms of the functions $\Psi_f(q)$ with expansion coefficients $a_f$, or otherwise we can expand $a_f\equiv a(f)$ in terms of the functions $\Psi_f^*(q)$ while $\Psi(q)$ play the expansion coefficients. The function $a(f)$, like $\Psi(q)$ completely determines the state of the system. Just as $|\Psi(q)|^2$ determines the probability for the system to have coordinates lying in an interval $\dd{q}$, so $|a(f)|^2$ determines the probability for the values of the quantity $f$ to lie in a given interval $\dd{f}$.

(TODO: 5.13 -> 5.17)



@@ 270,7 270,7 @@ $$ \overline{\dot{f}}=\dot{\overline{f}}=\frac{\dd{}}{\dd{t}}\int\Psi^*\qop{f}\P
\int\Psi\qop{f}\frac{\partial\Psi}{\partial t}\dd{q}
$$

Substituting in $(8.1)$, the time derivative is simply the [Hamiltonian operator](hamiltonian-operator.md)
Substituting in `LL3/8.1`, the time derivative is simply the [Hamiltonian operator](hamiltonian-operator.md)
$$ \overline{\dot{f}}=
\int\Psi^*\frac{\partial\qop{f}}{\partial t}\Psi\dd{q}+
\frac{i}{\hbar}\int(\qop[*]{H}\Psi^*)\qop{f}\Psi\dd{q}-

M tools/math.tex => tools/math.tex +1 -5
@@ 8,11 8,7 @@
\newcommand{\v}[1]{\mathbf{#1}}
\newcommand{\qop}[2][]{\hat{#2}\vphantom{#2}^{#1}}
\newcommand{\mfrac}[2]{\textstyle\frac{#1}{#2}\displaystyle}

\newcommand{\ptag}[2][]{\label{#1:#2}\tag*{(#2)$_{\text{#1}}$}}
\newcommand{\load}[2][]{
\input{formularies/#1/#2.tex}
}
\newcommand{\ptag}[2][]{\label{#1/#2}\tag*{(#2)$_{\text{#1}}$}}

\newenvironment{nalign}{
\begin{equation}

M tools/pf-filter.py => tools/pf-filter.py +18 -5
@@ 1,4 1,5 @@
import panflute as pf
import subprocess


def prepare(doc):


@@ 8,19 9,31 @@ def prepare(doc):


def action(elem, doc):
    # if isinstance(elem, pf.Code):
    #     doc.content.insert(0, pf.RawBlock(f"HELLO"))

    # .md to .html
    if isinstance(elem, pf.Link) and elem.url.endswith('.md'):
        elem.url = elem.url[:-3] + '.html'
        return elem

    # reference
    if isinstance(elem, pf.Code):
        res = subprocess.run(["./tools/tex_to_html.sh", "inline", f"formularies/{elem.text}.tex"], capture_output=True)
        tooltiptext = res.stdout.decode('utf-8')
        book, eq = elem.text.split('/')
        html = f'''
        <span class="tooltip" class="math inline">
        \(({eq})\)
        <span class="tooltiptext">{tooltiptext}</span>
        </span>
        '''
        # <span class="tooltiptext">{tooltiptext}</span>
        elem = pf.RawInline(html, format='html')
        return elem

    # load
    if isinstance(elem, pf.CodeBlock):
        if 'eq' in elem.classes:
            with open(f'www-data/{elem.text}.html') as file:
                html = file.read()
            res = subprocess.run(["./tools/tex_to_html.sh", "block", f"formularies/{elem.text}.tex"], capture_output=True)
            html = res.stdout.decode('utf-8')
            elem = pf.RawBlock(html, format='html')
            return elem
        return []

M tools/tex_to_html.sh => tools/tex_to_html.sh +17 -7
@@ 1,10 1,20 @@
#!/bin/bash

eq=$(basename ${1%.tex})
dir=$(dirname $1)
eq=$(basename ${2%.tex})
dir=$(dirname $2)
book=$(basename $dir)
pandoc -f latex --mathjax tools/math.tex <(echo "
\begin{equation}
\ptag[$book]{$eq} $(cat $1)
\end{equation}
")
math="$(cat $2)"

block() {
    pandoc -f latex --mathjax tools/math.tex <(echo "
    \begin{equation}
    \ptag[$book]{$eq}$math
    \end{equation}
    ")
}

inline() {
    pandoc -f latex --mathjax tools/math.tex <(echo "\( $math \)") | sed -e 's:<p>:<span>:' -e 's:</p>:</span>:'
}

"$@"