# Space Time Algebra¶

## Intro¶

This notebook demonstrates how to use clifford to work with Space Time Algebra. The Pauli algegra of space $$\mathbb{P}$$, and Dirac algebra of space-time $$\mathbb{D}$$, are related using the spacetime split. The split is implemented by using a BladeMap, which maps a subset of blades in $$\mathbb{D}$$ to the blades in $$\mathbb{P}$$. This split allows a spacetime bivector $$F$$ to be broken up into relative electric and magnetic fields in space. Lorentz transformations are implemented as rotations in $$\mathbb{D}$$, and the effects on the relative fields are computed with the split.

## Setup¶

First we import clifford, instantiate the two algebras, and populate the namespace with the blades of each algebra. The elements of $$\mathbb{D}$$ are prefixed with $$d$$, while the elements of $$\mathbb{P}$$ are prefixed with $$p$$. Although unconventional, it is easier to read and to translate into code.

In :

from clifford import Cl, pretty

pretty(precision=1)

# Dirac Algebra  D
D, D_blades = Cl(1,3, firstIdx=0, names='d')

# Pauli Algebra  P

# put elements of each in namespace


## The Space Time Split¶

To two algebras can be related by the spacetime-split. First, we create a BladeMap which relates the bivectors in $$\mathbb{D}$$ to the vectors/bivectors in $$\mathbb{P}$$. The scalars and psuedo-scalars in each algebra are equated.

In :

from IPython.display import SVG
SVG('_static/split.svg')

Out: In :

from clifford import BladeMap

(d02,p2),
(d03,p3),
(d12,p12),
(d23,p23),
(d13,p13),
(d0123, p123)])


## Spliting a space-time vector (an event)¶

A vector in $$\mathbb{D}$$, reprents a unique place in space and time, i.e. an event. To illustrate the split, create a random event $$X$$.

In :

X = D.randomV()*10
X

Out:

(1.2^d0) - (9.2^d1) + (17.9^d2) - (3.1^d3)


This can be split into time and space components by multiplying with the time-vector $$d_0$$,

In :

X*d0

Out:

1.2 + (9.2^d01) - (17.9^d02) + (3.1^d03)


and applying the BladeMap, which results in a scalar+vector in $$\mathbb{P}$$

In :

bm(X*d0)

Out:

1.2 + (9.2^p1) - (17.9^p2) + (3.1^p3)


The space and time components can be seperated by grade projection,

In :

x = bm(X*d0)
x(0) # the time component

Out:

1.2

In :

x(1) # the space component

Out:

(9.2^p1) - (17.9^p2) + (3.1^p3)


We therefor define a split() function, which has a simple condition allowing it to act on a vector or a multivector in $$\mathbb{D}$$. Spliting a spacetime bivector will be treated in the next section.

In :

def split(X):
return bm(X.odd*d0+X.even)

In :

split(X)

Out:

1.2 + (9.2^p1) - (17.9^p2) + (3.1^p3)


The split can be inverted by applying the BladeMap again, and multiplying by $$d_0$$

In :

x = split(X)
bm(x)*d0

Out:

(1.2^d0) - (9.2^d1) + (17.9^d2) - (3.1^d3)


## Splitting a Bivector¶

Given a random bivector $$F$$ in $$\mathbb{D}$$,

In :

F = D.randomMV()(2)
F

Out:

(1.0^d01) + (1.1^d02) - (1.0^d03) - (1.7^d12) - (0.7^d13) - (0.5^d23)


$$F$$ splits into a vector/bivector in $$\mathbb{P}$$

In :

split(F)

Out:

(1.0^p1) + (1.1^p2) - (1.0^p3) - (1.7^p12) - (0.7^p13) - (0.5^p23)


If $$F$$ is interpreted as the electromagnetic bivector, the Electric and Magnetic fields can be seperated by grade

In :

E = split(F)(1)
iB = split(F)(2)

E

Out:

(1.0^p1) + (1.1^p2) - (1.0^p3)

In :

iB

Out:

-(1.7^p12) - (0.7^p13) - (0.5^p23)


## Lorentz Transformations¶

Lorentz Transformations are rotations in $$\mathbb{D}$$, which are implemented with Rotors. A rotor in G4 will, in general, have scalar, bivector, and quadvector components.

In :

R = D.randomRotor()
R

Out:

-0.6 - (0.1^d01) + (0.3^d02) + (2.1^d03) + (0.0^d12) - (1.7^d13) - (2.1^d23) - (1.4^d0123)


In this way, the effect of a lorentz transformation on the electric and magnetic fields can be computed by rotating the bivector with $$F \rightarrow RF\tilde{R}$$

In :

F_ = R*F*~R
F_

Out:

(15.6^d01) - (27.7^d02) + (31.5^d03) + (30.3^d12) - (32.9^d13) - (2.6^d23)


Then spliting into $$E$$ and $$B$$ fields

In :

E_ = split(F_)(1)
E_

Out:

(15.6^p1) - (27.7^p2) + (31.5^p3)

In :

iB_ = split(F_)(2)
iB_

Out:

(30.3^p12) - (32.9^p13) - (2.6^p23)


## Lorentz Invariants¶

Since lorentz rotations in $$\mathbb{D}$$, the magnitude of elements of $$\mathbb{D}$$ are invariants of the lorentz transformation. For example, the magnitude of electromagnetic bivector $$F$$ is invariant, and it can be related to $$E$$ and $$B$$ fields in $$\mathbb{P}$$ through the split,

In :

i = p123
E = split(F)(1)
B = -i*split(F)(2)

In :

F**2

Out:

-0.5 + (3.9^d0123)

In :

split(F**2) == E**2 - B**2 + (2*E|B)*i

Out:

True