Number fluctuations of the occupation probability〈nk〉of a single mode k in an ideal Bose and Fermi gas in the grand canonical ensemble. Used in Exercise Sheet 11 of Statistical Physics by Manfred Salmhofer (2016), available at https://janosh.dev/physics/statistical-physics.
\documentclass{standalone}
\usepackage{pgfplots, mathtools}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel = $T$,
ylabel = $\Delta n_k^+$,
smooth,thick,
axis lines = center,
every tick/.style = thick]
\def\beta{1/x}
\def\ek{1}
\def\mu{0}
\def\bosefluc{1/(2*sinh(\beta/2 * (\ek - \mu)))^2}
\addplot[color=blue,domain = 0:4.2]{\bosefluc};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[
xlabel = $T$,
ylabel = $\Delta n_k^-$,
smooth,thick,
ymax = 0.28,
axis lines = center,
every tick/.style = thick,
yticklabel style = /pgf/number format/fixed]
\def\beta{1/x}
\def\ek{1}
\def\mu{0}
\def\fermfluc{1/(2 + 2*cosh(\beta * (\ek - \mu)))}
\addplot[color=blue,domain = 0:4.2]{\fermfluc};
\end{axis}
\end{tikzpicture}
\end{document}
#import "@preview/cetz:0.3.2": canvas, draw
#import "@preview/cetz-plot:0.1.1": plot
#set page(width: auto, height: auto, margin: 8pt)
#let size = (8, 5)
#canvas({
import draw: translate
draw.set-style(
axes: (
y: (label: (anchor: "north-west", offset: -0.2), mark: (end: "stealth", fill: black)),
x: (label: (anchor: "north", offset: 0.1), mark: (end: "stealth", fill: black)),
),
)
// First plot (Bose fluctuations)
plot.plot(
size: size,
x-min: 0,
x-max: 4.2,
y-min: 0,
x-label: $T$,
y-label: $Delta n_k^+$,
x-tick-step: 1,
y-tick-step: 10,
axis-style: "left",
name: "bose-plot",
{
// Define constants
let (ek, mu) = (1, 0)
// Add the Bose fluctuation curve
plot.add(
style: (stroke: blue + 1.5pt),
domain: (0.01, 4.2), // Avoid x=0 due to division
samples: 200, // More samples for smoother curve
x => {
let beta = 1 / x
let sinh_term = calc.sinh(beta / 2 * (ek - mu))
1 / (2 * sinh_term * sinh_term)
},
)
},
)
// Second plot (Fermi fluctuations)
translate((size.at(0) + 2.5, 0))
plot.plot(
size: size,
x-min: 0,
x-max: 4.2,
y-min: 0,
y-max: 0.28,
x-label: $T$,
y-label: $Delta n_k^-$,
x-tick-step: 1,
y-tick-step: 0.05,
axis-style: "left",
name: "fermi-plot",
{
// Define constants
let (ek, mu) = (1, 0)
// Add the Fermi fluctuation curve
plot.add(
style: (stroke: blue + 1.5pt),
domain: (0.01, 4.2), // Avoid x=0 due to division
samples: 200, // More samples for smoother curve
x => {
let beta = 1 / x
let cosh_term = calc.cosh(beta * (ek - mu))
1 / (2 + 2 * cosh_term)
},
)
},
)
})