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

# The procedure RRsolve computes the skew-symmetric Ricci 
# rotation matrix Omega[a,b] as an array.  The user must
# specify the differentials of the one forms e[a] as an
# array de[a] and the metric tensor g[a,b], also as an array.
# The approach is described in J. Math. Phys. 12, 2395 (1971).

RRsolve := 
proc(de,g,dg)
local ndcs,a,b,c,sum,Sum,f,h;
global Omega;
options `Date: 6-4-92`,
	`Copyright 1992 by FJE ENTERPRISES`;
   if type(op(de),table) and type(op(g),table) and
      type(op(dg),table) then
	ndcs := map(op,[indices(de)]);
	for b in ndcs do
 		sum[b] := 0;
		for a in ndcs do
	            sum[b] := sum[b] + de[a] * g[a,b]
				- 1/2 * e[a] &^ dg[a,b]
		od;
	od;
	Sum := 0;
	for c in ndcs do
	    Sum := Sum + sum[c] &^ e[c]
        od;
 	for a in ndcs do
	    for b in ndcs do
         	for c in ndcs do
		    if a=b then 
		       f(a,b,c) := 0
		    else 
		       f(a,b,c) := coef(sum[c],&^(e[a],e[b])) 
		    fi;
		    if a=b or b=c or c=a then 
		       h(a,b,c) := 0 
		    else 
		       h(a,b,c) := coef(Sum,&^(e[a],e[b],e[c])) 
		    fi
                od
	    od
        od;
	for a in ndcs do
	    for b in ndcs do
		   Omega[a,b] := 0;
                   for c in ndcs do
		       Omega[a,b] := Omega[a,b] 
			   + (f(a,b,c) - 1/2 * h(a,b,c)) &^ e[c] 
		   od;
		   Omega[a,b] := simpform(expand(Omega[a,b]))
            od
        od;
        NULL 
   else ERROR(`wrong arguments`)
   fi
end:

#save `RRsolve.m`;
#quit
