(*
   Compute the coeeficients of newy as functions of those of y:

        exp(newy) = exp(x) exp(y) exp(x) .

                              Ren-Cang Li, June 1, 1996
                              na.rcli@na-net.ornl.gov   
*)

Print["Load BCH Formula"];
<<expXexpYexpX;

<<CompHead;

Print["Load definitions for various functions"];
<<DefFun;

(* Define x and y *)
x = d t X;
y=( t   a1 X 
   +t   b1 Y
   +t^3 a3 a3Cmt
   +t^3 b3 b3Cmt
   +t^5 a5 a5Cmt
   +t^5 b5 b5Cmt
   +t^5 c5 c5Cmt
   +t^5 d5 d5Cmt
   +t^5 e5 e5Cmt
   +t^5 f5 f5Cmt
   +t^7 a7 a7Cmt
   +t^7 b7 b7Cmt
   +t^7 c7 c7Cmt
   +t^7 d7 d7Cmt
   +t^7 e7 e7Cmt
   +t^7 f7 f7Cmt
   +t^7 g7 g7Cmt
   +t^7 h7 h7Cmt
   +t^7 i7 i7Cmt
   +t^7 j7 j7Cmt
   +t^7 k7 k7Cmt
   +t^7 l7 l7Cmt
   +t^7 m7 m7Cmt
   +t^7 n7 n7Cmt
   +t^7 o7 o7Cmt
   +t^7 p7 p7Cmt
   +t^7 q7 q7Cmt
   +t^7 r7 r7Cmt );

Print["Compute all terms"];
<<CompCoeff;

(* Four more rules *)
Cmt[Cmt[X,Cmt[X,Y]],z_Cmt]:=-Cmt[Cmt[Cmt[X,Y],z],X]-Cmt[Cmt[z,X],Cmt[X,Y]];
Cmt[Cmt[Y,Cmt[X,Y]],z_Cmt]:=-Cmt[Cmt[Cmt[X,Y],z],Y]-Cmt[Cmt[z,Y],Cmt[X,Y]];
Cmt[z_Cmt,Cmt[Y,Cmt[X,Y]]]:=-Cmt[Y,Cmt[Cmt[X,Y],z]]-Cmt[Cmt[X,Y],Cmt[z,Y]];
Cmt[z_Cmt,Cmt[X,Cmt[X,Y]]]:=-Cmt[X,Cmt[Cmt[X,Y],z]]-Cmt[Cmt[X,Y],Cmt[z,X]];

Print["Compute and Dump coefficients"]
<<DumpCoeff;

CopyFile["Coeff", "XCoeff"];  DeleteFile["Coeff"];
CopyFile["Coeffp","XCoeffp"]; DeleteFile["Coeffp"];
