CoCalc Public FilesBHLectures / sage / light_cone.ipynb
Author: Eric Gourgoulhon
Compute Environment: Ubuntu 18.04 (Deprecated)

# Light cone in Minkowski spacetime

In [1]:
%display latex

In [2]:
M = Manifold(4, 'M')
print(M)

4-dimensional differentiable manifold M
In [3]:
X.<t,x,y,z> = M.chart()
X

$\left(M,(t, x, y, z)\right)$
In [4]:
g = M.lorentzian_metric('g')
g[0,0], g[1,1], g[2,2], g[3,3] = -1, 1, 1, 1
g.display()

$g = -\mathrm{d} t\otimes \mathrm{d} t+\mathrm{d} x\otimes \mathrm{d} x+\mathrm{d} y\otimes \mathrm{d} y+\mathrm{d} z\otimes \mathrm{d} z$
In [5]:
u = M.scalar_field(coord_expression={X: t-sqrt(x^2+y^2+z^2)}, name='u')
u.display()

$\begin{array}{llcl} u:& M & \longrightarrow & \mathbb{R} \\ & \left(t, x, y, z\right) & \longmapsto & t - \sqrt{x^{2} + y^{2} + z^{2}} \end{array}$
In [6]:
du = u.differential()
du.display()

$\mathrm{d}u = \mathrm{d} t + \left( -\frac{x}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} x + \left( -\frac{y}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} y + \left( -\frac{z}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} z$
In [7]:
l = - du.up(g)
l.set_name('l', latex_name=r'\ell')
print(l)
l.display()

Vector field l on the 4-dimensional differentiable manifold M
$\ell = \frac{\partial}{\partial t } + \left( \frac{x}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial x } + \left( \frac{y}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial y } + \left( \frac{z}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial z }$
In [8]:
g(l,l).expr()

$0$
In [9]:
nab = g.connection()
print(nab)

Levi-Civita connection nabla_g associated with the Lorentzian metric g on the 4-dimensional differentiable manifold M
In [10]:
nab_l = nab(l)
print(nab_l)
nab_l.display()

Tensor field nabla_g(l) of type (1,1) on the 4-dimensional differentiable manifold M
$\nabla_{g} \ell = \left( \frac{\sqrt{x^{2} + y^{2} + z^{2}} {\left(y^{2} + z^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4} + z^{4} + 2 \, {\left(x^{2} + y^{2}\right)} z^{2}} \right) \frac{\partial}{\partial x }\otimes \mathrm{d} x -\frac{x y}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \frac{\partial}{\partial x }\otimes \mathrm{d} y -\frac{x z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \frac{\partial}{\partial x }\otimes \mathrm{d} z -\frac{x y}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \frac{\partial}{\partial y }\otimes \mathrm{d} x + \left( \frac{\sqrt{x^{2} + y^{2} + z^{2}} {\left(x^{2} + z^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4} + z^{4} + 2 \, {\left(x^{2} + y^{2}\right)} z^{2}} \right) \frac{\partial}{\partial y }\otimes \mathrm{d} y -\frac{y z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \frac{\partial}{\partial y }\otimes \mathrm{d} z -\frac{x z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \frac{\partial}{\partial z }\otimes \mathrm{d} x -\frac{y z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \frac{\partial}{\partial z }\otimes \mathrm{d} y + \left( \frac{\sqrt{x^{2} + y^{2} + z^{2}} {\left(x^{2} + y^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4} + z^{4} + 2 \, {\left(x^{2} + y^{2}\right)} z^{2}} \right) \frac{\partial}{\partial z }\otimes \mathrm{d} z$
In [11]:
nab_l[:]

$\left(\begin{array}{rrrr} 0 & 0 & 0 & 0 \\ 0 & \frac{\sqrt{x^{2} + y^{2} + z^{2}} {\left(y^{2} + z^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4} + z^{4} + 2 \, {\left(x^{2} + y^{2}\right)} z^{2}} & -\frac{x y}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & -\frac{x z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \\ 0 & -\frac{x y}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & \frac{\sqrt{x^{2} + y^{2} + z^{2}} {\left(x^{2} + z^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4} + z^{4} + 2 \, {\left(x^{2} + y^{2}\right)} z^{2}} & -\frac{y z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \\ 0 & -\frac{x z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & -\frac{y z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & \frac{\sqrt{x^{2} + y^{2} + z^{2}} {\left(x^{2} + y^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4} + z^{4} + 2 \, {\left(x^{2} + y^{2}\right)} z^{2}} \end{array}\right)$
In [12]:
for i in [1..3]:
nab_l[i,i].factor()
nab_l[:]

$\left(\begin{array}{rrrr} 0 & 0 & 0 & 0 \\ 0 & \frac{y^{2} + z^{2}}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & -\frac{x y}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & -\frac{x z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \\ 0 & -\frac{x y}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & \frac{x^{2} + z^{2}}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & -\frac{y z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \\ 0 & -\frac{x z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & -\frac{y z}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} & \frac{x^{2} + y^{2}}{{\left(x^{2} + y^{2} + z^{2}\right)}^{\frac{3}{2}}} \end{array}\right)$
In [13]:
acc_l = l['^m']*nab_l['^a_m']
print(acc_l)
acc_l.display()

Vector field on the 4-dimensional differentiable manifold M
$0$
In [14]:
k = M.vector_field(name='k')
r = sqrt(x^2+y^2+z^2)
k[:] = [1/2, -x/(2*r), -y/(2*r), -z/(2*r)]
k.display()

$k = \frac{1}{2} \frac{\partial}{\partial t } + \left( -\frac{x}{2 \, \sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial x } + \left( -\frac{y}{2 \, \sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial y } + \left( -\frac{z}{2 \, \sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial z }$

Let us check that $k$ is a null vector:

In [15]:
g(k,k).expr()

$0$

and that it obeys $k\cdot\ell=-1$:

In [16]:
g(k,l).expr()

$-1$
In [19]:
l_form = l.down(g)
l_form.set_name('lf', latex_name=r'\underline{\ell}')
print(l_form)
l_form.display()

1-form lf on the 4-dimensional differentiable manifold M
$\underline{\ell} = -\mathrm{d} t + \left( \frac{x}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} x + \left( \frac{y}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} y + \left( \frac{z}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} z$
In [20]:
k_form = k.down(g)
k_form.set_name('kf', latex_name=r'\underline{k}')
print(k_form)
k_form.display()

1-form kf on the 4-dimensional differentiable manifold M
$\underline{k} = -\frac{1}{2} \mathrm{d} t + \left( -\frac{x}{2 \, \sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} x + \left( -\frac{y}{2 \, \sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} y + \left( -\frac{z}{2 \, \sqrt{x^{2} + y^{2} + z^{2}}} \right) \mathrm{d} z$
In [22]:
q = g + l_form*k_form + k_form*l_form
q.set_name('q')
print q

Tensor field q of type (0,2) on the 4-dimensional differentiable manifold M
In [23]:
q == q.symmetrize()

$\mathrm{True}$
In [25]:
q = q.symmetrize()
q.set_name('q')
print q

Field of symmetric bilinear forms q on the 4-dimensional differentiable manifold M
In [26]:
q[:]

$\left(\begin{array}{rrrr} 0 & 0 & 0 & 0 \\ 0 & \frac{y^{2} + z^{2}}{x^{2} + y^{2} + z^{2}} & -\frac{x y}{x^{2} + y^{2} + z^{2}} & -\frac{x z}{x^{2} + y^{2} + z^{2}} \\ 0 & -\frac{x y}{x^{2} + y^{2} + z^{2}} & \frac{x^{2} + z^{2}}{x^{2} + y^{2} + z^{2}} & -\frac{y z}{x^{2} + y^{2} + z^{2}} \\ 0 & -\frac{x z}{x^{2} + y^{2} + z^{2}} & -\frac{y z}{x^{2} + y^{2} + z^{2}} & \frac{x^{2} + y^{2}}{x^{2} + y^{2} + z^{2}} \end{array}\right)$
In [28]:
nab(l_form) == (1/r) * q

$\mathrm{True}$
In [38]:
q(l,l).expr()

$0$
In [39]:
q(l,k).expr()

$0$
In [40]:
q(k,k).expr()

$0$
In [41]:
XS.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
XS

$\left(M,(t, r, {\theta}, {\phi})\right)$
In [42]:
spher_to_cart = XS.transition_map(X, [t, r*sin(th)*cos(ph), r*sin(th)*sin(ph), r*cos(th)])
spher_to_cart.display()

$\left\{\begin{array}{lcl} t & = & t \\ x & = & r \cos\left({\phi}\right) \sin\left({\theta}\right) \\ y & = & r \sin\left({\phi}\right) \sin\left({\theta}\right) \\ z & = & r \cos\left({\theta}\right) \end{array}\right.$
In [43]:
spher_to_cart.set_inverse(t, sqrt(x^2+y^2+z^2), atan2(sqrt(x^2+y^2),z), atan2(y, x))

Check of the inverse coordinate transformation: t == t r == r th == arctan2(r*sin(th), r*cos(th)) ph == arctan2(r*sin(ph)*sin(th), r*cos(ph)*sin(th)) t == t x == x y == y z == z
In [44]:
q.display(XS.frame(), XS)

$q = r^{2} \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + r^{2} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$
In [45]:
q[XS.frame(),:,XS]

$\left(\begin{array}{rrrr} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & r^{2} & 0 \\ 0 & 0 & 0 & r^{2} \sin\left({\theta}\right)^{2} \end{array}\right)$
In [46]:
n = 1/2*l + k
n.set_name('n')
n.display()

$n = \frac{\partial}{\partial t }$
In [47]:
s = 1/2*l - k
s.set_name('s')
s.display()

$s = \left( \frac{x}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial x } + \left( \frac{y}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial y } + \left( \frac{z}{\sqrt{x^{2} + y^{2} + z^{2}}} \right) \frac{\partial}{\partial z }$
In [48]:
s.display(XS.frame())

$s = \frac{\partial}{\partial r }$
In [50]:
q_up = q.up(g)
print q_up

Tensor field of type (2,0) on the 4-dimensional differentiable manifold M
In [58]:
theta_l = 1/2 * q_up.contract(0,1, q.lie_der(l), 0,1)
print theta_l

Scalar field on the 4-dimensional differentiable manifold M
In [59]:
theta_l.expr()

$\frac{2}{\sqrt{x^{2} + y^{2} + z^{2}}}$
In [ ]: