# dBsolve.m	 Copyright (C) 1992 by FJE ENTERPRISES

# Given the 3-forms dB[i] (i=-1..1) in terms of the standard
# null tetrad { k , m , t , cc(t) }, dBsolve returns the 
# connection 1-forms _V, _U, _W, the Weyl conform tensor components
# C[i] (i=-2..2), the components S[i,j] (i,j=k,m,t,cc(t)) of the
# tracefree part of the Ricci tensor, and the scalar curvature R. 

dBsolve :=
proc(dB)
local v,u,w,P,Q,TH,Test,Zero,`C[0]-1/24*R`,`C[0]+1/12*R`;
global _V, _U, _W, C, S, R;
options `Date: 6-3-92`,
	`Copyright 1992 by FJE ENTERPRISES`;

# Compute the `spin coefficients':  See Eqs. (10a-c) in 
# J. Math. Phys. 15, 1409 (1974).

w[k] := - 1/2 * coef(dB[0],&^(k,m,t));
w[t] := 1/2 * coef(dB[0],&^(k,t,cc(t)));
v[m] := - 1/2 * coef(dB[0],&^(k,m,cc(t)));
v[cc(t)] := 1/2 * coef(dB[0],&^(m,t,cc(t))); # expansion + I twist

u[k] := expand(- coef(dB[1],&^(k,m,t)) - v[cc(t)]);
u[t] := expand(coef(dB[1],&^(k,t,cc(t))) + v[m]);
v[t] := - coef(dB[1],&^(k,m,cc(t)));	# shear
v[k] := - coef(dB[1],&^(m,t,cc(t)));

u[m] := expand(- coef(dB[-1],&^(k,m,cc(t))) + w[t]);
u[cc(t)] := expand(coef(dB[-1],&^(m,t,cc(t))) - w[k]);
w[cc(t)] := coef(dB[-1],&^(k,m,t));
w[m] := coef(dB[-1],&^(k,t,cc(t)));

_V := simpform(expand(v[m] * k + v[k] * m + v[cc(t)] * t + v[t] * cc(t)));
_U := simpform(expand(u[m] * k + u[k] * m + u[cc(t)] * t + u[t] * cc(t)));
_W := simpform(expand(w[m] * k + w[k] * m + w[cc(t)] * t + w[t] * cc(t)));

P := simpform(expand(re(_U)));
Q := simpform(expand(im(_U)));

# See Eqs. (1a-c) of Appendix B in J. Math. Phys. 19, 489 (1978).

defform(d(k)=P &^ k + cc(_V) &^ t + _V &^ cc(t),
        d(m)= - P &^ m + _W &^ t + cc(_W) &^ cc(t),
	d(t)= - cc(_W) &^ k - _V &^ m + I * Q &^ t,
	d(cc(t))= - _W &^ k - cc(_V) &^ m - I * Q &^ cc(t));

# Evaluation of the Riemann two-forms:  See Eqs. (13a-c)
# in J. Math. Phys. 15, 1409 (1974) or Eqs. (3a-c) of 
# Appendix B in J. Math. Phys. 19, 489 (1978).

TH[1] := expand(d(_V) + _V &^ _U);
TH[0] := expand(d(_U) - 2 * _W &^ _V);
TH[-1] := expand(d(_W) - _W &^ _U);

# Look at individual components C[i] (i=-2,...,2) of the 
# Weyl conform tensor, the scalar curvature R and the
# components S[i,j] (i,j=k,m,t,cc(t)) of the traceless
# part of the Ricci tensor.  See Eqs. (13a-c) in J. Math.
# Phys. 15, 1409 (1974) or Eqs. (4a-c) in Appendix B of
# J. Math. Phys. 19, 489 (1978).

TH[1] := simpform(expand(TH[1]));
TH[0] := simpform(expand(TH[0]));
TH[-1] := simpform(expand(TH[-1]));

C[2] := coef(TH[1],&^(m,cc(t)));
C[1] := 1/2 * (coef(TH[1],&^(k,m)) + coef(TH[1],&^(t,cc(t))));
`C[0]+1/12*R` := coef(TH[1],&^(k,t));
S[k,k] := 2 * coef(TH[1],&^(m,t));
S[k,t] := coef(TH[1],&^(k,m)) - coef(TH[1],&^(t,cc(t)));
S[t,t] := 2 * coef(TH[1],&^(k,cc(t)));

C[-2] := coef(TH[-1],&^(k,t));
C[-1] := 1/2 * (coef(TH[-1],&^(k,m)) + coef(TH[-1],&^(t,cc(t))));
Test := coef(TH[-1],&^(m,cc(t)));
Zero := `C[0]+1/12*R` - Test;
if Zero<>0 then ERROR(`Two values for C[0]+1/12*R`) fi;
S[m,m] := 2 * coef(TH[-1],&^(k,cc(t)));
S[m,cc(t)] := - (coef(TH[-1],&^(k,m)) - coef(TH[-1],&^(t,cc(t))));
S[cc(t),cc(t)] := 2 * coef(TH[-1],&^(m,t));

Test := - 1/2 * coef(TH[0],&^(m,cc(t)));
Zero := C[1] - Test;
if Zero<>0 then ERROR(`Two values for C[1]`) fi;
Test := - 1/2 * coef(TH[0],&^(k,t));
Zero := C[-1] - Test;
if Zero<>0 then ERROR(`Two values for C[-1]`) fi;
S[k,cc(t)] := - coef(TH[0],&^(m,t));
S[m,t] := coef(TH[0],&^(k,cc(t)));

`C[0]-1/24*R` := - 1/4 * (coef(TH[0],&^(k,m)) + coef(TH[0],&^(t,cc(t))));
S[t,cc(t)] := - 1/2 * (coef(TH[0],&^(k,m)) - coef(TH[0],&^(t,cc(t))));
C[0] := 1/3 * (2 * `C[0]-1/24*R` + `C[0]+1/12*R`);
R := 8 * (`C[0]+1/12*R` - `C[0]-1/24*R`);

[['_V'=_V,'_U'=_U,'_W'=_W],
['C[2]'=C[2],'C[1]'=C[1],'C[0]'=C[0],'C[-1]'=C[-1],'C[-2]'=C[-2]],
['S[k,k]'=S[k,k],'S[m,m]'=S[m,m],'S[k,t]'=S[k,t],'S[m,t]'=S[m,t],
'S[t,t]'=S[t,t],'S[t,cc(t)]'=S[t,cc(t)]],'R'=R];

end: 

#save `dBsolve.m`;
#quit
