Skip to content

Instantly share code, notes, and snippets.

@falsycat
Last active November 24, 2022 11:13
Show Gist options
  • Save falsycat/8c695943d58671f46f02dd523329eb7b to your computer and use it in GitHub Desktop.
Save falsycat/8c695943d58671f46f02dd523329eb7b to your computer and use it in GitHub Desktop.
kruskal diagram
import std;
enum C = 299792458;
void main()
{
for (int i = -3; i <= 3; ++i) {
double t = 2.5e-9*i;
double a = tanh(C*t/2.);
" t*100, t*100*%f title \"t=%2fe-9\" lc rgb \"red\", \\".writefln(a, i*2.5);
" t*100*%f, t*100 notitle lc rgb \"red\", \\".writefln(a);
}
for (int i = 0; i < 2; ++i) {
double r = i*.5;
double a = (r-1)*exp(r);
" %f*tan(t), %f/cos(t) title \"r=%f\" lc rgb \"blue\", \\".writefln(-a, -a, r);
}
for (int i = 0; i < 4; ++i) {
double r = i*.1+1.1;
double a = (r-1)*exp(r);
" %f/cos(t), %f*tan(t) title \"r=%f\" lc rgb \"blue\", \\".writefln(a, a, r);
}
" t*100, t*100 title \"t=+inf\" lw 2 lc rgb \"black\", \\".writefln();
" t*100, -t*100 title \"t=-inf\" lw 2 lc rgb \"black\", \\".writefln();
}
set size square
set xrange [-2:2]
set yrange [-2:2]
set parametric
set samples 1000
set key outside
set notics
plot \
t*100, t*100*-0.809032 title "t=-7.500000e-9" lc rgb "red", \
t*100*-0.809032, t*100 notitle lc rgb "red", \
t*100, t*100*-0.634839 title "t=-5.000000e-9" lc rgb "red", \
t*100*-0.634839, t*100 notitle lc rgb "red", \
t*100, t*100*-0.358131 title "t=-2.500000e-9" lc rgb "red", \
t*100*-0.358131, t*100 notitle lc rgb "red", \
t*100, t*100*0.000000 title "t=0.000000e-9" lc rgb "red", \
t*100*0.000000, t*100 notitle lc rgb "red", \
t*100, t*100*0.358131 title "t=2.500000e-9" lc rgb "red", \
t*100*0.358131, t*100 notitle lc rgb "red", \
t*100, t*100*0.634839 title "t=5.000000e-9" lc rgb "red", \
t*100*0.634839, t*100 notitle lc rgb "red", \
t*100, t*100*0.809032 title "t=7.500000e-9" lc rgb "red", \
t*100*0.809032, t*100 notitle lc rgb "red", \
1.000000*tan(t), 1.000000/cos(t) title "r=0.000000" lc rgb "blue", \
0.824361*tan(t), 0.824361/cos(t) title "r=0.500000" lc rgb "blue", \
0.300417/cos(t), 0.300417*tan(t) title "r=1.100000" lc rgb "blue", \
0.664023/cos(t), 0.664023*tan(t) title "r=1.200000" lc rgb "blue", \
1.100789/cos(t), 1.100789*tan(t) title "r=1.300000" lc rgb "blue", \
1.622080/cos(t), 1.622080*tan(t) title "r=1.400000" lc rgb "blue", \
t*100, t*100 title "t=+inf" lw 2 lc rgb "black", \
t*100, -t*100 title "t=-inf" lw 2 lc rgb "black"
@falsycat
Copy link
Author

falsycat commented May 25, 2021

I added captions using Inkscape.
graph-kruskal

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