# spacetime-reference-frames-equations.ipynb

In [33]:
from sympy import symbols, Eq, sqrt

In [16]:
x1, x2, t1, t2, v, gamma = symbols('x_1, x_2, t_1, t_2, v, gamma')
c = symbols('c', constant = True)

In [17]:
eq1 = Eq(x2, (x1 - v * t1) * gamma)
eq1

Out[17]:
$\displaystyle x_{2} = \gamma \left(- t_{1} v + x_{1}\right)$
In [11]:
eq2 = Eq(x1, (x2 + v * t2)*gamma)
eq2

Out[11]:
$\displaystyle x_{1} = \gamma \left(t_{2} v + x_{2}\right)$
In [12]:
eq3 = Eq(x1 * x2, (x1 - v * t1) * gamma * (x2 + v * t2)*gamma)
eq3

Out[12]:
$\displaystyle x_{1} x_{2} = \gamma^{2} \left(- t_{1} v + x_{1}\right) \left(t_{2} v + x_{2}\right)$
In [13]:
eq4 = eq3.expand()
eq4

Out[13]:
$\displaystyle x_{1} x_{2} = - \gamma^{2} t_{1} t_{2} v^{2} - \gamma^{2} t_{1} v x_{2} + \gamma^{2} t_{2} v x_{1} + \gamma^{2} x_{1} x_{2}$
In [22]:
eq5 = Eq(t1, x1/c)
eq5

Out[22]:
$\displaystyle t_{1} = \frac{x_{1}}{c}$
In [23]:
eq6 = Eq(t2, x2/c)
eq6

Out[23]:
$\displaystyle t_{2} = \frac{x_{2}}{c}$
In [27]:
eq7 = eq4.subs({eq5.lhs : eq5.rhs, eq6.lhs : eq6.rhs})
eq7

Out[27]:
$\displaystyle x_{1} x_{2} = \gamma^{2} x_{1} x_{2} - \frac{\gamma^{2} v^{2} x_{1} x_{2}}{c^{2}}$
In [28]:
eq8 = Eq(gamma**2, c**2/(c**2-v**2))
eq8

Out[28]:
$\displaystyle \gamma^{2} = \frac{c^{2}}{c^{2} - v^{2}}$
In [30]:
eq9 = Eq(gamma**2, 1/(1-(c**2/v**2)))
eq9

Out[30]:
$\displaystyle \gamma^{2} = \frac{1}{- \frac{c^{2}}{v^{2}} + 1}$
In [35]:
eq10 = Eq(gamma, 1/sqrt(1-(c**2/v**2)))
eq10

Out[35]:
$\displaystyle \gamma = \frac{1}{\sqrt{- \frac{c^{2}}{v^{2}} + 1}}$
In [36]:
eq1

Out[36]:
$\displaystyle x_{2} = \gamma \left(- t_{1} v + x_{1}\right)$
In [41]:
eq11 = Eq(c*t2, gamma*(c*t1  - ( x1/c)*v))
eq11

Out[41]:
$\displaystyle c t_{2} = \gamma \left(c t_{1} - \frac{v x_{1}}{c}\right)$
In [43]:
eq12 = Eq(t2, gamma*(c*t1  - ( x1/c**2)*v))
eq12

Out[43]:
$\displaystyle t_{2} = \gamma \left(c t_{1} - \frac{v x_{1}}{c^{2}}\right)$
In [44]:
eq2

Out[44]:
$\displaystyle x_{1} = \gamma \left(t_{2} v + x_{2}\right)$
In [45]:
eq13 = Eq(c*t1, gamma*((x2/c)*v + c * t2))
eq13

Out[45]:
$\displaystyle c t_{1} = \gamma \left(c t_{2} + \frac{v x_{2}}{c}\right)$
In [48]:
eq14 = Eq(t1, gamma*((x2/c**2)*v + t2))
eq14

Out[48]:
$\displaystyle t_{1} = \gamma \left(t_{2} + \frac{v x_{2}}{c^{2}}\right)$
In [ ]: