First we define a 4D manifold with Minkowski metric

In [1]:

```
%display latex
```

In [2]:

```
M = Manifold(4, 'M', structure='Lorentzian')
C.<t,x,y,z> = M.chart()
g = M.metric()
g[0, 0], g[1, 1], g[2, 2], g[3, 3] = 1, -1, -1, -1
g[:]
```

Out[2]:

Let's perturbate this metric with a small tensor $h$, depending on a small parameter $\tau$.

In [3]:

```
tau = var('tau')
h = M.tensor_field(0, 2, sym=(0,1))
h[0, 1], h[0, 2], h[0, 3] = exp(-tau*x), 2*exp(-2*tau*y), 3*exp(-3*tau*z)
g.set(g + h)
g[:]
```

Out[3]:

The computation of the connection takes several seconds, and produces big expressions.

In [4]:

```
nab = g.connection()
nab.display(only_nonredundant=True)
```

Out[4]:

If $\tau$ is small, it can be interesting to look a this at the first order. It appears for example that it is completely independent of the coordinates.

In [5]:

```
nab.set_calc_order(tau, 1, True)
nab.display(only_nonredundant=True)
```

Out[5]:

It is also possible to perform the computation of the connection completely at the first order, by setting the order of $g$ instead of $\Gamma$. All derived quatities are then computed at this order.

In [6]:

```
g.set_calc_order(tau, 1, True)
g[:]
```

Out[6]:

The computation of the connection is much faster, and of course gives the same result.

In [7]:

```
nab2 = g.connection()
nab == nab2
```

Out[7]: