% R. Vitolo, 18.08.05

% File casimir: changing coordinates to nonlocal Casimirs

% Loading the interface to cdiff packages
load_package cde$

% Initialization
indep_var:={x}$
dep_var:={b1,b2,b3}$
odd_var:={p1,p2,p3}$
total_order:=6$

% Calling cde's main routine
cde({indep_var,dep_var,odd_var,total_order},
  {})$

% Number of components of the operators
ncomp:=length(dep_var)$

% Loading data
g_5:=
  mat(
    ( - 2*b2_x,b1_x,1),(b1_x,1,0),(1,0,0)
)$
gl3:=g_5$
gu3:=gl3**(-1)$

ncomp:=length(dep_var)$
vars:=selectvars(0,1,dep_var,all_parametric_der)$

% Define c_ijk = (1/3)*(g_ki,j - g_ji,k)
operator c_lo$
for i:=1:ncomp do
 for j:=1:ncomp do
  for k:=1:ncomp do
  <<
   c_lo(i,j,k):=
    (1/3)*(df(gl3(k,i),part(vars,j)) - df(gl3(j,i),part(vars,k)))$
  >>$

% Define c^ij_k=c_hi(i,j,k) using the formula
% g^ni*g^mj*c_mnk = c^ij_k
templist:={}$
operator c_hi$
for i:=1:ncomp do
 for j:=1:ncomp do
  for k:=1:ncomp do
   c_hi(i,j,k):=
    <<
     templist:=
      for m:=1:ncomp join
       for n:=1:ncomp collect
	gu3(n,i)*gu3(m,j)*c_lo(m,n,k)$
     templist:=part(templist,0):=plus
    >>$

% Introduce the contracted operator
operator c_hi_con$
for i:=1:ncomp do
 for j:=1:ncomp do
  c_hi_con(i,j):=
   <<
    templist:=for k:=1:ncomp collect c_hi(i,j,k)*mkid(part(dep_var,k),!_2x)$
    templist:=part(templist,0):=plus
   >>$

% The operator a is the third-order Hamiltonian operator after the
% potential substitution.
mk_cdiffop(a,1,{3},3)$
for all i,j,psi let a(i,j,psi) =
 - (gu3(i,j)*td(psi,x)+c_hi_con(i,j)*psi)$

conv_cdiff2superfun(a,a_sf);

% Darboux coordinates
operator casimir;
casimir(1):=b1;
casimir(2):=b2;
casimir(3):=b3 + b1_x*b2;

% Linearization and adjoint linearization of the change of variable:
f_dar:=for i:=1:ncomp collect casimir(i)$

ell_function(f_dar,ldar);

adjoint_cdiffop(ldar,ldar_star);

% Change of variable in the operator:
mk_cdiffop(ta,1,{3},3)$
for all i,j,psi let ta(i,j,psi)=
 for k:=1:ncomp sum for h:=1:ncomp sum ldar(i,k,a(k,h,ldar_star(h,j,psi)))$

conv_cdiff2superfun(ta,ta_sf);

;end;

Local Variables:
mode:reduce
End:
