2 from matplotlib.patches import Polygon
10 figure(facecolor='w', figsize=[4,3])
12 ax = axes([border,border,1-2*border,1-2*border])
13 ax.set_xticks(range(-10,11,1))
14 ax.set_yticks(range(-10,11,1))
17 ax.set_title("Limo paradox, garage frame")
18 ax.set_xlabel("Distance (light seconds)")
19 ax.set_ylabel("Time (seconds)")
22 ax.plot([-10,10],[-10,10], 'b-')
23 ax.plot([10,-10],[-10,10], 'b-')
25 # switch to a moving observer
28 gamma = 1.0/sqrt(1-v**2)
32 spaceship = Polygon([(v*t[0]-width,t[0]), (v*t[0], t[0]),
33 (v*t[-1],t[-1]), (v*t[-1]-width, t[-1])],
34 alpha=0.2, facecolor='k')
35 ax.add_patch(spaceship)
37 # plot the position track of a moving observer
40 # plot the position track of the garage
42 ax.plot(-width+0*t,t, 'g-')
44 # plot his xprime axis at his 1 second intervals
46 def plot_xp(tp, v, xmin=-10, xmax=10):
47 x = arange(xmin, xmax, 0.01)
52 ax.plot(x+origin_x, xp_y+origin_y, 'r:')
55 # plot his tprime grids at his 1 light-second intervals
57 def plot_tp_grid(xp, v, tmin=-10, tmax=10):
58 t = arange(tmin, tmax, 0.01)
63 ax.plot(tp_x+origin_x, t+origin_y, 'r:')
66 proper_width = gamma*width
67 x_back_limo_frame = -proper_width
69 x_back_limo_frame_p = gamma*(x_back_limo_frame+v*t_back_limo_frame)
70 t_back_limo_frame_p = gamma*(t_back_limo_frame+v*x_back_limo_frame)
71 x_gar_limo_frame = -width/gamma
73 x_gar_limo_frame_p = gamma*(x_gar_limo_frame+v*t_gar_limo_frame)
74 t_gar_limo_frame_p = gamma*(t_gar_limo_frame+v*x_gar_limo_frame)
75 points = [(0,0), (-width,0), (x_back_limo_frame_p, t_back_limo_frame_p),
76 (x_gar_limo_frame_p, t_gar_limo_frame_p)]
77 labels = ["A", "B", "C", "D"]
79 ax.plot([p[0] for p in points], [p[1] for p in points], 'ko')
80 for p,L in zip(points, labels):
81 ax.text(p[0], p[1], ' '+L,
82 horizontalalignment='left',
83 verticalalignment='center')
87 ax.set_aspect('equal') # Make aspect ratio equal to 1
92 savefig(filename, dpi=200)