out jkk;
off nat;
%********************************************************
% EXAMPLE (16 08 97)
% 1 - soliton solutions of mKdV eq. 
% as curvature of moving curve in 2D euclidean space
%********************************************************
depend f, x, p;
depend EEE, x, p;

%------ tangent -------------------------------------------
EEEp:=1;
EEEx:=EEE;
dEEE:=sqrt(EEEp**2 + EEEx**2);
procedure vEEE(f); rrr:= EEEp*df(f,p) + EEEx*df(f,x);

%------ tangent unit --------------------------------------
ttp:=1/dEEE;
ttx:=EEE/dEEE;
dtt:=sqrt(ttp**2 + ttx**2);
procedure vtt(f); rrr:= ttp*df(f,p) + ttx*df(f,x);

%------ normal unit ---------------------------------------
uup:=vEEE(ttp);
uux:=vEEE(ttx);
duu:=sqrt(uup**2 + uux**2);
nnp:=uup/duu;
nnx:=uux/duu;

dnn:=sqrt(nnp**2 + nnx**2);
procedure vnn(f); rrr:= nnp*df(f,p) + nnx*df(f,x);

%------ curvature -----------------------------------------
kapt:=sqrt(vtt(ttp)**2 + vtt(ttx)**2);

%------ frenet equations ----------------------------------
vtt(ttp) - kapt*nnp;
vtt(ttx) - kapt*nnx;
vtt(nnp) + kapt*ttp;
vtt(nnx) + kapt*ttx;


%------ action of normal unit on tangent unit ----------------------------------
vnn(ttp);
vnn(ttx);

solve(vnn(ttp) + a*nnp, a);
solve(vnn(ttx) + b*nnx, b);




kapn:=(SQRT(EEE**2 + 1)*(DF(EEE,P)*EEE - DF(EEE,X)))/(EEE**4 + 2*EEE**2 + 1);


vnn(ttp) + kapn*nnp;
vnn(ttx) + kapn*nnx;

%------ normal symmetry generator ----------------------------------
depend alp,p,x;
genp:=alp*nnp;
genx:=alp*nnx;
procedure vgen(f); rrr:= genp*df(f,p) + genx*df(f,x);

%------ symmetry condition ----------------------------------
depend ro,p,x;
conp:=vgen(ttp) - vtt(genp) - ro*ttp;
conx:=vgen(ttx) - vtt(genx) - ro*ttx;

%------ symmetry condition in frenet language ----------------------

conpk:=- (alp*kapn + vtt(alp))*nnp + (alp*kapt - ro)*ttp;
conxk:=- (alp*kapn + vtt(alp))*nnx + (alp*kapt - ro)*ttx;

conpk - conp;
conxk - conx;

%------ so the following two expresions should vanish
%because of independence of tangent and normal units -----

eqqn:=alp*kapn + vtt(alp);
eqqt:=alp*kapt - ro;

;alp:=ro/kapt;

%-------------------------------
toint:=-kapn/(kapt*nnp);
difp:=df(ttp,p);
difx:=df(ttp,x);

%---- form to integrate -------
formp:=toint*difp;
formx:=toint*difx;


%---------- some calculation check -------------------------


df(sin(ttp),p);
cos(ttp)*df(ttp,p);
df(sin(ttp),p) - cos(ttp)*df(ttp,p);


df(log(ttp),p);
(1/ttp)*df(ttp,p);
df(log(ttp),p) - (1/ttp)*df(ttp,p);


df(sin(ttp),x);
cos(ttp)*df(ttp,x);
df(sin(ttp),x) - cos(ttp)*df(ttp,x);


df(log(ttp),x);
(1/ttp)*df(ttp,x);
df(log(ttp),x) - (1/ttp)*df(ttp,x);


vtt(ttp);
kapt*nnp;

vtt(ttp)-kapt*nnp;

kapn/(kapt*nnp);

%---------- particular case -------------------

%depend GE, x;
EEE:=p + x**2;

ttp;
ttx;
nnp;
nnx;
kapt;
kapn;


kapn/(kapt*nnp);

difp;
difx;


%factor p;
formp;

factor x;
formx;



shut jkk;
bye;
end;