Skip to content

Instantly share code, notes, and snippets.

@jamesamiller
Last active February 14, 2021 00:28
Show Gist options
  • Save jamesamiller/115c668b3d75c333776b7a19b331fffa to your computer and use it in GitHub Desktop.
Save jamesamiller/115c668b3d75c333776b7a19b331fffa to your computer and use it in GitHub Desktop.
TikZ plot of the Andromeda "paradox" in special relativity
\documentclass[crop=true, border=10pt]{standalone}
\usepackage{comment}
\begin{comment}
:Title: Attack from Andromeda
:Author: J A Miller (millerja@uah.edu), 2020/02/04
The Andromeda "paradox". Spacetime diagram for aliens launching an attack on Earth, according to three observers: one on the ground in the same frame as the aliens, and two walking past the first in opposite directions with the same speed.
References:
1. https://en.wikipedia.org/wiki/Rietdijk%E2%80%93Putnam_argument
2. https://en.wikipedia.org/wiki/Eternalism_(philosophy_of_time)
Plot style and colors from McNees
https://gist.github.com/mcnees/45b9f53ad371c38ba6f3759df5880fb1
\end{comment}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.markings}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
% 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}
% the speeds of the walking people
\newcommand*\vrel{0.25}
\pgfmathparse{1/sqrt(1-\vrel*\vrel)} \let\gammarel\pgfmathresult
\pgfmathparse{\vrel*\gammarel} \let\etarel\pgfmathresult
% some ancillary calculations
\pgfmathparse{1/\vrel - \vrel} \let\fac\pgfmathresult
\begin{tikzpicture}[scale=1,domain=-3:9]
\tikzstyle{axisarrow} = [-{Latex[inset=0pt,length=8pt]}]
% Draw the grid.
\draw [cornflower!30,step=0.2,thin] (-3,-3) grid (9,9);
\draw [cornflower!60,step=1.0,thin] (-3,-3) grid (9,9);
% Clip all lines that would fall outside the grid, if any
\clip(-3,-3) rectangle (9,9);
% Draw Axes
\draw[thick,cornflower,axisarrow] (0,-3) -- (0,9);
\node[inner sep=0pt] at (0.25,8.7) {$t$};
\draw[thick,cornflower,axisarrow] (-3,0) -- (9,0);
\node[inner sep=0pt] at (8.7,-0.25) {$x$};
% Draw the worldline of Andromeda
\draw[plum,thick,axisarrow] (8,-3) -- (8,9);
% Draw the primed coordinate system
\draw[thick,axisarrow,scarlet] (-3*\vrel,-3) -- (9*\vrel,9) node (tp) {};
\node[inner sep=0pt] at (2.5,8.7) {$t^\prime$};
\draw[thick,axisarrow,scarlet] (0,0) -- (9,\vrel*9) node (xp) {};
\node[inner sep=0pt] at (8.7,1.9) {$x^\prime$};
% Draw the double primed coordinate system (make \vrel negative)
\draw[thick,axisarrow,chameleon] (0,0) -- (-9*\vrel,9) node (tpp) {};
\node[inner sep=0pt] at (-1.8,8.7) {$t^{\prime\prime}$};
\draw[thick,axisarrow,chameleon] (0,0) -- (9,-9*\vrel) node (xpp) {};
\node[inner sep=0pt] at (8.7,-2.5) {$x^{\prime\prime}$};
% Lines of simultaneity
\draw[dashed,thick,scarlet] (8,0) -- (-8*\vrel/\fac,-8/\fac) {};
\draw[dashed,thick,chameleon] (8,0) -- (-8*\vrel/\fac,8/\fac) {};
% Label some points
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={left:T}](T) at (-8*\vrel/\fac,-8/\fac) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={left:A}](A) at (-8*\vrel/\fac,8/\fac) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={above left:S}](S) at (0,0) {};
\node[circle,draw=cornflower!70,fill=cornflower!20,inner sep=2pt,label={above right:L}](L) at (8,0) {};
% Label the worldlines
\node[inner sep=0pt,rotate=90] at (7.7,5.2) {Andromeda worldline};
\node[inner sep=0pt,rotate=90] at (-0.3,5.2) {Stationary observer worldline};
\node[inner sep=0pt,rotate=76] at (1.6,5.2) {Toward Andromeda};
\node[inner sep=0pt,rotate=-76] at (-1.6,5.2) {Away from Andromeda};
\end{tikzpicture}
\end{document}
@jamesamiller
Copy link
Author

Andromeda v1

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