Skip to content

Instantly share code, notes, and snippets.

@jamesamiller
Last active February 14, 2021 01:08
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/ed461b5a55cbeed3a208fd6e7fd338d3 to your computer and use it in GitHub Desktop.
Save jamesamiller/ed461b5a55cbeed3a208fd6e7fd338d3 to your computer and use it in GitHub Desktop.
Lorentz Contraction
\documentclass[crop=true, border=10pt]{standalone}
\usepackage{comment}
\begin{comment}
:Title: Length Contraction
:Author: J A Miller (millerja@uah.edu), 2021/02/13
Length contraction illustration
Plot style from
https://gist.github.com/mcnees/45b9f53ad371c38ba6f3759df5880fb1
---------------------------------------------------------------------
Figure caption
---------------------------------------------------------------------
\caption{
Spacetime diagram for a train with velocity in the unprimed frame $v = 3/5$. \textit{Red arrows:} The primed frame of the train. \textit{Blue arrows:} The unprimed frame of the ground. \textit{Thick lines:} The train length as measured in the two frames.
}
\end{comment}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
% colors
\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
\newcommand*\vrel{0.6} % velocity of primed frame
\newcommand*\gamrel{1.25} % gamma of primed frame
\newcommand*\etarel{0.75} % their product
\begin{tikzpicture}[scale=1,domain=0:3]
\tikzstyle{axisarrow} = [-{Latex[inset=0pt,length=7pt]}]
% Draw the grid.
\draw [cornflower!30,step=0.2,thin] (-1,-1) grid (8,8);
\draw [cornflower!60,step=1.0,thin] (-1,-1) grid (8,8);
% Clip all lines that would fall outside the grid, if any
%\clip(-1,-1) rectangle (10,8);
% Draw the worldlines of the front and back of the train
\draw[scarlet,thick,axisarrow] (0,0) -- (\vrel*8,8);
\node[inner sep=0pt] at (4.9,7.6) {$t^\prime$};
\draw[scarlet,thick,axisarrow] (3,0) -- (\vrel*8+3,8);
% Draw x primed axes
\draw[scarlet,axisarrow] (0,0) -- (8,\vrel*8);
\node[inner sep=0pt] at (7.7,4.4) {$x^\prime$};
% Draw train length in unprimed frame
\draw[line width=2,cornflower] (0,0) -- (3,0);
\draw[line width=2,cornflower] (3,5) -- (6,5);
% Draw train length in primed frame
\draw[line width=2,scarlet] (0,0) -- (5*15/16,3*15/16);
\draw[line width=2,scarlet] (3,5) -- (5*15/16+3,3*15/16+5);
% Draw unprimed axes. Do last to overprint.
\draw[thick,cornflower,axisarrow] (0,-1) -- (0,8);
\node[inner sep=0pt] at (0.25,7.5) {$t$};
\draw[thick,cornflower,axisarrow] (-1,0) -- (8,0);
\node[inner sep=0pt] at (7.5,-0.25) {$x$};
% Labels
\node[inner sep=0pt,rotate=59] at (4.0,1.2) {Front of the train};
\node[inner sep=0pt,rotate=59] at (1.4,3.0) {Back of the train};
\node[inner sep=0pt,rotate=32] at (2.5,1.9) {Length in train frame};
\node[inner sep=0pt] at (1.5,-0.3) {Length in track frame};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={right:A}](A) at (\gamrel*\gamrel*3,\vrel*\gamrel*\gamrel*3) {};
\end{tikzpicture}
\end{document}
@jamesamiller
Copy link
Author

fig-lengthcontraction

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