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 expresions should vanish
%because of independence of tangent and normal units -----

eqqn:=alp*kapn + vtt(alp);
eqqt:=alp*kapt - ro;

;alp:=ro/kapt;

%---------- 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);

%-- curvatures  and vectors in terms of first component of tangent unit ---
%here we introduce the symbol tp instead of ttp for this component
%to avoid program failure

depend tp, p, x;
EEE:=sqrt(1/(tp**2) - 1);


ttp;
ttx;

nnp;
nnx;

kapn;
kapt;

kapn/kapt;


kapn/(kapt*nnp);

%--------- a particular case dx/dp = p -----------

tp:=1/sqrt(x**2 + p**2);


ttp;
ttx;

nnp;
nnx;

kapn;
kapt;

kapn/kapt;


kapn/(kapt*nnp);




shut jkk;
bye;
end;
