Skip to content

Instantly share code, notes, and snippets.

@jamesamiller
Created March 18, 2021 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesamiller/2711abb2ca13599300bb35e3fc2cdc31 to your computer and use it in GitHub Desktop.
Save jamesamiller/2711abb2ca13599300bb35e3fc2cdc31 to your computer and use it in GitHub Desktop.
Two-observer diagram of the Barn and Ladder "Paradox" in special relativity
\documentclass[crop=true, border=10pt]{standalone}
\usepackage{comment}
\begin{comment}
:Title: Barn and Ladder
:Author: J A Miller (millerja@uah.edu), 2020/02/04, 2018/06/04
Two-observer diagram of the famous "paradox."
References:
https://gist.github.com/mcnees/45b9f53ad371c38ba6f3759df5880fb1
\end{comment}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\definecolor{plum}{rgb}{0.36078, 0.20784, 0.4}
\definecolor{chameleon}{rgb}{0.30588, 0.60392, 0.023529}
\definecolor{cornflower}{rgb}{0.12549, 0.29020, 0.52941}
\definecolor{scarlet}{rgb}{0.8, 0, 0}
\definecolor{brick}{rgb}{0.64314, 0, 0}
\definecolor{sunrise}{rgb}{0.80784, 0.36078, 0}
\definecolor{lightblue}{rgb}{0.15,0.35,0.75}
\begin{document}
% Define the boost and ladder proper length
\newcommand{\vrel}{0.8} % velocity of primed frame
\newcommand{\gamrel}{1.667} % gamma of primed frame
\newcommand{\etarel}{1.333} % their product
\newcommand{\length}{3} % proper length
\pagestyle{empty}
\begin{tikzpicture}[scale=1,domain=-1:14]
\tikzstyle{axisarrow} = [-{Latex[inset=0pt,length=8pt]}]
% Clip all lines that would fall outside the grid
\clip(-1,-1) rectangle (14,14);
% Draw the grid.
\draw [cornflower!30,step=0.2,thin] (-1,-1) grid (14,14);
\draw [cornflower!60,step=1.0,thin] (-1,-1) grid (14,14);
% Draw Axes
\draw[cornflower,thick,axisarrow] (0,-1) -- (0,14);
\node[inner sep=0pt] at (0.4,13.7) {$t$};
\draw[cornflower,thick,axisarrow] (-1,0) -- (14,0);
\node[inner sep=0pt] at (13.5,-0.3) {$x$};
% Worldlines for ladder
\draw[scarlet,thick,axisarrow,domain=-1:14*\vrel] plot (\x,\x/\vrel);
\draw[scarlet,thick,axisarrow,domain=-1:14*\vrel-0.2] plot (\x+\length,\x/\vrel);
\node[inner sep=0pt,rotate=51] at (2.0,3.0) {Back of Ladder};
\node[inner sep=0pt,rotate=51] at (6.9,4.4) {Front of Ladder};
% Worldlines for barn entrance and exit
\draw[thick,plum,axisarrow] (5,-1) -- (5,14);
\draw[thick,plum,axisarrow] (9,-1) -- (9,14);
\node[inner sep=0pt,rotate=90] at (9.3,1.5) {Back of Barn};
\node[inner sep=0pt,rotate=90] at (4.7,11.0) {Front of Barn};
% Lines of simultaneity
% front of ladder & back of barn
\draw[scarlet,thick,dashed] plot (\x,\vrel*\x+0.5/\gamrel);
\draw[plum,thick,dashed] plot (\x,7.5);
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={below right:B}](B) at (9,7.5) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={above left:A}](A) at (6,7.5) {};
% back of ladder & front of barn
\draw[scarlet,thick,dashed] plot (\x,\vrel*\x+3.75/\gamrel);
\draw[plum,thick,dashed] plot (\x,6.25);
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={below right:C}](C) at (5,6.25) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={below right:D}](D) at (8,6.25) {};
% more points
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={below right:E}](E) at (0.6667,0.6667/\vrel) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={below right:G}](G) at (13.333,10.3333/\vrel) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={right:F}](F) at (5,2/\vrel) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={right:H}](H) at (9,9/\vrel) {};
% color the regions
\draw[fill=plum!40,opacity=0.2] (5,-1) -- (9,-1) -- (9,14) -- (5,14) -- (5,-1);
\draw[fill=scarlet!40,opacity=0.2] (-1*\vrel,-1) -- (3-\vrel,-1) -- (14,11/\vrel) -- (14,14) -- (14*\vrel,14) -- (0,0);
\end{tikzpicture}
\end{document}
@jamesamiller
Copy link
Author

fig-barn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment