In[]:=
kdv=D[u[x,t],t]+6*u[x,t]*D[u[x,t],x]+D[u[x,t],{x,3}]==0;
Out[]=
--+x+6f-+x-+x+-+x0
7
3
′
f
7t
3
7t
3
′
f
7t
3
(3)
f
7t
3
In[]:=
u[x_,t_]:=f[x-c*t];
In[]:=
kdvTraveling=kdv/.u->Function[{x,t},f[x-c*t]];
In[]:=
kdvODE=Simplify[kdvTraveling/.x-c*t->z];
Out[]=
-+6f[z][z]+[z]0
7
3
′
f
(3)
f
In[]:=
kdvIntegrated=Integrate[kdvODE,z];
Out[]=
-+6f[z][z]+[z]0z
7
3
′
f
(3)
f
In[]:=
kdvEquation=kdvIntegrated==C[1];
Out[]=
-+6f[z][z]+[z]0z
7
3
′
f
(3)
f
1
In[]:=
solitonForm=A*Sech[k*z]^2;
Out[]=
2
2
Sech[z]
In[]:=
solitonEquation=kdvEquation/.f[z]->solitonForm;
Out[]=
-+12[z]+[z]0z
7
3
2
Sech[z]
′
f
(3)
f
1
In[]:=
A=2;k=1;
In[]:=
c=k^2+A^2/3;
Out[]=
7
3
In[]:=
sechSolution=A*Sech[k*(x-c*t)]^2;
Out[]=
2
2
Sech-x
7t
3
In[]:=
Plot[sechSolution/.t->0,{x,-10,10},PlotLabel->"Soliton Solution of KdV Equation",AxesLabel->{"x","u(x,t)"}]
Out[]=
In[]:=
verificationLeft=D[sechSolution,t]+6*sechSolution*D[sechSolution,x]+D[sechSolution,{x,3}];verificationRight=0;
Out[]=
-Tanh-x+48Tanh-x+2-16Tanh-x+8
28
3
2
Sech-x
7t
3
7t
3
4
Sech-x
7t
3
7t
3
4
Sech-x
7t
3
7t
3
2
Sech-x
7t
3
3
Tanh-x
7t
3
In[]:=
Print["Verification (should be True): ",Simplify[verificationLeft==verificationRight]]
Verification (should be True): Sech-xTanh-x0
7t
3
7t
3
In[]:=
mass=Integrate[sechSolution,{x,-Infinity,Infinity}];Print["Conservation of mass: ",mass]
Conservation of mass:
In[]:=
momentum=Integrate[sechSolution^2,{x,-Infinity,Infinity}];Print["Conservation of momentum: ",momentum]
Conservation of momentum:
In[]:=
energy=Integrate[sechSolution^3-1/2*(D[sechSolution,x])^2,{x,-Infinity,Infinity}];Print["Conservation of energy: ",energy]
Conservation of energy: