« home

Bose Einstein Distribution

physicsstatistical mechanicscetztikz

Illustrating the change in the real part of the Bose-Einstein distribution, i.e. the average occupancy of the ground state of a bosonic system, from doubling the temperature. Pulled from arxiv:1712.09863.


Bose Einstein Distribution

  Download

PNGPDFSVG

  Code

  LaTeX

bose-einstein-distribution.tex (40 lines)

\documentclass{standalone}

\usepackage{pgfplots,mathtools}
\pgfplotsset{compat=newest}

\usetikzlibrary{intersections}

\let\Re\relax
\DeclareMathOperator{\Re}{Re}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
      domain = 0:2, ymax = 5,
      xlabel = $\Re(p_0)$,
      ylabel = $n_\text{B}(p_0)$,
      ticks=none, smooth,
      thick, axis lines = left,
      every tick/.style = {thick},
      width=8cm, height=7cm]

    \def\nB#1{1/(e^(x/#1) - 1) + 1/2}

    \addplot[name path=T1, color=red] {\nB{0.5}};

    \addplot[name path=T2, color=yellow] {\nB{1}};

    \addplot[name path=T3, color=blue] {\nB{2}};

    \addplot[draw=none, name path=aux] {3*x};

  \end{axis}

  \draw[shorten >=2, shorten <=2, name intersections={of=T1 and aux, name=int1}, name intersections={of=T2 and aux, name=int2}] (int1-1) edge[->, bend left] node[midway, below right=-1pt, font=\scriptsize] {$2 \cdot T$} (int2-1);

  \draw[shorten >=2, shorten <=2, name intersections={of=T3 and aux, name=int3}] (int2-1) edge[->, bend left] node[midway, below right=-1pt, font=\scriptsize] {$2 \cdot T$} (int3-1);

\end{tikzpicture}
\end{document}

  Typst

bose-einstein-distribution.typ (68 lines)

#import "@preview/cetz:0.3.2": canvas, draw
#import "@preview/cetz-plot:0.1.1": plot
#import draw: content, line, bezier

#set page(width: auto, height: auto, margin: 8pt)

// Bose-Einstein distribution function
#let n_B(x, T) = {
  if x == 0 or T == 0 { return 0.5 }
  let ratio = x / T
  1 / (calc.exp(ratio) - 1) + 0.5
}

#canvas({
  draw.set-style(axes: (y: (label: (anchor: "south-east", angle: 90deg)), x: (label: (anchor: "north-east"))))

  plot.plot(
    size: (8, 7),
    x-label: $"Re"(p_0)$,
    y-label: $n_"B" (p_0)$,
    x-min: 0,
    y-min: 0,
    y-max: 5,
    x-tick-step: none,
    y-tick-step: none,
    axis-style: "left",
    {
      // Plot distributions for different temperatures
      for (T, color) in ((0.5, red), (1, orange), (2, blue)) {
        plot.add(
          style: (stroke: color + 1.5pt),
          domain: (0.01, 2),
          samples: 150,
          x => n_B(x, T),
        )
      }
    },
  )

  // Add curved arrows between intersection points
  // We approximate the intersection points since CeTZ doesn't have direct intersection support
  let arrow-style = (
    end: "stealth",
    stroke: black + 1pt,
    fill: black,
  )

  // First arrow (T=0.5 to T=1)
  bezier(
    (1.8, 1.7), // start point
    (2.4, 2.4), // end point
    (2, 2.3), // control point
    mark: arrow-style,
    name: "arrow1",
  )
  content("arrow1.mid", text(size: 8pt)[$2 dot T$], anchor: "south-east")

  // Second arrow (T=1 to T=2)
  bezier(
    (2.4, 2.5), // start point
    (3.5, 3.2), // end point
    (2.9, 3.3), // control point
    mark: arrow-style,
    name: "arrow2",
  )
  content("arrow2.mid", text(size: 8pt)[$2 dot T$], anchor: "south-east")
})