« home

Ergodic

physicsstatistical mechanicscetztikz

Ergodic

  Download

PNGPDFSVG

  Code

  LaTeX

ergodic.tex (29 lines)

\documentclass[tikz]{standalone}

\usepackage{amssymb}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{tikzpicture}[thick]

  % Axes
  \def\x{5}\def\y{3}
  \draw[->] (-\x-0.5,0) -- (\x+0.5,0) node[right] {$q_1$};
  \draw[->] (0,-\y-0.5) -- (0,\y+0.5) node[above] {$q_2$};

  % Ellipse
  \draw[blue,fill=blue,fill opacity=0.05] (0,0) circle [x radius=\x, y radius=\y];
  \coordinate[pin={[pin distance=25,scale=0.8]85:$\sqrt{2E/m}$}] (r1) at (\x,0);
  \coordinate[pin={[pin distance=25,scale=0.8]30:$\sqrt{2E/k}$}] (r2) at (0,\y);
  \node[blue] at (10:\x-0.6) {$P$};

  % Rectangle
  \draw[orange,fill=orange,fill opacity=0.1] (220:\x+0 and \y+0) rectangle (40:\x+0 and \y+0);
  \node[orange] at (-\x/4,\y/2) {$R$ for $\omega \notin \mathbb{Q}$};

  % Trajectory
  \draw[red] plot [smooth cycle] coordinates {(140:\x-0.1 and \y-0.1) (280:1.8) (40:\x-0.1 and \y-0.1) (260:1.8)} node[shift={(2.5,0.5)},align=center] {$R$ for \\$\omega = 2 \in \mathbb{Q}$};

\end{tikzpicture}
\end{document}

  Typst

ergodic.typ (74 lines)

#import "@preview/cetz:0.3.2": canvas, draw

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

#canvas({
  import draw: line, content, circle, rect, hobby

  let rx = 5
  let ry = 3
  let arrow-style = (mark: (end: "stealth", fill: black), stroke: 1pt)

  // Axes
  line((-rx - 0.5, 0), (rx + 0.5, 0), ..arrow-style)
  content((rx + 0.5, 0), $q_1$, anchor: "west", padding: 2pt)

  line((0, -ry - 0.5), (0, ry + 0.5), ..arrow-style)
  content((0, ry + 0.5), $q_2$, anchor: "south", padding: 2pt)

  // Ellipse
  circle(
    (0, 0),
    radius: (rx, ry),
    stroke: blue,
    fill: rgb(0%, 0%, 100%, 5%),
    name: "ellipse",
  )

  // Labels for radii
  content((rx + .2, 1), $sqrt(2E \/ m)$, anchor: "south-west", padding: 1pt, name: "r1")
  line((rx, 0), "r1.south", stroke: 0.2pt)
  content((0.5, ry + .5), $sqrt(2E \/ k)$, anchor: "south-west", padding: 1pt, name: "r2")
  line((0, ry), "r2.south-west", stroke: 0.2pt)

  // Label P
  content((rx - 0.6, 0.2), text(fill: blue)[$P$])

  let rect-scale = calc.sqrt(2) / 2 // scale rectangle so corners touch ellipse
  rect(
    (-rx * rect-scale, -ry * rect-scale),
    (rx * rect-scale, ry * rect-scale),
    stroke: rgb("#ffa500"),
    fill: rgb(100%, 65%, 0%, 10%),
    name: "rect",
  )
  content((-rx / 4, ry / 2), text(fill: rgb("#ffa500"))[$R$ for $omega in.not QQ$])

  // Trajectory
  hobby(
    (-rx * rect-scale, ry * rect-scale),
    (-1.1, -ry * rect-scale + 0.4),
    (-.5, -ry * rect-scale + 0.1),
    (.1, -ry * rect-scale + 0.4),
    (rx * rect-scale, ry * rect-scale),
    omega: 0,
    stroke: red,
  )
  hobby(
    (-rx * rect-scale, ry * rect-scale),
    (-.1, -ry * rect-scale + 0.4),
    (.5, -ry * rect-scale + 0.1),
    (1.1, -ry * rect-scale + 0.45),
    (rx * rect-scale, ry * rect-scale),
    omega: 0,
    stroke: red,
  )
  content(
    (2.5, -1.3),
    align(
      center,
      text(fill: red)[$R$ for\ $omega = 2 in QQ$],
    ),
  )
})