2

I am trying to draw the Penrose diagram for the motion of a particle in a Schwartzschild background. I was able to draw the diagram thansk to This article by Izaak Neutelings The code is the following:

% Author: Izaak Neutelings (September 2021)
% Inspiration:
%   https://jila.colorado.edu/~ajsh/insidebh/penrose.html
%   https://tex.stackexchange.com/questions/99124/how-to-draw-penrose-diagrams-with-tikz
%   coordinates: https://arxiv.org/pdf/physics/0611033.pdf
%   https://arxiv.org/pdf/0711.0873.pdf
\documentclass[border=3pt,tikz]{standalone}
\usepackage{tikz}
\usepackage{amsmath} % for \text
\usepackage{mathrsfs} % for \mathscr
\usepackage{xfp} % higher precision (16 digits?)
\usepackage[outline]{contour} % glow around text
\usetikzlibrary{decorations.markings,decorations.pathmorphing}
\usetikzlibrary{angles,quotes} % for pic (angle labels)
\usetikzlibrary{arrows.meta} % for arrow size
\contourlength{1.4pt}

\newcommand{\calI}{\mathscr{I}} %\mathcal \tikzset{>=latex} % for LaTeX arrow head \colorlet{myred}{red!80!black} \colorlet{myblue}{blue!80!black} \colorlet{mygreen}{green!80!black} \colorlet{mydarkred}{red!50!black} \colorlet{mydarkblue}{blue!50!black} \colorlet{mylightblue}{mydarkblue!6} \colorlet{mypurple}{blue!40!red!80!black} \colorlet{mydarkpurple}{blue!40!red!50!black} \colorlet{mylightpurple}{mydarkpurple!80!red!6} \colorlet{myorange}{orange!40!yellow!95!black} \tikzstyle{cone}=[mydarkblue,line width=0.2,top color=blue!60!black!30, bottom color=blue!60!black!50!red!30,shading angle=60,fill opacity=0.9] \tikzstyle{cone back}=[mydarkblue,line width=0.1,dash pattern=on 1pt off 1pt] \tikzstyle{world line}=[myblue!60,line width=0.4] \tikzstyle{world line t}=[mypurple!60,line width=0.4] \tikzstyle{particle}=[mygreen,line width=0.5] \tikzstyle{photon}=[-{Latex[length=4,width=3]},myorange,line width=0.4,decorate, decoration={snake,amplitude=0.9,segment length=4,post length=3.8}] \tikzstyle{singularity}=[myred,line width=0.6,decorate, decoration={zigzag,amplitude=2,segment length=6.17}] \tikzset{declare function={% penrose(\x,\c) = {\fpeval{2/piatan( (sqrt((1+tan(\x)^2)^2+4\c\ctan(\x)^2)-1-tan(\x)^2) /(2\ctan(\x)^2) )}};% penroseu(\x,\t) = {\fpeval{atan(\x+\t)/pi+atan(\x-\t)/pi}};% penrosev(\x,\t) = {\fpeval{atan(\x+\t)/pi-atan(\x-\t)/pi}};% kruskal(\x,\c) = {\fpeval{asin( \csin(2\x) )*2/pi}};% Penrose coordinates for Kruskal }} \def\tick#1#2{\draw[thick] (#1) ++ (#2:0.04) --++ (#2-180:0.08)} \def\Nsamples{20} % number samples in plot

% LIGHTCONE \def\R{0.08} % size lightcone \def\e{0.08} % vertical scale \def\ang{45} % angle light cone \def\angb{acos(sqrt(\e)sin(\ang))} % angle ellipse center to point of tangency \def\a{\Rsin(\ang)sqrt(1-\esin(\ang)^2)/(1-\esin(\ang)^2)} % vertical radius \def\b{\Rsqrt(\e)sin(\ang)cos(\ang)/(1-\esin(\ang)^2)} % horizontal radius \def\coneback#1{ % light cone part to be drawn behind world lines \draw[cone back] % dashed line back (#1)++(-45:\R) arc({90-\angb}:{90+\angb}:{\a} and {\b}); \draw[cone,shading angle=-60] % top edge & inside (#1)++(0,{\Rcos(\ang)/(1-\esin(\ang)^2)}) ellipse({\a} and {\b}); } \def\conefront#1{ % light cone part to be drawn over world lines \draw[cone] % light cone outside (#1) --++ (45:\R) arc({\angb-90}:{-90-\angb}:{\a} and {\b}) --++ (-45:2\R) arc({90-\angb}:{-270+\angb}:{\a} and {\b}) -- cycle; }

\begin{document} \begin{tikzpicture}[scale=3.2] \message{Extended Penrose diagram: Schwarzschild black hole^^J}

\def\R{0.08} % size lightcone \def\Nlines{3} % number of world lines (at constant r/t) \pgfmathsetmacro\ta{1/sin(901/(\Nlines+1))} % constant r/t value 1 \pgfmathsetmacro\tb{sin(902/(\Nlines+1))} % constant r/t value 2 \pgfmathsetmacro\tc{1/sin(902/(\Nlines+1))} % constant r/t value 3 \pgfmathsetmacro\td{sin(901/(\Nlines+1))} % constant r/t value 4 \coordinate (-O) at (-1, 0); % center III: origin (r,t) = (0,0) \coordinate (-N) at (-1, 1); % north III: t=+infty, i+ \coordinate (O) at ( 1, 0); % center I: origin (r,t) = (0,0) \coordinate (S) at ( 1,-1); % south I: t=-infty, i- \coordinate (N) at ( 1, 1); % north I: t=+infty, i+ \coordinate (E) at ( 2, 0); % east I: r=-infty, i0 \coordinate (W) at ( 0, 0); % west I: r=+infty, i0 \coordinate (B) at ( 0,-1); % singularity bottom \coordinate (X0) at ({asin(sqrt((\ta^2-1)/(\ta^2-\tb^2)))/90}, {-acos(\tasqrt((1-\tb^2)/(\ta^2-\tb^2)))/90}); % particle 1 \coordinate (X1) at ({asin(sqrt((\tc^2-1)/(\tc^2-\td^2)))/90}, {acos(\tcsqrt((1-\td^2)/(\tc^2-\td^2)))/90}); % particle 2 \coordinate (X2) at (45:0.87); % particle falling in BH horizon \coordinate (X3) at (0.60,1.05); % particle falling in BH singularity

% AXES \draw[->,thick] (0,-0.1) -- (0,1.15) node[above=1,left=-1] {$v$}; \draw[->,thick] (-0.1,0) -- (2.15,0) node[left=1,above=0] {$u$};

\begin{scope}

% CLIP to fill inside zigzag lines
\clip[decorate,decoration={zigzag,amplitude=2,segment length=6.17}]
  (-N) -- (N) --++ (1.1,0.1) |-++ (-3.1,-2.3) -- cycle;

% REGIONS FILLS
\fill[mylightpurple] (-N) |-++ (2,0.1) -- (N) -- (W) -- cycle;
\fill[mylightblue] (N) -- (E) -- (S) -- (W) -- cycle;


% WORLD LINES
\draw[world line] (N) -- (S);
\draw[world line t] (W) -- (E) (W) -- (0,1.1);
\message{Making world lines...^^J}
\foreach \i [evaluate={\c=\i/(\Nlines+1); \cs=sin(90*\c);}] in {1,...,\Nlines}{
  \message{  Running i/N=\i/\Nlines, c=\c, cs=\cs...^^J}
  \draw[world line t,samples=\Nsamples,smooth,variable=\x,domain=0:2] % region I, constant t
    plot(\x,{-kruskal(\x*pi/4,\cs)})
    plot(\x,{ kruskal(\x*pi/4,\cs)});
  \draw[world line,samples=\Nsamples,smooth,variable=\y,domain=0:2] % region I, constant r
    plot({1-kruskal(\y*pi/4,\cs)},\y-1)
    plot({1+kruskal(\y*pi/4,\cs)},\y-1);
  \draw[world line,samples=\Nsamples,smooth,variable=\x,domain=0:2] % region II, constant r
    plot(\x-1,{1-kruskal(\x*pi/4,\cs)});
  \draw[world line t,samples=\Nsamples,smooth,variable=\y,domain=0:1.05] % region II constant t
    plot({-kruskal(\y*pi/4,\cs)},\y)
    plot({ kruskal(\y*pi/4,\cs)},\y);
}

% PARTICLE WORLD LINE
\draw[particle]
  (S) to[out=77,in=-70] (X0) to[out=110,in=-80] (X1)
      to[out=100,in=-90] (X2) to[out=75,in=-80] (X3);

\end{scope}

% REGIONS \node[fill=mylightblue,inner sep=2] at (O) {I}; \node[fill=mylightpurple,inner sep=2] at (0,0.64) {II};

% BOUNDARIES \draw[singularity] (-N) -- node[pos=0.46,above left=-2] {\strut singularity} (N); \draw[singularity] (-N) -- node[pos=0.54,above right=-2] {\strut $r=0$} (N); \path (S) -- (W) node[mydarkblue,pos=0.50,below=-2.5,rotate=-45,scale=0.85] {anti-horizon $r=2GM$}; \path (W) -- (N) node[mydarkblue,pos=0.32,above=-2.5,rotate=45,scale=0.85] {\contour{mylightpurple}{horizon $r=2GM$}}; \draw[thick,mydarkblue] (N) -- (E) -- (S) -- (W) -- cycle; \draw[thick,mydarkblue] (W) -- (-N);

% TICKS \node[below left=-1] at (W) {$0$}; \tick{E}{90} node[right=4,below=-3] {$\pi/2$}; \tick{S}{0} node[left=-1] {$-\pi/2$}; \tick{N}{180} node[right=-1] {$\pi/2$};

% INFINITY LABELS \node[above=1,right=1,mydarkblue] at (2.15,0) {$i^0$}; \node[right=1,below=1,mydarkpurple] at (S) {$i^-$}; \node[right=1,above=1,mydarkpurple] at (N) {$i^+$}; \node[mydarkblue,above right=-1] at (1.5,0.5) {$\calI^+$}; \node[mydarkblue,below right=-2] at (1.5,-0.5) {$\calI^-$};

\end{tikzpicture}

\end{document}


Now suppose i have a function T(R), and i want to draw the trajectory (t=T, r=R). How can i draw that into the diagram above?

As an example consider T(R) = R0 + sqrt(R)

  • If the trajectory doesn't have to follow an equation exactly, you can approach it as an artist and just sketch it. Look for these keywords in the pfgmanual: bend, or to[in=..,out=] (as you did already) or for controls. You can view these as different degrees of Beziér curves, where the last one has the most drastical effects on the curves. // To post things along this path, like labels or drawings, look for pos. – MS-SPO Oct 24 '23 at 15:13
  • 1
    i was more interested in making it follow the exact path, but in case it is not possible i will resort to that :) – LolloBoldo Oct 24 '23 at 15:31
  • Not related but you mixed using tikzset and tikzstyle in your code. The latter is deprecated and should not be used anymore. Prefer using tikzset. – SebGlav Oct 24 '23 at 17:45

0 Answers0