From 16aacd72d8665d3d55fc6e85a39e28426b71d2d1 Mon Sep 17 00:00:00 2001 From: "matthias@quintern.xyz" Date: Sun, 23 Feb 2025 09:54:17 +0100 Subject: [PATCH] improve cmp --- scripts/ch_elchem.py | 113 ++++++++++++++++++ scripts/formulary.py | 8 +- scripts/util/colorschemes.py | 1 + src/ch/el.tex | 197 ++++++++++++++++++++++++-------- src/ch/misc.tex | 11 +- src/cm/cm.tex | 20 +++- src/comp/ad.tex | 15 ++- src/comp/est.tex | 136 +++++++++++++++++++--- src/comp/ml.tex | 132 ++++++++++++++++++--- src/constants.tex | 8 ++ src/main.tex | 24 +--- src/math/calculus.tex | 12 +- src/math/linalg.tex | 6 + src/math/probability_theory.tex | 38 +++++- src/pkg/mqformula.sty | 7 +- src/pkg/mqfqname.sty | 11 +- src/pkg/mqlua.sty | 2 +- src/pkg/mqquantity.sty | 10 +- src/pkg/mqtranslation.sty | 5 +- src/qm/qm.tex | 10 ++ src/quantities.tex | 2 +- src/statistical_mechanics.tex | 17 +-- src/util/colorscheme.tex | 60 ++++------ src/util/fqname.tex | 180 ----------------------------- 24 files changed, 656 insertions(+), 369 deletions(-) delete mode 100644 src/util/fqname.tex diff --git a/scripts/ch_elchem.py b/scripts/ch_elchem.py index 8b9c07f..68f5dba 100644 --- a/scripts/ch_elchem.py +++ b/scripts/ch_elchem.py @@ -4,6 +4,8 @@ from scipy.constants import gas_constant, Avogadro, elementary_charge Faraday = Avogadro * elementary_charge +# BUTLER VOLMER / TAFEL + @np.vectorize def fbutler_volmer_anode(ac, z, eta, T): return np.exp((1-ac)*z*Faraday*eta/(gas_constant*T)) @@ -73,8 +75,119 @@ def tafel(): ax.grid() return fig + +# NYQUIST +@np.vectorize +def fZ_ohm(R, omega): + return R + +@np.vectorize +def fZ_cap(C, omega): + return 1/(1j*omega*C) + +@np.vectorize +def fZ_ind(L, omega): + return (1j*omega*L) + + +def nyquist(): + fig, ax = plt.subplots(figsize=(full/2, full/3)) + split_z = lambda Z: (Z.real, -Z.imag) + ax.grid() + ax.set_xlabel("$\\text{Re}(Z)$ [\\si{\\ohm}]") + ax.set_ylabel("$-\\text{Im}(Z)$ [\\si{\\ohm}]") + # ax.scatter(*split_z(Z_series), label="series") + + + R1 = 20 + R2 = 5 + RS = 7.5 + C1 = 1e-4 + C2 = 1e-6 + ws1 = np.power(10, np.linspace(1, 8, 1000)) + + + Z_ohm1 = fZ_ohm(R1, ws1) + Z_ohm2 = fZ_ohm(R2, ws1) + Z_ohmS = fZ_ohm(RS, ws1) + Z_cap1 = fZ_cap(C1, ws1) + Z_cap2 = fZ_cap(C2, ws1) + Z_parallel1 = 1/(1/Z_ohm1 + 1/Z_cap1) + Z_parallel2 = 1/(1/Z_ohm2 + 1/Z_cap2) + Z_cell = Z_parallel1 + Z_parallel2 + Z_ohmS + ax.scatter(*split_z(Z_parallel1), label="Parallel $C_1,R_1$") + ax.scatter(*split_z(Z_parallel2), label="Parallel $C_2,R_2$") + ax.scatter(*split_z(Z_cell), label="P1 + $R_3$ + P2") + ax.scatter(*split_z(Z_cap1), label=f"$C_1=\\SI{{{C1:.0e}}}{{\\farad}}$") + ax.scatter(*split_z(Z_ohm1), label=f"$R_1 = \\SI{{{R1}}}{{\\ohm}}$") + + # wmax1 = 1/(R1 * C1) + # ZatWmax1 = Z_parallel1[np.argmin(ws1 - wmax1)] + # print(ws1[0], ws1[-1]) + # print(wmax1, ZatWmax1) + # ax.scatter(*split_z(ZatWmax1), color="red") + # ax.scatter(*split_z(Z_cell1), label="cell") + # ax.scatter(*split_z(Z_ohm2), label="ohmic") + # ax.scatter(*split_z(Z_cell2), label="cell") + ax.axis('equal') + ax.set_ylim(0,R1*1.1) + ax.legend() + return fig + +def fZ_tlm(Rel, Rion, Rct, Cct, ws, N): + Zion = fZ_ohm(Rion, ws) + Zel = fZ_ohm(Rel, ws) + Zct = 1/(1/fZ_ohm(Rct, ws) + 1/fZ_cap(Cct, ws)) + + Z = Zct + for _ in range(N): + Z = Zion + 1/(1/Zct + 1/Z) + Z += Zel + return Z + +def nyquist_tlm(): + fig, ax = plt.subplots(figsize=(full/2, full/4)) + split_z = lambda Z: (Z.real, -Z.imag) + ax.grid() + ax.set_xlabel("$\\text{Re}(Z)$ [\\si{\\ohm}]") + ax.set_ylabel("$-\\text{Im}(Z)$ [\\si{\\ohm}]") + Rct1 = 300 + Rct2 = 100 + Rion = 10 + ws = np.power(10, np.linspace(1e-6, 5, 1000)) + Z1 = fZ_tlm(0, Rion, Rct1, 1e-4, ws, 100) + Z2 = fZ_tlm(0, Rion, Rct2, 1e-4, ws, 100) + ax.scatter(*split_z(Z1), label=f"$R_\\text{{ct}} = \\SI{{{Rct1}}}{{\\ohm}}$", marker=".") + ax.scatter(*split_z(Z2), label=f"$R_\\text{{ct}} = \\SI{{{Rct2}}}{{\\ohm}}$", marker=".") + ax.axis('equal') + # ax.set_ylim(0,R1*1.1) + ax.legend() + return fig + +def fkohlrausch(L0, K, c): + return L0 - K*np.sqrt(c) + +def kohlrausch(): + fig, ax = plt.subplots(figsize=(full/4, full/4)) + ax.grid() + ax.set_xlabel("$c_\\text{salt}$") + ax.set_ylabel("$\\Lambda_\\text{M}$") + L0 = 10 + K1 = 1 + K2 = 2 + cs = np.linspace(0, 10) + L1 = fkohlrausch(L0, K1, cs) + L2 = fkohlrausch(L0, K2, cs) + ax.plot(cs, L1, label=f"$K={K1}$") + ax.plot(cs, L2, label=f"$K={K2}$") + ax.legend() + return fig + if __name__ == '__main__': export(butler_volmer(), "ch_butler_volmer") export(tafel(), "ch_tafel") + export(nyquist(), "ch_nyquist") + export(nyquist_tlm(), "ch_nyquist_tlm") + export(kohlrausch(), "ch_kohlrausch") diff --git a/scripts/formulary.py b/scripts/formulary.py index 86cea3b..051873e 100644 --- a/scripts/formulary.py +++ b/scripts/formulary.py @@ -24,12 +24,12 @@ import util.colorschemes as cs from util.gen_tex_colorscheme import generate_latex_colorscheme # SET THE COLORSCHEME # hard white and black -# cs.p_gruvbox["fg0"] = "#000000" -# cs.p_gruvbox["bg0"] = "#ffffff" -# COLORSCHEME = cs.gruvbox_light() +cs.p_gruvbox["fg0-hard"] = "#000000" +cs.p_gruvbox["bg0-hard"] = "#ffffff" +COLORSCHEME = cs.gruvbox_light() # COLORSCHEME = cs.gruvbox_dark() # cs.p_tum["fg0"] = cs.p_tum["alt-blue"] -COLORSCHEME = cs.tum() +# COLORSCHEME = cs.tum() # COLORSCHEME = cs.legacy() tex_src_path = "../src/" diff --git a/scripts/util/colorschemes.py b/scripts/util/colorschemes.py index 753a072..373b2e8 100644 --- a/scripts/util/colorschemes.py +++ b/scripts/util/colorschemes.py @@ -152,6 +152,7 @@ def tum(): for n,c in p_tum.items(): n2 = n.replace("light", "bg").replace("dark", "fg") TUM[n2] = c + TUM["fg-blue"] = p_tum["alt-blue"] # dark blue is too black return TUM # diff --git a/src/ch/el.tex b/src/ch/el.tex index a3e56df..637247f 100644 --- a/src/ch/el.tex +++ b/src/ch/el.tex @@ -64,33 +64,33 @@ \pgfmathsetmacro{\H}{3} \pgfmathsetmacro{\elW}{\W/20} - \pgfmathsetmacro{\CEx}{1/6*\W} + \pgfmathsetmacro{\REx}{1/6*\W} \pgfmathsetmacro{\WEx}{3/6*\W} - \pgfmathsetmacro{\REx}{5/6*\W} + \pgfmathsetmacro{\CEx}{5/6*\W} \fill[bg-blue] (0,0) rectangle (\W, \H/2); \draw[ultra thick] (0,0) rectangle (\W,\H); % Electrodes - \draw[thick, fill=bg-gray] (\CEx-\elW,\H/5) rectangle (\CEx+\elW,\H); + \draw[thick, fill=bg-gray] (\REx-\elW,\H/5) rectangle (\REx+\elW,\H); \draw[thick, fill=bg-purple] (\WEx-\elW,\H/5) rectangle (\WEx+\elW,\H); - \draw[thick, fill=bg-yellow] (\REx-\elW,\H/5) rectangle (\REx+\elW,\H); - \node at (\CEx,3*\H/5) {C}; - \node at (\WEx,3*\H/5) {W}; + \draw[thick, fill=bg-yellow] (\CEx-\elW,\H/5) rectangle (\CEx+\elW,\H); \node at (\REx,3*\H/5) {R}; + \node at (\WEx,3*\H/5) {W}; + \node at (\CEx,3*\H/5) {C}; % potentiostat \pgfmathsetmacro{\potH}{\H+0.5+2} \pgfmathsetmacro{\potM}{\H+0.5+1} \draw[thick] (0,\H+0.5) rectangle (\W,\potH); % Wires - \draw (\CEx,\H) -- (\CEx,\potM) to[voltmeter,-o] (\WEx,\potM) to[european voltage source] (\WEx+1/6*\W,\potM) to[ammeter] (\REx,\potM); + \draw (\REx,\H) -- (\REx,\potM) to[voltmeter,-o] (\WEx,\potM) to[european voltage source] (\WEx+1/6*\W,\potM) to[ammeter] (\CEx,\potM); \draw (\WEx,\H) -- (\WEx,\H+1.5); - \draw (\REx,\H) -- (\REx,\H+1.5); + \draw (\CEx,\H) -- (\CEx,\H+1.5); % labels - \node[anchor=west, align=left] at (\W+0.2, 1*\H/4) {{\color{bg-gray} \blacksquare} \GT{counter_electrode}}; + \node[anchor=west, align=left] at (\W+0.2, 1*\H/4) {{\color{bg-gray} \blacksquare} \GT{reference_electrode}}; \node[anchor=west, align=left] at (\W+0.2, 2*\H/4) {{\color{bg-purple}\blacksquare} \GT{working_electrode}}; - \node[anchor=west, align=left] at (\W+0.2, 3*\H/4) {{\color{bg-yellow}\blacksquare} \GT{reference_electrode}}; + \node[anchor=west, align=left] at (\W+0.2, 3*\H/4) {{\color{bg-yellow}\blacksquare} \GT{counter_electrode}}; \node[anchor=west, align=left] at (\W+0.2, \potM) {\GT{potentiostat}}; \end{tikzpicture} \end{formula} @@ -189,19 +189,6 @@ \eq{ i_\text{conv} = \sum_i -z_i F \, c_i \, v_i^\text{flow} } \end{formula} - \begin{formula}{ionic_conductivity} - \desc{Ionic conductivity}{}{\ConstRef{faraday}, $z_i$, $c_i$, $\mu_i$ charge number, \qtyRef{concentration} and \qtyRef{mobility} of the positive (+) and negative (-) ions} - \desc[german]{Ionische Leitfähigkeit}{}{\ConstRef{faraday}, $z_i$, $c_i$, $\mu_i$ Ladungszahl, \qtyRef{concentration} und \qtyRef{mobility} der positiv (+) und negativ geladenen Ionen} - \quantity{\kappa}{\per\ohm\cm=\siemens\per\cm}{} - \eq{\kappa = F^2 \left(z_+^2 \, c_+ \, \mu_+ + z_-^2 \, c_- \, \mu_-\right)} - \end{formula} - - \begin{formula}{ionic_resistance} - \desc{Ohmic resistance of ionic current flow}{}{$L$ \qtyRef{length}, $A$ \qtyRef{area}, \QtyRef{ionic_conductivity}} - \desc[german]{Ohmscher Widerstand für Ionen-Strom}{}{} - \eq{R_\Omega = \frac{L}{A\,\kappa}} - \end{formula} - \begin{formula}{ionic_mobility} \desc{Ionic mobility}{}{$v_\pm$ steady state drift \qtyRef{velocity}, $\phi$ \qtyRef{electric_scalar_potential}, $z$ \qtyRef{charge_number}, \ConstRef{faraday}, \ConstRef{charge}, \QtyRef{viscosity}, $r_\pm$ ion radius} \desc[german]{Ionische Moblilität}{}{} @@ -215,6 +202,20 @@ \eq{F_\txR = 6\pi\,r \eta v} \end{formula} + + \begin{formula}{ionic_conductivity} + \desc{Ionic conductivity}{}{\ConstRef{faraday}, $z_i$, $c_i$, $u_i$ charge number, \qtyRef{concentration} and \qtyRef{ionic_mobility} of the positive (+) and negative (-) ions} + \desc[german]{Ionische Leitfähigkeit}{}{\ConstRef{faraday}, $z_i$, $c_i$, $u_i$ Ladungszahl, \qtyRef{concentration} und \qtyRef{ionic_mobility} der positiv (+) und negativ geladenen Ionen} + \quantity{\kappa}{\per\ohm\cm=\siemens\per\cm}{} + \eq{\kappa = F^2 \left(z_+^2 \, c_+ \, u_+ + z_-^2 \, c_- \, u_-\right)} + \end{formula} + + \begin{formula}{ionic_resistance} + \desc{Ohmic resistance of ionic current flow}{}{$L$ \qtyRef{length}, $A$ \qtyRef{area}, \QtyRef{ionic_conductivity}} + \desc[german]{Ohmscher Widerstand für Ionen-Strom}{}{} + \eq{R_\Omega = \frac{L}{A\,\kappa}} + \end{formula} + \begin{formula}{transference} \desc{Transference number}{Ion transport number \\Fraction of the current carried by positive / negative ions}{$i_{+/-}$ current through positive/negative charges} \desc[german]{Überführungszahl}{Anteil der positiv / negativ geladenen Ionen am Gesamtstrom}{$i_{+/-}$ Strom durch positive / negative Ladungn} @@ -231,29 +232,30 @@ \end{formula} \begin{formula}{kohlrausch_law} - \desc{Kohlrausch's law}{}{$\Lambda_\txM^0$ \qtyRef{molar_conductivity} at infinite dilution, $c_\text{salt}$ \gt{csalt}, $K$ \GT{constant}} - \desc[german]{}{}{$\Lambda_\txM^0$ \qtyRef{molar_conductivity} bei unendlicher Verdünnung, $\text{salt}$ \gt{csalt} $K$ \GT{constant}} + \desc{Kohlrausch's law}{For strong electrolytes}{$\Lambda_\txM^0$ \qtyRef{molar_conductivity} at infinite dilution, $c_\text{salt}$ \gt{csalt}, $K$ \GT{constant}} + \desc[german]{}{}{$\Lambda_\txM^0$ \qtyRef{molar_conductivity} bei unendlicher Verdünnung, $\text{salt}$ \gt{csalt},$K$ \GT{constant}} \eq{\Lambda_\txM = \Lambda_\txM^0 - K \sqrt{c_\text{salt}}} + \fig{img/ch_kohlrausch.pdf} \end{formula} % Electrolyte conductivity \begin{formula}{molality} - \desc{Molality}{}{\QtyRef{amount} of the solute, \QtyRef{mass} of the solvent} - \desc[german]{Molalität}{}{\QtyRef{amount} des gelösten Stoffs, \QtyRef{mass} des Lösungsmittels} + \desc{Molality}{Amount per mass}{\QtyRef{amount} of the solute, \QtyRef{mass} of the solvent} + \desc[german]{Molalität}{Stoffmenge pro Masse}{\QtyRef{amount} des gelösten Stoffs, \QtyRef{mass} des Lösungsmittels} \quantity{b}{\mol\per\kg}{} \eq{b = \frac{n}{m}} \end{formula} \begin{formula}{molarity} - \desc{Molarity}{\GT{see} \qtyRef{concentration}}{\QtyRef{amount} of the solute, \QtyRef{volume} of the solvent} - \desc[german]{Molarität}{}{\QtyRef{amount} des gelösten Stoffs, \QtyRef{volume} des Lösungsmittels} + \desc{Molarity}{Amount per volume\\\qtyRef{concentration}}{\QtyRef{amount} of the solute, \QtyRef{volume} of the solvent} + \desc[german]{Molarität}{Stoffmenge pro Volumen\\\qtyRef{concentration}}{\QtyRef{amount} des gelösten Stoffs, \QtyRef{volume} des Lösungsmittels} \quantity{c}{\mol\per\litre}{} \eq{c = \frac{n}{V}} \end{formula} \begin{formula}{ionic_strength} \desc{Ionic strength}{Measure of the electric field in a solution through solved ions}{\QtyRef{molality}, \QtyRef{molarity}, $z$ \qtyRef{charge_number}} - \desc[german]{Ionenstärke}{Maß eienr Lösung für die elektrische Feldstärke durch gelöste Ionen}{} + \desc[german]{Ionenstärke}{Maß einer Lösung für die elektrische Feldstärke durch gelöste Ionen}{} \quantity{I}{\mol\per\kg;\mol\per\litre}{} \eq{I_b &= \frac{1}{2} \sum_i b_i z_i^2 \\ I_c &= \frac{1}{2} \sum_i c_i z_i^2} \end{formula} @@ -265,10 +267,11 @@ \end{formula} \begin{formula}{mean_ionic_activity} - \desc{Mean ionic activity coefficient}{Accounts for decreased reactivity because ions must divest themselves of their ion cloud before reacting}{} + \desc{Mean ionic activity coefficient}{Accounts for decreased reactivity because ions must divest themselves of their ion cloud before reacting}{\QtyRef{activity}, $m_i$ \qtyRef{molality}, $m_0 = \SI{1}{\mol\per\kg}$} \desc[german]{Mittlerer ionischer Aktivitätskoeffizient}{Berücksichtigt dass Ionen sich erst von ihrer Ionenwolke lösen müssen, bevor sie reagieren können}{} \quantity{\gamma}{}{s} \eq{\gamma_\pm = \left(\gamma_+^{\nu_+} \, \gamma_-^{\nu_-}\right)^{\frac{1}{\nu_+ + \nu_-}}} + \eq{a_i \equiv \gamma_i \frac{m_i}{m^0}} \end{formula} \begin{formula}{debye_hueckel_law} @@ -324,40 +327,94 @@ \eq{\eta_\text{diff} = \frac{RT}{nF} \Ln{\frac{j_\infty}{j_\infty - j_\text{meas}}}} \end{formula} + % 1: ion radius + % 2: ion color + % 3: ion label + % 4: N solvents, leave empty for none + % 5: solvent radius 6: solvent color + % 7:position + \newcommand{\drawIon}[7]{% + \fill[#2] (#7) circle[radius=#1] node[fg0] {#3}; + \ifstrempty{#4}{}{ + \foreach \j in {1,...,#4} { + \pgfmathsetmacro{\angle}{\j * 360/#4} + \fill[#6] (#7) ++(\angle:#1 + #5) circle[radius=#5]; + } + } + } + \newcommand{\drawAnion}[1]{\drawIon{\Ranion}{bg-blue}{-}{}{}{}{#1}} + \newcommand{\drawCation}[1]{\drawIon{\Rcation}{bg-red}{+}{}{}{}{#1}} + \newcommand{\drawAnionSolved}[1]{\drawIon{\Ranion}{bg-blue}{-}{6}{\Rsolvent}{fg-blue!50!bg2}{#1}} + + \Eng[electrode]{Electrode} + \Ger[electrode]{Elektrode} + \Eng[nernst_layer]{Nernst layer} + \Ger[nernst_layer]{Nernst-Schicht} + \Eng[electrolyte]{Electrolyte} + \Ger[electrolyte]{Elektrolyt} + \Eng[c_surface]{surface \qtyRef{concentration}} + \Eng[c_bulk]{bulk \qtyRef{concentration}} + \Ger[c_surface]{Oberflächen-\qtyRef{concentration}} + \Ger[c_bulk]{Bulk-\qtyRef{concentration}} + \begin{formula}{diffusion_layer} - \desc{Cell layers}{}{} - \desc[german]{Zellschichten}{}{} + \desc{Cell layers}{}{IHP/OHP inner/outer Helmholtz-plane, $c^0$ \GT{c_bulk}, $c^\txS$ \GT{c_surface}} + \desc[german]{Zellschichten}{}{IHP/OHP innere/äußere Helmholtzschicht, $c^0$ \GT{c_bulk}, $c^\txS$ \GT{c_surface}} \begin{tikzpicture} \tikzset{ label/.style={color=fg1,anchor=center,rotate=90}, } + \pgfmathsetmacro{\Ranion}{0.15} + \pgfmathsetmacro{\Rcation}{0.2} + \pgfmathsetmacro{\Rsolvent}{0.06} + \pgfmathsetmacro{\tkW}{8} % Total width \pgfmathsetmacro{\tkH}{4} % Total height \pgfmathsetmacro{\edW}{1} % electrode width - \pgfmathsetmacro{\hhW}{1} % helmholtz width - \pgfmathsetmacro{\ndW}{2} % nernst diffusion with + \pgfmathsetmacro{\hhW}{4*\Rsolvent+2*\Ranion} % helmholtz width + \pgfmathsetmacro{\ndW}{3} % nernst diffusion with \pgfmathsetmacro{\eyW}{\tkW-\edW-\hhW-\ndW} % electrolyte width \pgfmathsetmacro{\edX}{0} % electrode width \pgfmathsetmacro{\hhX}{\edW} % helmholtz width \pgfmathsetmacro{\ndX}{\edW+\hhW} % nernst diffusion with \pgfmathsetmacro{\eyX}{\tkW-\eyW} % electrolyte width - \path[fill=bg-orange] (\edX,0) rectangle (\edX+\edW,\tkH); \node[label] at (\edX+\edW/2,\tkH/2) {\GT{electrode}}; - \path[fill=bg-green!90!bg0] (\hhX,0) rectangle (\hhX+\hhW,\tkH); \node[label] at (\hhX+\hhW/2,\tkH/2) {\GT{helmholtz_layer}}; - \path[fill=bg-green!60!bg0] (\ndX,0) rectangle (\ndX+\ndW,\tkH); \node[label] at (\ndX+\ndW/2,\tkH/2) {\GT{nernst_layer}}; - \path[fill=bg-green!20!bg0] (\eyX,0) rectangle (\eyX+\eyW,\tkH); \node[label] at (\eyX+\eyW/2,\tkH/2) {\GT{electrolyte}}; - \draw (\hhX,2) -- (\ndX,3) -- (\tkW,3); + \path[fill=bg-orange] (\edX,0) rectangle (\edX+\edW,\tkH); + \path[fill=bg-green!90!bg0] (\hhX,0) rectangle (\hhX+\hhW,\tkH); + \path[fill=bg-green!60!bg0] (\ndX,0) rectangle (\ndX+\ndW,\tkH); + \path[fill=bg-green!20!bg0] (\eyX,0) rectangle (\eyX+\eyW,\tkH); + \draw (\ndX,2) -- (\eyX,3) -- (\tkW,3); % axes \draw[->] (0,0) -- (\tkW+0.2,0) node[anchor=north] {$x$}; \draw[->] (0,0) -- (0,\tkH+0.2) node[anchor=east] {$c$}; \tkYTick{2}{$c^\txS$}; \tkYTick{3}{$c^0$}; + \foreach \i in {1,...,5} { + \drawCation{\edW-\Ranion, \tkH * \i /6} + \drawAnionSolved{\edW+\Rcation+2*\Rsolvent, \tkH * \i /6} + } + \drawCation{\ndX+\ndW * 0.1, \tkH * 2/10} + \drawCation{\ndX+\ndW * 0.15, \tkH * 4/10} + \drawCation{\ndX+\ndW * 0.1, \tkH * 6/10} + \drawCation{\ndX+\ndW * 0.1, \tkH * 9/10} + \drawAnion{ \ndX+\ndW * 0.2, \tkH * 7/10} + \drawAnion{ \ndX+\ndW * 0.4, \tkH * 4/10} + \drawAnion{ \ndX+\ndW * 0.3, \tkH * 3/10} + \drawAnion{ \ndX+\ndW * 0.5, \tkH * 6/10} + \drawAnion{ \ndX+\ndW * 0.8, \tkH * 3/10} + \drawAnion{ \ndX+\ndW * 0.3, \tkH * 1/10} + \drawAnion{ \ndX+\ndW * 0.4, \tkH * 9/10} + \drawAnion{ \ndX+\ndW * 0.6, \tkH * 7/10} + \drawCation{\ndX+\ndW * 0.3, \tkH * 3/10} + \drawCation{\ndX+\ndW * 0.6, \tkH * 8/10} + \draw (\edX+\Rcation, 0) -- ++(0, -0.5) node[anchor=west,rotate=-45] {\GT{electrode}}; + \draw (\edX+\edW-\Rcation, 0) -- ++(0, -0.5) node[anchor=west,rotate=-45] {{IHP}}; + \draw (\hhX+\hhW/2, 0) -- ++(0, -0.5) node[anchor=west,rotate=-45] {{OHP}}; + \draw (\ndX+\ndW/2, 0) -- ++(0, -0.5) node[anchor=west,rotate=-45] {\GT{nernst_layer}}; + \draw (\eyX+\eyW/2, 0) -- ++(0, -0.5) node[anchor=west,rotate=-45] {\GT{electrolyte}}; + % TODO \end{tikzpicture} \end{formula} - \Eng[c_surface]{surface \qtyRef{concentration}} - \Eng[c_bulk]{bulk \qtyRef{concentration}} - \Ger[c_surface]{Oberflächen-\qtyRef{concentration}} - \Ger[c_bulk]{Bulk-\qtyRef{concentration}} \begin{formula}{diffusion_layer_thickness} @@ -458,8 +515,8 @@ \desc{Reversible hydrogen electrode (RHE)}{RHE Potential does not change with the pH value}{$E^0\equiv \SI{0}{\volt}$, \QtyRef{activity}, \QtyRef{pressure}, \GT{see} \fqEqRef{ch:el:cell:nernst_equation}} \desc[german]{Reversible Wasserstoffelektrode (RHE)}{Potential ändert sich nicht mit dem pH-Wert}{} \eq{ - E_\text{RHE} &= E^0 + \frac{RT}{F} \Ln{\frac{a_{\ce{H^+}}}{p_{\ce{H2}}}} \\ - &= \SI{0}{\volt} - \SI{0.059}{\volt} + E_\text{RHE} &= E^0 + \frac{RT}{F} \Ln{\frac{a_{\ce{H^+}}}{p_{\ce{H2}}}} + % \\ &= \SI{0}{\volt} - \SI{0.059}{\volt} } \end{formula} @@ -532,9 +589,15 @@ \end{minipage} \end{bigformula} + \begin{formula}{charge} + \desc{Charge}{Area under the curve}{$v$ \qtyRef{scan_rate}} + \desc[german]{Ladung}{Fläche unter der Kurve}{} + \eq{q = \frac{1}{v} \int_{E_1}^{E_2}j\,\d E} + \end{formula} + \begin{formula}{peak_current} - \desc{Randles-Sevcik equation}{For reversible reaction.\\Peak current depends on square root of the scan rate}{$n$ \qtyRef{charge_number}, \ConstRef{faraday}, $A$ electrode surface area, $c^0$ bulk \qtyRef{concentration}, $v$ \qtyRef{scan_rate}, $D_\text{ox}$ \qtyRef{diffusion_coefficient} of oxidized analyte, \ConstRef{universal_gas}, \QtyRef{temperature}} - \desc[german]{Randles-Sevcik Gleichung}{Spitzenstrom}{} + \desc{Randles-Sevcik equation}{For reversible faradaic reaction.\\Peak current depends on square root of the scan rate}{$n$ \qtyRef{charge_number}, \ConstRef{faraday}, $A$ electrode surface area, $c^0$ bulk \qtyRef{concentration}, $v$ \qtyRef{scan_rate}, $D_\text{ox}$ \qtyRef{diffusion_coefficient} of oxidized analyte, \ConstRef{universal_gas}, \QtyRef{temperature}} + \desc[german]{Randles-Sevcik Gleichung}{Für eine reversible, faradäische Reaktion\\Spitzenstrom hängt von der Wurzel der Scanrate ab}{} \eq{i_\text{peak} = 0.446\,nFAc^0 \sqrt{\frac{nFvD_\text{ox}}{RT}}} \end{formula} @@ -570,7 +633,7 @@ \begin{formula}{diffusion_layer_thickness} \desc{Diffusion layer thickness}{\TODO{Where does 1.61 come from}}{$D$ \qtyRef{diffusion_coefficient}, $\nu$ \qtyRef{kinematic_viscosity}, \QtyRef{angular_frequency}} - \desc[german]{Diffusionsshichtdicke}{}{} + \desc[german]{Diffusionsschichtdicke}{}{} \eq{\delta_\text{diff}= 1.61 D{^\frac{1}{3}} \nu^{\frac{1}{6}} \omega^{-\frac{1}{2}}} \end{formula} @@ -580,4 +643,40 @@ \eq{j_\infty = nFD \frac{c^0}{\delta_\text{diff}} = \frac{1}{1.61} nFD^{\frac{2}{3}} v^{\frac{-1}{6}} c^0 \sqrt{\omega}} \end{formula} + \Subsubsection[ + \eng{AC-Impedance} + \ger{AC-Impedanz} + ]{ac} + \begin{formula}{nyquist} + \desc{Nyquist diagram}{Real and imaginary parts of \qtyRef{impedance} while varying the frequency}{} + \desc[german]{Nyquist-Diagram}{Real und Imaginaärteil der \qtyRef{impedance} während die Frequenz variiert wird}{} + \fig{img/ch_nyquist.pdf} + \end{formula} + + \begin{formula}{tlm} + \desc{Transmission line model}{Model of porous electrodes as many slices}{$R_\text{ion}$ ion conduction resistance in electrode slice, $R$ / $C$ resistance / capacitance of electode slice} + % \desc[german]{}{}{} + \ctikzsubcircuitdef{rcpair}{in, out}{% + coordinate(#1-in) + (#1-in) -- ++(0, -\rcpairH) + -- ++(\rcpairW, 0) to[R, l=$R$] ++(0,-\rcpairL) -- ++(-\rcpairW, 0) + -- ++(0,-\rcpairH) coordinate (#1-out) ++(0,\rcpairH) + -- ++(-\rcpairW, 0) to[C, l=$C$] ++(0,\rcpairL) -- ++(\rcpairW,0) + (#1-out) + } + + \pgfmathsetmacro{\rcpairH}{0.5} + \pgfmathsetmacro{\rcpairW}{0.5} + \pgfmathsetmacro{\rcpairL}{1.8} + \ctikzsubcircuitactivate{rcpair} + \pgfmathsetmacro{\rcpairD}{3.0} % distance + \centering + \begin{circuitikz}[/tikz/circuitikz/bipoles/length=1cm,scale=0.7] + \draw (0,0) to[R,l=$R_\text{electrolyte}$] ++(2,0) -- ++(1,0) + \rcpair{rc1}{} (rc1-in) to[R,l=$R_\text{ion}$] ++(\rcpairD,0) \rcpair{rc2}{} (rc2-in) to[R,l=$R_\text{ion}$] ++(\rcpairD,0) ++(\rcpairD,0) \rcpair{rc3}{}; + \draw[dashed] (rc2-in) ++(\rcpairD,0) -- (rc3-in) (rc2-out) ++(\rcpairD,0) -- (rc3-out); + \draw (rc1-out) -- (rc2-out) -- ++(\rcpairD,0) (rc3-out) -- ++(\rcpairD/2,0); + \end{circuitikz} + \fig{img/ch_nyquist_tlm.pdf} + \end{formula} diff --git a/src/ch/misc.tex b/src/ch/misc.tex index a61a18c..cd9a1f5 100644 --- a/src/ch/misc.tex +++ b/src/ch/misc.tex @@ -3,7 +3,7 @@ \ger{Thermoelektrizität} ]{thermo} \begin{formula}{seebeck} - \desc{Seebeck coefficient}{}{$V$ voltage, \QtyRef{temperature}} + \desc{Seebeck coefficient}{Thermopower}{$V$ voltage, \QtyRef{temperature}} \desc[german]{Seebeck-Koeffizient}{}{} \quantity{S}{\micro\volt\per\kelvin}{s} \eq{S = -\frac{\Delta V}{\Delta T}} @@ -23,15 +23,15 @@ \end{formula} \begin{formula}{wiedemann-franz} - \desc{Wiedemann-Franz law}{}{Electric \QtyRef{thermal_conductivity}, $L$ in \si{\watt\ohm\per\kelvin} Lorentz number, \QtyRef{conductivity}} - \desc[german]{Wiedemann-Franz Gesetz}{}{Elektrische \QtyRef{thermal_conductivity}, $L$ in \si{\watt\ohm\per\kelvin} Lorentzzahl, \QtyRef{conductivity}} + \desc{Wiedemann-Franz law}{}{$\kappa$ Electric \qtyRef{thermal_conductivity}, $L$ in \si{\watt\ohm\per\kelvin} Lorentz number, \QtyRef{conductivity}} + \desc[german]{Wiedemann-Franz Gesetz}{}{$\kappa$ Elektrische \qtyRef{thermal_conductivity}, $L$ in \si{\watt\ohm\per\kelvin} Lorentzzahl, \QtyRef{conductivity}} \eq{\kappa = L\sigma T} \end{formula} \begin{formula}{zt} - \desc{Thermoelectric figure of merit}{Dimensionless quantity for comparing different materials}{\QtyRef{seebeck}, \QtyRef{conductivity}, } + \desc{Thermoelectric figure of merit}{Dimensionless quantity for comparing different materials}{\QtyRef{seebeck}, \QtyRef{conductivity}, $\kappa$ \qtyRef{thermal_conductivity}, \QtyRef{temperature}} \desc[german]{Thermoelektrische Gütezahl}{Dimensionsoser Wert zum Vergleichen von Materialien}{} - \eq{zT = \frac{S^2\sigma}{\lambda} T} + \eq{zT = \frac{S^2\sigma}{\kappa} T} \end{formula} @@ -93,6 +93,7 @@ \begin{formula}{common_chemicals} \desc{Common chemicals}{}{} \desc[german]{Häufige Chemikalien}{}{} + \centering \begin{tabular}{l|c} \GT{name} & \GT{formula} \\ \hline\hline \begin{ttext}[cyanide]\eng{Cyanide}\ger{Zyanid}\end{ttext} & \ce{CN} \\ \hline diff --git a/src/cm/cm.tex b/src/cm/cm.tex index e5d6691..5fa930f 100644 --- a/src/cm/cm.tex +++ b/src/cm/cm.tex @@ -28,26 +28,38 @@ \begin{formula}{dispersion_1atom_basis} \desc{Phonon dispersion of a lattice with a one-atom basis}{same as the dispersion of a linear chain}{$C_n$ force constants between layer $s$ and $s+n$, $M$ \qtyRef{mass} of the reference atom, $a$ \qtyRef{lattice_constant}, $q$ phonon \qtyRef{wavevector}, $u$ Ansatz for the atom displacement} \desc[german]{Phonondispersion eines Gitters mit zweiatomiger Basis}{gleich der Dispersion einer linearen Kette}{$C_n$ Kraftkonstanten zwischen Ebene $s$ und $s+n$, $M$ \qtyRef{mass} des Referenzatoms, $a$ \qtyRef{lattice_constant}, $q$ Phonon \qtyRef{wavevector}, $u$ Ansatz für die Atomauslenkung} - \eq{ + \begin{gather} \omega^2 = \frac{4C_1}{M}\left[\sin^2 \left(\frac{qa}{2}\right) + \frac{C2}{C1} \sin^2(qa)\right] \\ \intertext{\GT{with}} u_{s+n} = U\e^{-i \left[\omega t - q(s+n)a \right]} - } + \end{gather} \fig{img/cm_phonon_dispersion_one_atom_basis.pdf} \end{formula} \TODO{Plots} \begin{formula}{dispersion_2atom_basis} \desc{Phonon dispersion of a lattice with a two-atom basis}{}{$C$ force constant between layers, $M_i$ \qtyRef{mass} of the basis atoms, $a$ \qtyRef{lattice_constant}, $q$ phonon \qtyRef{wavevector}, $u, v$ Ansatz for the displacement of basis atom 1 and 2, respectively} \desc[german]{Phonondispersion eines Gitters mit einatomiger Basis}{}{$C$ Kraftkonstanten zwischen Ebene $s$ und $s+n$, $M_i$ \qtyRef{mass} der Basisatome, $a$ \qtyRef{lattice_constant}, $q$ Phonon \qtyRef{wavevector}, $u, v$ jeweils Ansatz für die Atomauslenkung des Basisatoms 1 und 2} - \eq{ + \begin{gather} \omega^2_{\txa,\txo} = C \left(\frac{1}{M_1}+\frac{1}{M_2}\right) \mp C \sqrt{\left(\frac{1}{M_1}+\frac{1}{M_2}\right)^2 - \frac{4}{M_1M_2} \sin^2 \left(\frac{qa}{2}\right)} \intertext{\GT{with}} u_{s} = U\e^{-i \left(\omega t - qsa \right)}, \quad v_{s} = V\e^{-i \left(\omega t - qsa \right)} - } + \end{gather} \fig{img/cm_phonon_dispersion_two_atom_basis.pdf} \end{formula} + \begin{formula}{branches} + \desc{Vibration branches}{}{} + \desc[german]{Vibrationsmoden}{}{} + \ttxt{\eng{ + \textbf{Acoustic}: 3 modes (1 longitudinal, 2 transversal), the two basis atoms oscillate in phase. + \\\textbf{Optical}: 3 modes, the two basis atoms oscillate in opposition. A dipole moment is created that can couple to photons. + }\ger{ + \textbf{Akustisch}: 3 Moden (1 longitudinal, 2 transversal), die zwei Basisatome schwingen in Phase. + \\ \textbf{Optisch}: 3 Moden, die zwei Basisatome schwingen gegenphasig. Das dadurch entstehende Dipolmoment erlaubt die Wechselwirkung mit Photonen. + }} + \end{formula} + \Subsection[ \eng{Debye model} \ger{Debye-Modell} diff --git a/src/comp/ad.tex b/src/comp/ad.tex index aa92236..e405909 100644 --- a/src/comp/ad.tex +++ b/src/comp/ad.tex @@ -281,7 +281,7 @@ \item Use empirical interaction potential instead of electronic structure \baditem Force fields need to be fitted for specific material \Rightarrow not transferable \gooditem Faster than \abbrRef{bomd} - \item Example: \absRef{lennard_jones} + \item Example: \absRef[Lennard-Jones]{lennard_jones} \end{itemize} }} \end{formula} @@ -309,8 +309,8 @@ \end{formula} \begin{formula}{verlet} - \desc{Verlet integration}{Preverses time reversibility, does not require velocity updates}{} - \desc[german]{Verlet-Algorithmus}{Zeitumkehr-symmetrisch}{} + \desc{Verlet integration}{Preverses time reversibility, does not require velocity updates. Integration in 2nd order}{} + \desc[german]{Verlet-Algorithmus}{Zeitumkehr-symmetrisch. Interation in zweiter Ordnung}{} \eq{ \vecR(t+\Delta t) = 2\vecR(t) -\vecR(t-\Delta t) + \veca(t) \Delta t^2 + \Order{\Delta t^4} } @@ -325,7 +325,14 @@ } \end{formula} - \TODO{leapfrog} + \begin{formula}{leapfrog} + \desc{Leapfrog}{Integration in 2nd order}{} + \desc[german]{Leapfrog}{Integration in zweiter Ordnung}{} + \eq{ + x_{i+1} &= x_i + v_{i+1/2} \Delta t_i \\ + v_{i+1/2} &= v_{i-1/2} + a_{i} \Delta t_i + } + \end{formula} \Subsubsection[ \eng{Thermostats and barostats} diff --git a/src/comp/est.tex b/src/comp/est.tex index 542036c..3e0b98e 100644 --- a/src/comp/est.tex +++ b/src/comp/est.tex @@ -77,12 +77,14 @@ $\hat{T}$ kinetic electron energy, $\hat{V}_{\text{en}}$ electron-nucleus attraction, $\hat{V}_{\text{HF}}$ \fqEqRef{comp:dft:hf:potential}, + $x = \vecr,\sigma$ position and spin } \desc[german]{Hartree-Fock Gleichung}{}{ $\varphi_\xi$ ein-Teilchen Wellenfunktion des $\xi$-ten Orbitals, $\hat{T}$ kinetische Energie der Elektronen, $\hat{V}_{\text{en}}$ Electron-Kern Anziehung, - $\hat{V}_{\text{HF}}$ \fqEqRef{comp:dft:hf:potential} + $\hat{V}_{\text{HF}}$ \fqEqRef{comp:dft:hf:potential}, + $x = \vecr,\sigma$ Position and Spin } \eq{ \left(\hat{T} + \hat{V}_{\text{en}} + \hat{V}_{\text{HF}}^\xi\right)\varphi_\xi(x) = \epsilon_\xi \varphi_\xi(x) @@ -107,9 +109,9 @@ \ttxt{ \eng{ \begin{enumerate} - \item Initial guess for $\psi$ + \item Initial guess for $\varphi$ \item Solve SG for each particle - \item Make new guess for $\psi$ + \item Make new guess for $\varphi$ \end{enumerate} } } @@ -131,7 +133,7 @@ \desc{Hohenberg-Kohn theorem (HK2)}{}{} \desc[german]{Hohenberg-Kohn Theorem (HK2)}{}{} \ttxt{ - \eng{Given the energy functional $E[n(\vecr)]$, the ground state density and energy can be obtained variationally. The density that minimizes the total energy is the ecxact ground state density. } + \eng{Given the energy functional $E[n(\vecr)]$, the ground state density and energy can be obtained variationally. The density that minimizes the total energy is the exact ground state density. } \ger{Für ein Energiefunktional $E[n(\vecr)]$ kann die Grundzustandsdichte und Energie durch systematische Variation bestimmt werden. Die Dichte, welche die Gesamtenergie minimiert ist die exakte Grundzustandsichte. } } \end{formula} @@ -159,7 +161,7 @@ \desc{Kohn-Sham functional}{}{$T_\text{KS}$ kinetic enery, $V_\text{ext}$ external potential, $E_\txH$ \hyperref[f:comp:est:dft:hf:potential]{Hartree term}, $E_\text{XC}$ \fqEqRef{comp:est:dft:xc:xc}} \desc[german]{Kohn-Sham Funktional}{}{} \eq{E_\text{KS}[n(\vecr)] = T_\text{KS}[n(\vecr)] + V_\text{ext}[n(\vecr)] + E_\text{H}[n(\vecr)] + E_\text{XC}[n(\vecr)] } - \end{formula} + \end{formula} \begin{formula}{equation} \desc{Kohn-Sham equation}{Exact single particle \abbrRef{schroedinger_equation} (though often exact $E_\text{XC}$ is not known)\\ Solving it uses up a large portion of supercomputer resources}{$\phi_i^\text{KS}$ KS orbitals, $\int\d^3r v_\text{ext}(\vecr)n(\vecr)=V_\text{ext}[n(\vecr)]$} @@ -232,7 +234,6 @@ \ttxt{\eng{ Include \hyperref[f:comp:dft:hf:potential]{Fock term} (exact exchange) in other functional, like \abbrRef{gga}. Computationally expensive }} - \end{formula} @@ -250,16 +251,123 @@ }} \end{formula} - \begin{formula}{comparison} + \begin{bigformula}{comparison} \desc{Comparison of DFT functionals}{}{} \desc[german]{Vergleich von DFT Funktionalen}{}{} - \begin{tabular}{l|c} - \hyperref[f:comp:est:dft:hf:potential]{Hartree-Fock} & only exchange, no correlation \Rightarrow upper bound of GS energy \\ - \abbrRef{lda} & understimates e repulsion \Rightarrow Overbinding \\ - \abbrRef{gga} & underestimate band gap \\ - hybrid & underestimate band gap - \end{tabular} - \end{formula} + % \begin{tabular}{l|c} + % \hyperref[f:comp:est:dft:hf:potential]{Hartree-Fock} & only exchange, no correlation \Rightarrow upper bound of GS energy \\ + % \abbrRef{lda} & understimates e repulsion \Rightarrow Overbinding \\ + % \abbrRef{gga} & underestimate band gap \\ + % hybrid & underestimate band gap + % \end{tabular} + + \TODO{HFtotal energy: upper boundary for GS density $n$} + + \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} + % \begin{tabular}{|P{0.15\textwidth}|P{0.2\textwidth}|P{0.1\textwidth}|P{0.2\textwidth}|P{0.1\textwidth}|P{0.1\textwidth}|P{0.15\textwidth}|} + % \hline + % \textbf{Method} & \textbf{Description} & \textbf{Mean Absolute Error (eV)} & \textbf{Band Gap Accuracy} & \textbf{Computational Cost} & \textbf{Usage} & \textbf{Other Notes} \\ + % \hline + % Hartree-Fock (HF) & + % $E_C \sim E_C^{HF\text{theory}}$ + % $E_X \sim E_X^{FOCK}$ + % & 3.1 (Underbinding) & \tabitem no SIE \tabitem correct long-range behaviour \tabitem nonlinear chemical potential (missing DD) \tabitem positive correlation effects & High & Reference for exact exchange, useful for small molecules. & Self-interaction free, but lacks correlation. \\ + % \hline + % Local Density Approximation (LDA) & + % $E_x \sim n(r)$ + % $E_c \sim n(r)$ + % & 1.3 (Overbinding) & \tabitem SIE \tabitem wrong long-range behaviour \tabitem nonlinear chemical potential (missing DD) & Low & Basic solids and metallic systems, where accuracy is not critical. & Simple and computationally cheap. \\ + % \hline + % Generalised Gradient Approximation (GGA) & + % $E_x \sim n(r), \nabla n(r)$ + % $E_c \sim n(r), \nabla n(r)$ + % & 0.3 (Mostly overbinding) & \tabitem SIE \tabitem wrong long-range behaviour \tabitem nonlinear chemical potential (missing DD) & Moderate & More accurate for molecules and chemical bonding studies. & Better than LDA for chemical bonding. \\ + % \hline + % Hybrid Functionals & + % $E_x = E_x^{GGA}$ + % $E_x = (1-\alpha)E_x^{GGA} + \alpha E_X^{FOCK}$ + % \tabitem Add expensive non-local Fock term to reduce self-interaction + % & Lower than GGA (Improved balance) & \tabitem reduced SIE \tabitem wrong long-range behaviour \tabitem nonlinear chemical potential (missing DD) & Higher & Molecular chemistry, solid-state physics requiring better accuracy. & Balances accuracy and cost. \\ + % \hline + % Range-Separated Hybrid (RSH) & + % $E_x = E_x^{GGA}$ + % $E_{X,SR} = (1-\alpha)E_x^{GGA} + \alpha E_X^{FOCK}$ + % $E_{X,LR} = E_x^{GGA}$ + % \tabitem Mix-in expensive Fock term only for short-range interactions $\rightarrow$ since for LR the Coulomb interaction gets screening in dielectric substances ($\epsilon > 1$), such as crystalline materials. + % & Lower than Hybrid (Even better balance) & \tabitem reduced SIE \tabitem wrong long-range behaviour \tabitem nonlinear chemical potential (missing DD) & Very High & Semiconductors, materials with screened Coulomb interactions. & Used for dielectric materials. \\ + % \hline + % Optimally Tuned RSH (OT-RSH) & + % $E_x = E_x^{GGA}$ + % $E_{X,SR} = E_x^{GGA}$ and $E_X^{FOCK}$ + % $E_{X,LR} = E_x^{GGA}$ and $E_X^{FOCK}$ + % \tabitem More advanced tuning between Fock and GGA. So that set also have the correct asymptotic behaviour of $1/r$ (Coulomb e.g. Fock) instead of $e^{-r}$ from GGA + % & Lowest & \tabitem reduced SIE \tabitem better long-range behaviour \tabitem /+ better chemical potential - they include non-multiplicative, orbital dependent terms. Hence, in principle they allow for including a DD. & Extremely High & Precise calculations for band gap predictions and electronic properties. & Most flexible but computationally expensive. \\ + % \hline + % \end{tabular} + + % \begin{tabularx}{\textwidth}{lXlllll} + % \toprule + % \textbf{Method} & \textbf{Description} & \textbf{Mean Absolute Error (eV)} & \textbf{Band Gap Accuracy} & \textbf{Computational Cost} & \textbf{Usage} & \textbf{Other Notes} \\ + % \midrule + % Hartree-Fock (HF) & $E_C \sim E_C^{HF\text{theory}}$ $E_X \sim E_X^{FOCK}$ & 3.1 (Underbinding) & Overestimates + % \tabitem no SIE + % \tabitem correct long-range behaviour + % \tabitem nonlinear chemical potential (missing DD) + % \tabitem positive correlation effects + % & High & Reference for exact exchange, useful for small molecules. & Self-interaction free, but lacks correlation. \\ + % \midrule + % Local Density Approximation (LDA) & + % $E_x \sim n(r)$ + % $E_c \sim n(r)$ + % & 1.3 (Overbinding) & Underestimates + % \tabitem SIE + % \tabitem wrong long-range behaviour + % \tabitem nonlinear chemical potential (missing DD) + % & Low & Basic solids and metallic systems, where accuracy is not critical. & Simple and computationally cheap. \\ + % \midrule + % Generalised Gradient Approximation (GGA) & + % $E_x \sim n(r), \nabla n(r)$ + % $E_c \sim n(r), \nabla n(r)$ + % & 0.3 (Mostly overbinding) & Improved over LDA + % \tabitem SIE + % \tabitem wrong long-range behaviour + % \tabitem nonlinear chemical potential (missing DD) + % & Moderate & More accurate for molecules and chemical bonding studies. & Better than LDA for chemical bonding. \\ + % \midrule + % Hybrid Functionals & + % $E_x = E_x^{GGA}$ + % $E_x = (1-\alpha)E_x^{GGA} + \alpha E_X^{FOCK}$ + % \tabitem Add expensive non-local Fock term to reduce self-interaction + % & Lower than GGA (Improved balance) & Better than GGA + % \tabitem reduced SIE + % \tabitem wrong long-range behaviour + % \tabitem nonlinear chemical potential (missing DD) + % & Higher & Molecular chemistry, solid-state physics requiring better accuracy. & Balances accuracy and cost. \\ + % \midrule + % Range-Separated Hybrid (RSH) & + % $E_x = E_x^{GGA}$ + % $E_{X,SR} = (1-\alpha)E_x^{GGA} + \alpha E_X^{FOCK}$ + % $E_{X,LR} = E_x^{GGA}$ + % \tabitem Mix-in expensive Fock term only for short-range interactions $\rightarrow$ since for LR the Coulomb interaction gets screening in dielectric substances ($\epsilon > 1$), such as crystalline materials. + % & Lower than Hybrid (Even better balance) & Strongly underestimates + % \tabitem reduced SIE + % \tabitem wrong long-range behaviour + % \tabitem nonlinear chemical potential (missing DD) + % & Very High & Semiconductors, materials with screened Coulomb interactions. & Used for dielectric materials. \\ + % \midrule + % Optimally Tuned RSH (OT-RSH) & + % $E_x = E_x^{GGA}$ + % $E_{X,SR} = E_x^{GGA}$ and $E_X^{FOCK}$ + % $E_{X,LR} = E_x^{GGA}$ and $E_X^{FOCK}$ + % \tabitem More advanced tuning between Fock and GGA. So that set also have the correct asymptotic behaviour of $1/r$ (Coulomb e.g. Fock) instead of $e^{-r}$ from GGA + % & Lowest & Most accurate + % \tabitem reduced SIE + % \tabitem better long-range behaviour + % \tabitem /+ better chemical potential - they include non-multiplicative, orbital dependent terms. Hence, in principle they allow for including a DD. + % & Extremely High & Precise calculations for band gap predictions and electronic properties. & Most flexible but computationally expensive. \\ + % \bottomrule + % \end{tabularx} + \end{bigformula} \Subsubsection[ \eng{Basis sets} diff --git a/src/comp/ml.tex b/src/comp/ml.tex index ed8b7f8..2e34a9b 100644 --- a/src/comp/ml.tex +++ b/src/comp/ml.tex @@ -21,14 +21,20 @@ \desc[german]{Genauigkeit}{}{} \eq{a = \frac{\tgt{cp}}{\tgt{fp} + \tgt{cp}}} \end{formula} - \TODO{is $n$ the nuber of predictions or the number of output features?} + \eng{n_desc}{Number of data points} + \ger{n_desc}{Anzahl der Datenpunkte} \begin{formula}{mean_abs_error} - \desc{Mean absolute error (MAE)}{}{$y$ \gt{y}, $\hat{y}$ \gt{yhat}, $n$ ?} + \desc{Mean absolute error (MAE)}{}{$y$ \gt{y}, $\hat{y}$ \gt{yhat}, $n$ \gt{n_desc}} \desc[german]{Mittlerer absoluter Fehler (MAE)}{}{} \eq{\text{MAE} = \frac{1}{n} \sum_{i=1}^n \abs{y_i - \hat{y}_i}} \end{formula} + \begin{formula}{mean_square_error} + \desc{Mean squared error (MSE)}{}{$y$ \gt{y}, $\hat{y}$ \gt{yhat}, $n$ \gt{n_desc}} + \desc[german]{Methode der kleinsten Quadrate (MSE)}{Quadratwurzel des mittleren quadratischen Fehlers (SME)}{} + \eq{\text{MSE} = \frac{1}{n} \sum_{i=1}^n \left(y_i - \hat{y}_i\right)^2} + \end{formula} \begin{formula}{root_mean_square_error} - \desc{Root mean squared error (RMSE)}{}{$y$ \gt{y}, $\hat{y}$ \gt{yhat}, $n$ ?} + \desc{Root mean squared error (RMSE)}{}{$y$ \gt{y}, $\hat{y}$ \gt{yhat}, $n$ \gt{n_desc}} \desc[german]{Standardfehler der Regression}{Quadratwurzel des mittleren quadratischen Fehlers (RSME)}{} \eq{\text{RMSE} = \sqrt{\frac{1}{n} \sum_{i=1}^n \left(y_i - \hat{y}_i\right)^2}} \end{formula} @@ -42,39 +48,127 @@ \ger{Lineare Regression} ]{linear} \begin{formula}{eq} - \desc{Linear regression}{Fits the data under the assumption of \hyperref[f:math:pt:distributions:cont:normal]{normally distributed errors}}{$\mat{x}\in\R^{N\times M}$ input data, $\mat{y}\in\R^{N\times L}$ output data, $\mat{b}$ bias, $\vec{W}$ weights, $N$ samples, $M$ features, $L$ output variables} + \desc{Linear regression}{Fits the data under the assumption of \hyperref[f:math:pt:distributions:cont:normal]{normally distributed errors}}{$\mat{x}\in\R^{N\times M}$ input data, $\mat{y}\in\R^{N\times L}$ output data, $\mat{b}$ bias, $\vec{\beta}$ weights, $N$ samples, $M$ features, $L$ output variables} \desc[german]{Lineare Regression}{Fitted Daten unter der Annahme \hyperref[f:math:pt:distributions:cont:normal]{normalverteilter Fehler}}{} - \eq{\mat{y} = \mat{b} + \mat{x} \cdot \vec{W}} + \eq{\mat{y} = \mat{\epsilon} + \mat{x} \cdot \vec{\beta}} \end{formula} \begin{formula}{design_matrix} - \desc{Design matrix}{Stack column of ones to the feature vector\\Useful when $b$ is scalar}{$x_{ij}$ feature $j$ of sample $i$} + \desc{Design matrix}{Stack column of ones to the feature vector\\Useful when $\epsilon$ is scalar}{$x_{ij}$ feature $j$ of sample $i$} \desc[german]{Designmatrix Ansatz}{}{} \eq{ \mat{X} = \begin{pmatrix} 1 & x_{11} & \ldots & x_{1M} \\ \vdots & \vdots & \vdots & \vdots \\ 1 & x_{N1} & \ldots & x_{NM} \end{pmatrix} } \end{formula} \begin{formula}{scalar_bias} - \desc{Linear regression with scalar bias}{Using the design matrix, the scalar is absorbed into the weight vector}{$\mat{y}$ output data, $\mat{X}$ \fqEqRef{comp:ml:reg:design_matrix}, $\vec{W}$ weights} + \desc{Linear regression with scalar bias}{Using the design matrix, the scalar is absorbed into the weight vector}{$\mat{y}$ output data, $\mat{X}$ \fqEqRef{comp:ml:reg:design_matrix}, $\vec{\beta}$ weights} \desc[german]{Lineare Regression mit skalarem Bias}{Durch die Designmatrix wird der Bias in den Gewichtsvektor absorbiert}{} - \eq{\mat{y} = \mat{X} \cdot \vec{W}} + \eq{\mat{y} = \mat{X} \cdot \vec{\beta}} \end{formula} \begin{formula}{normal_equation} - \desc{Normal equation}{Solves \fqEqRef{comp:ml:reg:linear:scalar_bias}}{$\mat{y}$ output data, $\mat{X}$ \fqEqRef{comp:ml:reg:linear:design_matrix}, $\vec{W}$ weights} - \desc[german]{Normalengleichung}{Löst \fqEqRef{comp:ml:reg:linear:scalar_bias}}{} - \eq{\vec{W} = \left(\mat{X}^\T \mat{X}\right)^{-1} \mat{X}^T \mat{y}} + \desc{Normal equation}{Solves \fqEqRef{comp:ml:reg:linear:scalar_bias} with \fqEqRef{comp:ml:performance:mse}}{$\mat{y}$ output data, $\mat{X}$ \fqEqRef{comp:ml:reg:linear:design_matrix}, $\vec{\beta}$ weights} + \desc[german]{Normalengleichung}{Löst \fqEqRef{comp:ml:reg:linear:scalar_bias} mit \fqEqRef{comp:ml:performance:mse}}{} + \eq{\vec{\beta} = \left(\mat{X}^\T \mat{X}\right)^{-1} \mat{X}^T \mat{y}} \end{formula} \Subsubsection[ - \eng{Ridge regression} - \ger{Ridge Regression} - ]{ridge} - \TODO{ridge reg, Kernel ridge reg, gaussian process reg} - % \Subsection[ - % \eng{Bayesian probability theory} - % % \ger{} - % ]{bayesian} + \eng{Kernel method} + \ger{Kernelmethode} + ]{kernel} + \begin{formula}{kernel_trick} + \desc{Kernel trick}{}{$\vecx_i \in \R^{M_1}$ input vectors, $M_1$ dimension of data vector space, $M_2$ dimension of feature space} + % \desc[german]{}{}{} + \ttxt{\eng{ + Useful when transforming the input data $x$ into a much higher dimensional space ($M_2 \gg M_1$) $\Phi: \R^{M_1} \mapsto \R^{M_2},\quad \vecx \to \Phi(\vecx)$ + and only the dot product of this transformed data $\Phi(x)^\T\Phi(x)$ is required. + Then the dot product can be replaced by a suitable kernel function $\kappa$. + }} + \eq{ + k(\vecx_i,\vecx_j) \equiv \Phi(\vecx_i)^{\T} \Phi(\vecx_j) + } + \end{formula} + + \begin{formula}{common_kernels} + \desc{Common kernels}{}{} + % \desc[german]{}{}{} + % \eq{} + \ttxt{\eng{ + Linear, Polynomial, Sigmoid, Laplacian, radial basis funciton (RBF) + }} + \end{formula} + + \begin{formula}{radial_basis_function} + \abbrLabel{RBF} + \desc{Radial basis function kernel (RBF)}{RBF = Real function of which the value only depends on the distance of the input}{} + \desc[german]{Radiale Basisfunktion-Kernel (RBF)}{RBF = Reelle Funktion, deren Wert nur vom Abstand zum Ursprung abängt}{} + \eq{k(\vecx_i, \vecx_j) = \Exp{-\frac{\norm{\vecx_i - \vecx_j}_2^2}{\sigma}}} + \end{formula} + + \Subsubsection[ + \eng{Bayesian regression} + \ger{Bayes'sche Regression} + ]{bayes} + + \begin{formula}{linear_regression} + \desc{Bayesian linear regression}{}{} + \desc[german]{Bayes'sche lineare Regression}{}{} + \ttxt{\eng{ + Assume a \fqEqRef{math:pt:bayesian:prior} distribution over the weights. + Offers uncertainties in addition to the predictions. + }} + \end{formula} + + \begin{formula}{ridge} + \desc{Ridge regression}{Regularization method}{} + \desc[german]{Ridge Regression}{}{} + \ttxt{\eng{ + Applies a L2 norm penalty on the weights. + This ensures unimportant features are less regarded and do not encode noise. + \\Corresponds to assuming a \fqEqRef{math:pt:bayesian:prior} \absRef{multivariate_normal_distribution} with $\vec{mu} = 0$ and independent components ($\mat{\Sigma}$) for the weights. + }\ger{ + Reduziert Gewichte mit der L2-Norm. + Dadurch werden unwichtige Features nicht berücksichtigt (kleines Gewicht) und enkodieren nicht Noise. + \\Entspricht der Annahme einer \absRef[Normalverteilung]{multivariate_normal_distribution} mit $\vec{mu}=0$ und unanhängingen Komponenten ($\mat{Sigma}$ diagonaol) der die Gewichte als \fqEqRef{math:pt:bayesian:prior}. + }} + \end{formula} + + \begin{formula}{ridge_weights} + \desc{Optimal weights}{for ridge regression}{$\lambda = \frac{\sigma^2}{\xi^2}$ shrinkage parameter, $\xi$ \absRef{variance} of the gaussian \fqEqRef{math:pt:bayesian:prior}, $\sigma$ \absRef{variance} of the gaussian likelihood of the data} + \desc[german]{Optimale Gewichte}{für Ridge Regression}{} + \eq{\vec{\beta} = \left(\mat{X}^\T \mat{X} + \lambda \mathcal{1} \right)^{-1} \mat{X}^\T \vecy} + \TODO{Does this only work for gaussian data?} + \end{formula} + + \begin{formula}{lasso} + \desc{Lasso regression}{Least absolute shrinkage and selection operator\\Regularization method}{} + \desc[german]{Lasso Regression}{}{} + \ttxt{\eng{ + Applies a L1 norm penalty on the weights, which means features can be disregarded entirely. + \\Corresponds to assuming a \absRef{laplace_distribution} for the weights as \fqEqRef{math:pt:bayesian:prior}. + }\ger{ + Reduziert Gewichte mit der L1-Norm. + Unwichtige Features werden reduziert und können auch ganz vernachlässigt werden und enkodieren nicht Noise. + \\Entspricht der Annahme einer \absRef[Laplace-Verteilung]{laplace_distribution} der die Gewichte als \fqEqRef{math:pt:bayesian:prior}. + }} + \end{formula} + + + + \begin{formula}{gaussion_process_regression} + \desc{Gaussian process regression (GPR)}{}{} + % \desc[german]{}{}{} + \ttxt{\eng{ + Gaussian process: A distribtuion over functions that produce jointly gaussian distribution. + Multivariate normal distribution like \secEqRef{bayesian}, except that $\vec{\mu}$ and $\mat{\Sigma}$ are functions. + GPR: non-parametric Bayesion regressor, does not assume fixed functional form for the underlying data, instead, the data determines the functional shape, + with predictions governed by the covariance structure defined by the kernel (often \abbrRef{radial_basis_function}). + + Offers uncertainties in addition to the predictions. + \TODO{cleanup} + }} + \end{formula} + \TODO{soap} \Subsection[ \eng{Gradient descent} diff --git a/src/constants.tex b/src/constants.tex index d5c86f6..726f829 100644 --- a/src/constants.tex +++ b/src/constants.tex @@ -52,3 +52,11 @@ \val{1.602176634\xE{-19}}{\coulomb} } \end{formula} + + \begin{formula}{atomic_mass_unit} + \desc{Atomic mass unit}{}{} + \desc[german]{Atomare Massneinheit}{}{} + \constant{u}{exp}{ + \val{1.66053906892(52)\xE{-27}}{\kg} + } + \end{formula} diff --git a/src/main.tex b/src/main.tex index 76a8e7b..10cfc48 100644 --- a/src/main.tex +++ b/src/main.tex @@ -2,7 +2,7 @@ % (for vimtex) \documentclass[11pt, a4paper]{article} % SET LANGUAGE HERE -\usepackage[german]{babel} +\usepackage[english]{babel} \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry} % ENVIRONMENTS etc \usepackage{adjustbox} @@ -87,10 +87,6 @@ \newcommand{\TODO}[1]{{\color{fg-red}TODO:#1}} \newcommand{\ts}{\textsuperscript} - -% \usepackage{xstring} - - % Create a text file with relevant labels for vim-completion \newwrite\labelsFile \immediate\openout\labelsFile=\jobname.labels.txt @@ -101,6 +97,7 @@ \input{circuit.tex} \input{util/macros.tex} +\input{util/math-macros.tex} \input{util/environments.tex} % requires util/translation.tex to be loaded first \usepackage{pkg/mqlua} \usepackage{pkg/mqfqname} @@ -115,26 +112,11 @@ \usepackage{pkg/mqformula} \usepackage{pkg/mqperiodictable} -% INPUT -% 1: starting pattern of files to input using the Input command. All other files are ignored -\newcommand\InputOnly[1]{\edef\inputOnlyFile{#1}} -\edef\inputOnlyFile{all} -\newcommand\Input[1]{ - % yes this could surely be done in tex - \directlua{ - if '\luaescapestring{\inputOnlyFile}' == 'all' or string.startswith('\luaescapestring{#1}', '\luaescapestring{\inputOnlyFile}') then - tex.print("\\input{\luaescapestring{#1}}") - end - } -} \title{Formelsammlung} \author{Matthias Quintern} \date{\today} \begin{document} -\IfFileExists{\jobname.translations.aux}{% - \input{\jobname.translations.aux} -}{} \makeatletter\let\percentchar\@percentchar\makeatother @@ -145,7 +127,7 @@ \input{util/translations.tex} -% \InputOnly{ch} +% \InputOnly{comp} \Input{math/math} \Input{math/linalg} diff --git a/src/math/calculus.tex b/src/math/calculus.tex index 1685109..c85b4bd 100644 --- a/src/math/calculus.tex +++ b/src/math/calculus.tex @@ -143,9 +143,9 @@ \end{formula} \begin{formula}{delta_of_function} - \desc{Dirac-Delta of a function}{}{$g(x_0) = 0$} + \desc{Dirac-Delta of a function}{}{$f(x_i) = 0$} \desc[german]{Dirac-Delta einer Funktion}{}{} - \eq{\delta(f(x)) = \frac{\delta(x-x_0)}{\abs{g^\prime(x_0)}}} + \eq{\delta(f(x)) = \sum_i \frac{\delta(x-x_i)}{\abs{f^\prime(x_i)}}} \end{formula} \begin{formula}{geometric_series} @@ -208,6 +208,12 @@ \eq{\Grad^2 = \laplace = \frac{1}{r^2} \pdv{}{r} \left(r^2 \pdv{}{r}\right)} \end{formula} + \begin{formula}{p-norm} + \desc{$p$-norm}{}{} + \desc[german]{$p$-Norm}{}{} + \eq{\norm{\vecx}_p \equiv \left(\sum_{i=1}^{n} \abs{x_i}^p\right)^\frac{1}{p}} + \end{formula} + \Subsection[ \eng{Integrals} @@ -317,5 +323,3 @@ \TODO{differential equation solutions} - - diff --git a/src/math/linalg.tex b/src/math/linalg.tex index 8f9ecdf..cfa3a6f 100644 --- a/src/math/linalg.tex +++ b/src/math/linalg.tex @@ -107,6 +107,12 @@ \mat{\theta} = (\mat{X}^\T \mat{X})^{-1} \mat{X}^\T \vec{y} } \end{formula} + + \begin{formula}{woodbury_matrix_identity} + \desc{Woodbury matrix identity}{Inverse of a rank-$k$ correction}{$\matA\,n\times n$, $\matU\,n\times k$, $\matC\,k\times k$, $\matV \, k\times n$} + \desc[german]{Woodbury-Matrix-Identität}{Inverse einer Rang-$k$-Korrektur}{} + \eq{(\matA + \matU + \matC + \matV){-1} = \matA^{-1}-\matA^{-1} \matU(\matC^{-1} + \matV \matA^{-1} \matU)^{-1} \matV \matA^{-1}} + \end{formula} \begin{formula}{inverse_2x2} diff --git a/src/math/probability_theory.tex b/src/math/probability_theory.tex index 256b1ea..c54ced0 100644 --- a/src/math/probability_theory.tex +++ b/src/math/probability_theory.tex @@ -4,6 +4,7 @@ ]{pt} \begin{formula}{mean} + \absLabel \desc{Mean}{Expectation value}{} \desc[german]{Mittelwert}{Erwartungswert}{} \eq{\braket{x} = \int w(x)\, x\, \d x} @@ -11,18 +12,21 @@ \begin{formula}{variance} + \absLabel \desc{Variance}{Square of the \fqEqRef{math:pt:std-deviation}}{} \desc[german]{Varianz}{Quadrat der\fqEqRef{math:pt:std-deviation}}{} \eq{\sigma^2 = (\Delta \hat{x})^2 = \Braket{\hat{x}^2} - \braket{\hat{x}}^2 = \braket{(x - \braket{x})^2}} \end{formula} \begin{formula}{covariance} + \absLabel \desc{Covariance}{}{} \desc[german]{Kovarianz}{}{} \eq{\cov(x,y) = \sigma(x,y) = \sigma_{XY} = \Braket{(x-\braket{x})\,(y-\braket{y})}} \end{formula} \begin{formula}{std-deviation} + \absLabel \desc{Standard deviation}{}{} \desc[german]{Standardabweichung}{}{} \eq{\sigma = \sqrt{\sigma^2} = \sqrt{(\Delta x)^2}} @@ -74,7 +78,8 @@ \eng{Continuous probability distributions} \ger{Kontinuierliche Wahrscheinlichkeitsverteilungen} ]{cont} - \begin{bigformula}{normal} + \begin{bigformula}{normal} + \absLabel[normal_distribution] \desc{Gauß/Normal distribution}{}{} \desc[german]{Gauß/Normal-Verteilung}{}{} \begin{minipage}{\distleftwidth} @@ -94,13 +99,36 @@ \end{distribution} \end{bigformula} - \begin{formula}{standard_normal_distribution} + \begin{formula}{standard_normal} + \absLabel[standard_normal_distribution] \desc{Density function of the standard normal distribution}{$\mu = 0$, $\sigma = 1$}{} \desc[german]{Dichtefunktion der Standard-Normalverteilung}{$\mu = 0$, $\sigma = 1$}{} \eq{\varphi(x) = \frac{1}{\sqrt{2\pi}} \e^{-\frac{1}{2}x^2}} \end{formula} + \begin{bigformula}{multivariate_normal} + \absLabel[multivariate_normal_distribution] + \desc{Multivariate normal distribution}{Multivariate Gaussian distribution}{$\vec{mu}$ \absRef{mean}, $\mat{\Sigma}$ \absRef{covariance}} + \desc[german]{Mehrdimensionale Normalverteilung}{Multivariate Normalverteilung}{} + \begin{distribution} + \disteq{parameters}{\vec{\mu} \in \R^k,+\quad \mat{\Sigma} \in \R^{k\times k}} + \disteq{support}{\vec{x} \in \vec{\mu} + \text{span}(\mat{\Sigma})} + \disteq{pdf}{\mathcal{N}(\vec{mu}, \mat{\Sigma}) = \frac{1}{(2\pi)^{k/2}} \frac{1}{\sqrt{\det{\Sigma}}} \Exp{-\frac{1}{2} \left(\vecx-\vec{\mu}\right)^\T \mat{\Sigma}^{-1} \left(\vecx-\vec{\mu}\right)}} + \disteq{mean}{\vec{\mu}} + \disteq{variance}{\mat{\Sigma}} + \end{distribution} + \TODO{k-variate normal plot} + \end{bigformula} + + \begin{formula}{laplace} + \absLabel[laplace_distribution] + \desc{Laplace-distribution}{}{} + \desc[german]{Laplace-Verteilung}{}{} + \TODO{TODO} + \end{formula} + \begin{bigformula}{cauchy} + \absLabel[lorentz_distribution] \desc{Cauchys / Lorentz distribution}{Also known as Cauchy-Lorentz distribution, Lorentz(ian) function, Breit-Wigner distribution.}{} \desc[german]{Cauchy / Lorentz-Verteilung}{Auch bekannt als Cauchy-Lorentz Verteilung, Lorentz Funktion, Breit-Wigner Verteilung.}{} \begin{minipage}{\distleftwidth} @@ -121,6 +149,7 @@ \end{bigformula} \begin{bigformula}{maxwell-boltzmann} + \absLabel[maxwell-boltzmann_distribution] \desc{Maxwell-Boltzmann distribution}{}{} \desc[german]{Maxwell-Boltzmann Verteilung}{}{} \begin{minipage}{\distleftwidth} @@ -142,6 +171,7 @@ \begin{bigformula}{gamma} + \absLabel[gamma_distribution] \desc{Gamma Distribution}{with $\lambda$ parameter}{$\Gamma$ \fqEqRef{math:cal:integral:list:gamma}, $\gamma$ \fqEqRef{math:cal:integral:list:lower_incomplete_gamma_function}} \desc[german]{Gamma Verteilung}{mit $\lambda$ Parameter}{} \begin{minipage}{\distleftwidth} @@ -305,8 +335,8 @@ \eq{L:\Theta \rightarrow [0,1], \quad \theta \mapsto \rho(x|\theta)} \end{formula} \begin{formula}{likelihood_independant} - \desc{Likelihood function}{for independent and identically distributed random variables}{$x_i$ $n$ random variables, $\rho$ \fqEqRef{math:pt:pdf} $x\mapsto \rho(x|\theta)$ depending on parameter $\theta$} - \desc[german]{Likelihood function}{für unabhängig und identisch verteilte Zufallsvariablen}{$x_i$ $n$ Zufallsvariablen$\rho$ \fqEqRef{math:pt:pdf} $x\mapsto \rho(x|\theta)$ hängt ab von Parameter $\theta$} + \desc{Likelihood function}{for independent and identically distributed random variables}{$x_i$ $n$ random variables, $\rho$ \fqEqRef{math:pt:pdf} $x\mapsto f(x|\theta)$ depending on parameter $\theta$} + \desc[german]{Likelihood function}{für unabhängig und identisch verteilte Zufallsvariablen}{$x_i$ $n$ Zufallsvariablen$\rho$ \fqEqRef{math:pt:pdf} $x\mapsto f(x|\theta)$ hängt ab von Parameter $\theta$} \eq{L(\theta) = \prod_{i=1}^n f(x_i;\theta)} \end{formula} \begin{formula}{maximum_likelihood_estimate} diff --git a/src/pkg/mqformula.sty b/src/pkg/mqformula.sty index 664ce87..a626b45 100644 --- a/src/pkg/mqformula.sty +++ b/src/pkg/mqformula.sty @@ -118,10 +118,10 @@ ##2% \end{alignat} } - \newcommand{\fig}[2][1.0]{ + \newcommand{\fig}[1]{ \newFormulaEntry \centering - \includegraphics[width=##1\textwidth]{##2} + \includegraphics{##1} } % 1: content for the ttext environment \newcommand{\ttxt}[2][#1:desc]{ @@ -163,7 +163,7 @@ \begingroup \label{f:\fqname:#1} - \storeLabel{\fqname:#1} + \storeLabel{\fqname:#1} % write label witout type prefix to aux file \par\noindent\ignorespaces % \textcolor{gray}{\hrule} % \vspace{0.5\baselineskip} @@ -189,6 +189,7 @@ \par\noindent \begin{minipage}{\textwidth} % using a minipage to now allow line breaks within the bigformula \label{f:\fqname:#1} + \storeLabel{\fqname:#1} % write label witout type prefix to aux file \par\noindent\ignorespaces % \textcolor{gray}{\hrule} % \vspace{0.5\baselineskip} diff --git a/src/pkg/mqfqname.sty b/src/pkg/mqfqname.sty index 45c1dbd..68153cc 100644 --- a/src/pkg/mqfqname.sty +++ b/src/pkg/mqfqname.sty @@ -132,7 +132,7 @@ % \newrobustcmd{\qtyRef}[1]{% \edef\tempname{\luaDoubleFieldValue{quantities}{"#1"}{"linkto"}}% - \hyperref[qty:#1]{\expandafter\GT\expandafter{\tempname:#1}}% + \hyperref[qty:#1]{\GT{\tempname:#1}}% } % \newrobustcmd{\QtyRef}[1]{% @@ -142,7 +142,7 @@ % \newrobustcmd{\constRef}[1]{% \edef\tempname{\luaDoubleFieldValue{constants}{"#1"}{"linkto"}}% - \hyperref[const:#1]{\expandafter\GT\expandafter{\tempname:#1}}% + \hyperref[const:#1]{\GT{\tempname:#1}}% } % \newrobustcmd{\ConstRef}[1]{% @@ -184,11 +184,12 @@ abbrLabels["#2"]["fqname"] = [[#1]] } } -% [1]: +% [1]: text +% 2: key \newrobustcmd{\absRef}[2][\relax]{% \directlua{ if absLabels["#2"] == nil then - tex.sprint("\\detokenize{#2}???") + tex.sprint(string.sanitize(\luastring{#2}) .. "???") else if "#1" == "" then %-- if [#1] is not given, use translation of key as text, else us given text tex.sprint("\\hyperref[" .. absLabels["#2"] .. "]{\\GT{" .. absLabels["#2"] .. "}}") @@ -201,7 +202,7 @@ \newrobustcmd{\abbrRef}[1]{% \directlua{ if abbrLabels["#1"] == nil then - tex.sprint("\\detokenize{#1}???") + tex.sprint(string.sanitize(\luastring{#1}) .. "???") else tex.sprint("\\hyperref[" .. abbrLabels["#1"]["fqname"] .. "]{" .. abbrLabels["#1"]["abbr"] .. "}") end diff --git a/src/pkg/mqlua.sty b/src/pkg/mqlua.sty index b920967..cbee5d6 100644 --- a/src/pkg/mqlua.sty +++ b/src/pkg/mqlua.sty @@ -57,7 +57,7 @@ end function string.sanitize(s) % -- Use gsub to replace the specified characters with an empty string - local result = s:gsub("[_^&]", "") + local result = s:gsub("[_^&]", " ") return result end } diff --git a/src/pkg/mqquantity.sty b/src/pkg/mqquantity.sty index 14a8501..dab9f0c 100644 --- a/src/pkg/mqquantity.sty +++ b/src/pkg/mqquantity.sty @@ -3,9 +3,7 @@ \RequirePackage{etoolbox} \directLuaAux{ - if quantities == nil then - quantities = {} - end + quantities = quantities or {} } % [1]: label to point to @@ -31,13 +29,13 @@ \newcommand\quantity@print[1]{ \begingroup % for label Symbol: $\luavar{quantities["#1"]["symbol"]}$ - \\Unit: $\directlua{split_and_print_units(quantities["#1"]["units"])}$ + \hfill Unit: $\directlua{split_and_print_units(quantities["#1"]["units"])}$ % % label it only once \directlua{ if quantities["#1"]["labeled"] == nil then quantities["#1"]["labeled"] = true tex.print("\\label{qty:#1}") end - } - \endgroup + }% + \endgroup% } diff --git a/src/pkg/mqtranslation.sty b/src/pkg/mqtranslation.sty index f5c29c5..1ede79e 100644 --- a/src/pkg/mqtranslation.sty +++ b/src/pkg/mqtranslation.sty @@ -11,10 +11,11 @@ -- string to append to missing translations -- unknownTranslation = "???" unknownTranslation = "" + -- language that is set in usepackage[]{babel} language = "\languagename" fallbackLanguage = "english" - -- using additional .aux extension because vimtex wouldnt stop compiling otherwise - translationsFilepath = OUTDIR .. "/translations.lua.aux" or "/tmp/translations.lua" + -- using additional extension because vimtex wouldnt stop compiling otherwise + translationsFilepath = OUTDIR .. "/translations.lua.txt" or "/tmp/translations.lua.txt" function tlAdd(language, key, value) if value == "" then diff --git a/src/qm/qm.tex b/src/qm/qm.tex index ff39b5e..1db502a 100644 --- a/src/qm/qm.tex +++ b/src/qm/qm.tex @@ -218,6 +218,16 @@ } \end{formula} + \begin{formula}{variational_principle} + \desc{Variational principle}{}{} + \desc[german]{Variationsprinzip}{}{} + \ttxt{\eng{ + If $\hat{H}\psi = E\psi$, then $E_0 \le E = \Braket{\psi|\hat{H}|\psi}$. The ground state can thus be found by varying $\psi$ until $E$ is minimized. + }\ger{ + Wenn $\hat{H}\psi = E\psi$, dann ist $E_0 \le E = \Braket{\psi|\hat{H}|\psi}$. Der Grundzustand kann daher gefunden werden, indem $\psi$ variiert wird bis die Energie minimiert ist. + }} + \end{formula} + \Subsection[ \eng{Time evolution} \ger{Zeitentwicklug} diff --git a/src/quantities.tex b/src/quantities.tex index 87ea284..661a43e 100644 --- a/src/quantities.tex +++ b/src/quantities.tex @@ -85,7 +85,7 @@ \begin{formula}{pressure} \desc{Pressure}{}{} \desc[german]{Druck}{}{} - \quantity{p}{\newtone\per\m^2}{} + \quantity{p}{\newton\per\m^2}{} \end{formula} diff --git a/src/statistical_mechanics.tex b/src/statistical_mechanics.tex index d690410..8fe8afb 100644 --- a/src/statistical_mechanics.tex +++ b/src/statistical_mechanics.tex @@ -526,8 +526,8 @@ \begin{formula}{maxwell_velocity} - \desc{Maxwell velocity distribution}{See also \ref{sec:pt:distributions::maxwell-boltzmann}}{} - \desc[german]{Maxwellsche Geschwindigkeitsverteilung}{Siehe auch \ref{sec:pt:distributions::maxwell-boltzmann}}{} + \desc{Maxwell velocity distribution}{See \absRef{maxwell-boltzmann_distribution}}{} + \desc[german]{Maxwellsche Geschwindigkeitsverteilung}{Siehe auch \absRef{maxwell-boltzmann_distribution}}{} \eq{w(v) \d v = 4\pi \left(\frac{\beta m}{2\pi}\right)^\frac{3}{2} v^2 \e^{-\frac{\beta m v^2}{2}} \d v} \end{formula} @@ -612,17 +612,18 @@ % b - \frac{a}{\kB T}} \end{formula} - \begin{formula}{lennard_jones} \absLabel + \begin{formula}{lennard_jones} + \absLabel \desc{Lennard-Jones potential}{Potential between two molecules. Attractive for $r > \sigma$, repulsive for $r < \sigma$.\\ In condensed matter: Attraction due to Landau Dispersion \TODO{verify} and repulsion due to Pauli exclusion principle.}{} \desc[german]{Lennard-Jones-Potential}{Potential zwischen zwei Molekülen. Attraktiv für $r > \sigma$, repulsiv für $r < \sigma$.\\ In Festkörpern: Anziehung durch Landau-Dispersion und Abstoßung durch Pauli-Prinzip.}{} - \fig[0.7]{img/potential_lennard_jones.pdf} + \fig{img/potential_lennard_jones.pdf} \eq{V(r) = 4\epsilon \left[\left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6}\right]} \end{formula} \Subsection[ \eng{Van der Waals equation} \ger{Van der Waals Gleichung} - ]{vdw} + ]{vdw} \begin{ttext} \eng{Assumes a hard-core potential with a weak attraction.} \ger{Annahme eines Harte-Kugeln Potentials mit einer schwachen Anziehung} @@ -688,7 +689,7 @@ \begin{formula}{occupation_number} \desc{Occupation number}{}{\bosfer} \desc[german]{Besetzungszahl}{}{\bosfer} - \fig[0.7]{img/td_id_qgas_distributions.pdf} + \fig{img/td_id_qgas_distributions.pdf} \eq{ \braket{n(\epsilon)} &= \frac{1}{\e^{\beta(\epsilon - \mu)} \mp 1} \\ \shortintertext{\GT{for} $\epsilon - \mu \gg \kB T$} @@ -760,7 +761,7 @@ \begin{formula}{occupation} \desc{Occupation number}{Fermi-Dirac distribution. At $T=0$ \textit{Fermi edge} at $\epsilon=\mu$}{} \desc[german]{Besetzungszahl}{Fermi-Dirac Verteilung}{Bei $T=0$ \textit{Fermi-Kante} bei $\epsilon=\mu$} - \fig[0.7]{img/td_fermi_occupation.pdf} + \fig{img/td_fermi_occupation.pdf} \eq{\braket{n_p} = \frac{1}{\e^{\beta(\epsilon-\mu)}+1}} \end{formula} @@ -827,7 +828,7 @@ \begin{formula}{heat_cap} \desc{Heat capacity}{\gt{low_temps}}{differs from \fqEqRef{td:TODO:petit_dulong}} \desc[german]{Wärmecapacity}{\gt{low_temps}}{weicht ab vom \fqEqRef{td:TODO:petit_dulong}} - \fig[0.7]{img/td_fermi_heat_capacity.pdf} + \fig{img/td_fermi_heat_capacity.pdf} \eq{C_V = \pdv{E}{T}_V = N\kB \frac{\pi}{2} \left(\frac{T}{T_\text{F}}\right)} \end{formula} diff --git a/src/util/colorscheme.tex b/src/util/colorscheme.tex index 108423e..36ed1bf 100644 --- a/src/util/colorscheme.tex +++ b/src/util/colorscheme.tex @@ -1,38 +1,28 @@ % This file was generated by scripts/formulary.py % Do not edit it directly, changes will be overwritten -\definecolor{fg-blue}{HTML}{072140} -\definecolor{bg-blue}{HTML}{5E94D4} -\definecolor{alt-blue}{HTML}{3070B3} -\definecolor{bg-yellow}{HTML}{FED702} -\definecolor{fg-yellow}{HTML}{CBAB01} -\definecolor{alt-yellow}{HTML}{FEDE34} -\definecolor{bg-orange}{HTML}{F7811E} -\definecolor{fg-orange}{HTML}{D99208} -\definecolor{alt-orange}{HTML}{F9BF4E} -\definecolor{bg-purple}{HTML}{B55CA5} -\definecolor{fg-purple}{HTML}{9B468D} -\definecolor{alt-purple}{HTML}{C680BB} -\definecolor{bg-red}{HTML}{EA7237} -\definecolor{fg-red}{HTML}{D95117} -\definecolor{alt-red}{HTML}{EF9067} -\definecolor{bg-green}{HTML}{9FBA36} -\definecolor{fg-green}{HTML}{7D922A} -\definecolor{alt-green}{HTML}{B6CE55} -\definecolor{bg-gray}{HTML}{475058} -\definecolor{fg-gray}{HTML}{20252A} -\definecolor{alt-gray}{HTML}{333A41} -\definecolor{bg-aqua}{HTML}{689d6a} -\definecolor{fg-aqua}{HTML}{427b58} -\definecolor{fg0-hard}{HTML}{000000} \definecolor{fg0}{HTML}{000000} -\definecolor{fg0-soft}{HTML}{20252A} -\definecolor{fg1}{HTML}{072140} -\definecolor{fg2}{HTML}{333A41} -\definecolor{fg3}{HTML}{475058} -\definecolor{fg4}{HTML}{6A757E} -\definecolor{bg0-hard}{HTML}{FFFFFF} -\definecolor{bg0}{HTML}{FBF9FA} -\definecolor{bg0-soft}{HTML}{EBECEF} -\definecolor{bg1}{HTML}{DDE2E6} -\definecolor{bg2}{HTML}{E3EEFA} -\definecolor{bg3}{HTML}{F0F5FA} +\definecolor{bg0}{HTML}{ffffff} +\definecolor{fg1}{HTML}{3c3836} +\definecolor{fg2}{HTML}{504945} +\definecolor{fg3}{HTML}{665c54} +\definecolor{fg4}{HTML}{7c6f64} +\definecolor{bg1}{HTML}{ebdbb2} +\definecolor{bg2}{HTML}{d5c4a1} +\definecolor{bg3}{HTML}{bdae93} +\definecolor{bg4}{HTML}{a89984} +\definecolor{fg-red}{HTML}{9d0006} +\definecolor{fg-orange}{HTML}{af3a03} +\definecolor{fg-yellow}{HTML}{b57614} +\definecolor{fg-green}{HTML}{79740e} +\definecolor{fg-aqua}{HTML}{427b58} +\definecolor{fg-blue}{HTML}{076678} +\definecolor{fg-purple}{HTML}{8f3f71} +\definecolor{fg-gray}{HTML}{7c6f64} +\definecolor{bg-red}{HTML}{fb4934} +\definecolor{bg-orange}{HTML}{f38019} +\definecolor{bg-yellow}{HTML}{fabd2f} +\definecolor{bg-green}{HTML}{b8bb26} +\definecolor{bg-aqua}{HTML}{8ec07c} +\definecolor{bg-blue}{HTML}{83a598} +\definecolor{bg-purple}{HTML}{d3869b} +\definecolor{bg-gray}{HTML}{a89984} diff --git a/src/util/fqname.tex b/src/util/fqname.tex deleted file mode 100644 index b017ad9..0000000 --- a/src/util/fqname.tex +++ /dev/null @@ -1,180 +0,0 @@ -% Everything related to referencing stuff - -\newcommand\printFqName{\expandafter\detokenize\expandafter{\fqname}} - -% SECTIONING -% start
, get heading from translation, set label -% secFqname is the fully qualified name of sections: the keys of all previous sections joined with a ':' -% fqname is secFqname: where is the key/id of some environment, like formula -% [1]: code to run after setting \fqname, but before the \part, \section etc -% 2: key -\newcommand{\Part}[2][desc]{ - \newpage - \def\partName{#2} - \def\sectionName{} - \def\subsectionName{} - \def\subsubsectionName{} - \edef\fqname{\partName} - \edef\secFqname{\fqname} - #1 - \edef\fqnameText{\expandafter\GetTranslation\expandafter{\fqname}} - \part{\fqnameText} - \label{sec:\fqname} -} -\newcommand{\Section}[2][]{ - \def\sectionName{#2} - \def\subsectionName{} - \def\subsubsectionName{} - \edef\fqname{\partName:\sectionName} - \edef\secFqname{\fqname} - #1 - % this is necessary so that \section takes the fully expanded string. Otherwise the pdf toc will have just the fqname - \edef\fqnameText{\expandafter\GetTranslation\expandafter{\fqname}} - \section{\fqnameText} - \label{sec:\fqname} -} -% \newcommand{\Subsection}[1]{\Subsection{#1}{}} -\newcommand{\Subsection}[2][]{ - \def\subsectionName{#2} - \def\subsubsectionName{} - \edef\fqname{\partName:\sectionName:\subsectionName} - \edef\secFqname{\fqname} - #1 - \edef\fqnameText{\expandafter\GetTranslation\expandafter{\fqname}} - \subsection{\fqnameText} - \label{sec:\fqname} -} -\newcommand{\Subsubsection}[2][]{ - \def\subsubsectionName{#2} - \edef\fqname{\partName:\sectionName:\subsectionName:\subsubsectionName} - \edef\secFqname{\fqname} - #1 - \edef\fqnameText{\expandafter\GetTranslation\expandafter{\fqname}} - \subsubsection{\fqnameText} - \label{sec:\fqname} -} -\edef\fqname{NULL} - -\newcommand\luaDoubleFieldValue[3]{% - \directlua{ - if #1 \string~= nil and #1[#2] \string~= nil and #1[#2][#3] \string~= nil then - tex.sprint(#1[#2][#3]) - return - end - luatexbase.module_warning('luaDoubleFieldValue', 'Invalid indices to `#1`: `#2` and `#3`'); - tex.sprint("???") - }% -} -% REFERENCES -% All xyzRef commands link to the key using the translated name -% Uppercase (XyzRef) commands have different link texts, but the same link target -% 1: key/fully qualified name (without qty/eq/sec/const/el... prefix) - -% Equations/Formulas -% \newrobustcmd{\fqEqRef}[1]{% -\newrobustcmd{\fqEqRef}[1]{% - % \edef\fqeqrefname{\GT{#1}} - % \hyperref[eq:#1]{\fqeqrefname} - \hyperref[f:#1]{\GT{#1}}% -} -% Formula in the current section -\newrobustcmd{\secEqRef}[1]{% - % \edef\fqeqrefname{\GT{#1}} - % \hyperref[eq:#1]{\fqeqrefname} - \hyperref[f:\secFqname:#1]{\GT{\secFqname:#1}}% -} - -% Section -% -\newrobustcmd{\fqSecRef}[1]{% - \hyperref[sec:#1]{\GT{#1}}% -} -% Quantities -% -\newrobustcmd{\qtyRef}[1]{% - \edef\tempname{\luaDoubleFieldValue{quantities}{"#1"}{"fqname"}}% - \hyperref[qty:#1]{\expandafter\GT\expandafter{\tempname:#1}}% -} -% -\newrobustcmd{\QtyRef}[1]{% - $\luaDoubleFieldValue{quantities}{"#1"}{"symbol"}$ \qtyRef{#1}% -} -% Constants -% -\newrobustcmd{\constRef}[1]{% - \edef\tempname{\luaDoubleFieldValue{constants}{"#1"}{"fqname"}}% - \hyperref[const:#1]{\expandafter\GT\expandafter{\tempname:#1}}% -} -% -\newrobustcmd{\ConstRef}[1]{% - $\luaDoubleFieldValue{constants}{"#1"}{"symbol"}$ \constRef{#1}% -} -% Element from periodic table -% -\newrobustcmd{\elRef}[1]{% - \hyperref[el:#1]{{\color{fg0}#1}}% -} -% -\newrobustcmd{\ElRef}[1]{% - \hyperref[el:#1]{\GT{el:#1}}% -} - - - -% "LABELS" -% These currently do not place a label, -% instead they provide an alternative way to reference an existing label -\directLuaAux{ - if absLabels == nil then - absLabels = {} - end -} -% [1]: target (fqname to point to) -% 2: key -\newcommand{\absLink}[2][sec:\fqname]{ - \directLuaAuxExpand{ - absLabels["#2"] = [[#1]] - } -} -\directLuaAux{ - if abbrLabels == nil then - abbrLabels = {} - end -} -% [1]: target (fqname to point to) -% 2: key -% 3: label (abbreviation) -\newcommand{\abbrLink}[3][sec:\fqname]{ - \directLuaAuxExpand{ - abbrLabels["#2"] = {} - abbrLabels["#2"]["abbr"] = [[#3]] - abbrLabels["#2"]["fqname"] = [[#1]] - } -} -% [1]: -\newrobustcmd{\absRef}[2][\relax]{% - \directlua{ - if absLabels["#2"] == nil then - tex.sprint("\\detokenize{#2}???") - else - if "#1" == "" then %-- if [#1] is not given, use translation of key as text, else us given text - tex.sprint("\\hyperref[" .. absLabels["#2"] .. "]{\\GT{" .. absLabels["#2"] .. "}}") - else - tex.sprint("\\hyperref[" .. absLabels["#2"] .. "]{\luaescapestring{#1}}") - end - end - } -} -\newrobustcmd{\abbrRef}[1]{% - \directlua{ - if abbrLabels["#1"] == nil then - tex.sprint("\\detokenize{#1}???") - else - tex.sprint("\\hyperref[" .. abbrLabels["#1"]["fqname"] .. "]{" .. abbrLabels["#1"]["abbr"] .. "}") - end - } -} - - - -