In [1]:
import spacetime
I = spacetime.mv()
I.set_gamma_0_gamma_1_gamma_2_gamma_3(1.0)
One = spacetime.mv()
One.set_scalar(1.0)
t = spacetime.mv(); x = spacetime.mv(); y=spacetime.mv(); z=spacetime.mv();
t.set_gamma_0(1); x.set_gamma_1(1); y.set_gamma_2(1); z.set_gamma_3(1);
beta = 0.5
alpha = arctanh(beta)
gamma = 1./sqrt(1-beta**2)
delta = pi/5.3
B = spacetime.mv()
B.set_gamma_1_gamma_2(1.);
print(spacetime.exp(-alpha*spacetime.dual(B)/2.)*spacetime.exp(-delta*B/2.))
print(spacetime.exp(-alpha*spacetime.dual(B)/2. - delta*B/2.))
In [2]:
R = spacetime.exp(-alpha*spacetime.dual(B)/2.)*spacetime.exp(-delta*B/2.)
print(B)
print(R)
In [3]:
spacetime.dual(B)
Out[3]:
In [4]:
exponent = -alpha*spacetime.dual(B)/2. - delta*B/2.
print(exponent)
In [43]:
from math import factorial
def powtmp(tmp,i):
c=spacetime.mv()
c.set_scalar(1.0)
for i in range(i):
c = c*tmp
return c
def exp(B):
exptmp = spacetime.mv()
for i in range(40):
exptmp = exptmp + powtmp(B,i)/factorial(i)
return exptmp
In [6]:
exp(exponent)
Out[6]:
In [7]:
print(spacetime.exp(-B))
print(delta*One/2.+alpha*I/2.)
print(spacetime.exp(-B)*(delta*One/2.+alpha*I/2.))
In [8]:
alpha
Out[8]:
In [13]:
spacetime.exp(1.2*(t^z)+3.4*(x^y))
Out[13]:
In [45]:
tmp=spacetime.exp(3.4*(t^z))*spacetime.exp(1.2*(x^y))
print(spacetime.exp(1.2*(x^y))*spacetime.exp(3.4*(t^z)))
print(tmp)
print(exp(1.2*(x^y)+3.4*(t^z)))
print(spacetime.exp(1.2*(x^y)+3.4*(t^z)))
In [46]:
tmp.toString("%2.4g")
Out[46]:
In [25]:
a=spacetime.exp(1.2*(t^z))
b=spacetime.exp(3.4*(x^y))
print(a,b)
In [21]:
cosh(1.2),sinh(1.2),cos(3.4),sin(3.4)
Out[21]:
In [30]:
tz=t^z
xy=x^y
print(tz,xy)
In [29]:
print(spacetime.exp(1.2*tz), cosh(1.2), sinh(1.2))
In [32]:
c=spacetime.exp(1.2*tz)
d=spacetime.exp(3.4*xy)
In [33]:
c*d
Out[33]:
In [48]:
xy*tz, tz*xy
Out[48]:
We need to create rotors that rotate our tetrad appropriately to $(\vartheta, \varphi)$. The following function should do the trick, and the cell below it shows that the result agrees with the usual explicit formula for the location of that point to within roundoff.
In [ ]:
def Rthetaphi(theta, phi):
Rphi = spacetime.exp(phi*(y^x)/2.)
Rtheta = spacetime.exp(theta*(x^z)/2.)
return Rphi*Rtheta
In [60]:
import random
N=10000
max([spacetime.norm(R*z*spacetime.reverse(R) - (sin(theta)*cos(phi)*x + sin(theta)*sin(phi)*y + cos(theta)*z))
for theta,phi in zip([random.random() for i in range(N)], [random.random() for i in range(N)])
for R in [Rthetaphi(theta,phi)] ])
Out[60]:
The previous cell shows that we have the correct result for $r = R\,z\,\bar{R}$. Now we need to check it for the $\theta = R\, x\, \bar{R}$ and $\phi = R\, y\, \bar{R}$ vectors.
In [61]:
N=2000
max([spacetime.norm(R*x*spacetime.reverse(R) - (cos(theta)*cos(phi)*x + cos(theta)*sin(phi)*y - sin(theta)*z))
for theta,phi in zip([random.random() for i in range(N)], [random.random() for i in range(N)])
for R in [Rthetaphi(theta,phi)] ])
Out[61]:
In [62]:
max([spacetime.norm(R*y*spacetime.reverse(R) - (-sin(phi)*x + cos(phi)*y))
for theta,phi in zip([random.random() for i in range(N)], [random.random() for i in range(N)])
for R in [Rthetaphi(theta,phi)] ])
Out[62]:
And so, we find that the rotors given by Rthetaphi are entirely in agreement with our expectations for the standard spherical-coordinate tetrad.
In [ ]:
In [ ]:
In [ ]:
In [ ]: