(* Last modified by Hereman on March 15, 2020 at 14:20, previously on September 24, 2019 at 01:20am *)

(* If you saved the software in, for example, the subdirectory demopdespecialsolutions on drive D, then set the location with the command *)

SetDirectory["c:\\Users\\whereman.NATH\\data\\demopdespecialsolutions"]

(* Example: SetDirectory["c:\\data\\demoPDESpecialSolutions"] *)

(* Load the package PDESpecialSolutionsV2.m with the command *)

Get["PDESpecialSolutionsV4-Traditional-Format-Mar15-2020.m"]

(* To see information about the package execute the command below *)

?? PDESpecialSolutions

(* Example 1: Korteweg-de Vries Equation *)

PDESpecialSolutions[D[u[x,t], t] + alpha*u[x,t]*D[u[x,t],x] + D[u[x,t],{x,3}] == 0, u[x,t], {x,t}, {alpha}, Verbose -> True]

(* Example 1 again: Korteweg-de Vries Equation other options *)

(* Use the Form option to select either Tanh, Sech, SechTanh, Cn or Sn. Lower cases also work. *)

PDESpecialSolutions[D[u[x,t], t] + alpha*u[x,t]*D[u[x,t],x] + D[u[x,t],{x,3}] == 0, u[x,t], {x,t}, {alpha}, Form->sech]

PDESpecialSolutions[D[u[x,t], t] + alpha*u[x,t]*D[u[x,t],x] + D[u[x,t],{x,3}] == 0, u[x,t], {x,t}, {alpha}, Form->Cn]

(* Example 2: Boussinesq Equation (single equation) *)
(* Again, use the option Verbose -> True to see a trace of the main steps of the algorithm. *)

PDESpecialSolutions[{D[u[x,t],{t,2}]-D[u[x,t],{x,2}]+3*u[x,t]*D[u[x,t],{x,2}]+3*(D[u[x,t],x])^2+alpha*D[u[x,t],{x,4}] == 0}, {u[x,t]}, {x,t}, {alpha}, Verbose->True]

(* Example 3: The Boussinesq System *)

PDESpecialSolutions[{D[u[x,t],t]+D[v[x,t],x] == 0, D[v[x,t], t]+D[u[x,t], x]-3*u[x,t]*D[u[x,t],x]-alpha*D[u[x,t],{x,3}] == 0},{u[x,t],v[x,t]}, {x,t}, {alpha}, Verbose -> True]

(* Use the SolveAlgebraicSystem -> False option to output the algebraic system for the coefficients. *)

PDESpecialSolutions[{D[u[x,t],t]+D[v[x,t],x] == 0, D[v[x,t], t]+D[u[x,t], x]-3*u[x,t]*D[u[x,t],x]-alpha*D[u[x,t],{x,3}] == 0}, {u[x,t],v[x,t]}, {x,t}, {alpha},SolveAlgebraicSystem->False]

(* Example 4: Coupled KdV Equations *)

PDESpecialSolutions[{D[u[x,t],t] -alpha * (6 * u[x,t] * D[u[x,t],x]  +  D[u[x,t], {x,3}]) +2 * beta * v[x,t]* D[v[x,t], x]  ==0,D[v[x,t],t] + 3*u[x,t]*D[v[x,t],x] +D[v[x,t],{x,3}] == 0},{u[x,t], v[x,t]},{x,t},{alpha, beta}, Form->Sech]

(* Example 5: A Modified 3D KdV Equation *)

PDESpecialSolutions[D[u[x,y,z,t], t] + 6*u[x,y,z,t]^2*D[u[x,y,z,t],x] + D[u[x,y,z,t],{x,1},{y,1},{z,1}] == 0, u[x,y,z,t], {x,y,z,t}, {}, Form->Sech]

(* Example 6:  Equation due to Gao and Tian *)

PDESpecialSolutions[{D[u[x,t], t] - D[u[x,t], x] - 2*v[x,t] == 0, D[v[x,t], t] + 2*u[x,t]*w[x,t] == 0, D[w[x,t], t] + 2*u[x,t]*v[x,t] == 0}, {u[x,t], v[x,t], w[x,t]}, {x,t}, {}, Form->SechTanh]

(* Example 7: Zakharov-Kuznetsov KdV-type Equations *)

PDESpecialSolutions[D[u[x,y,z,t],t] + alpha*u[x,y,z,t]*D[u[x,y,z,t],x] +D[u[x,y,z,t], {x,3}]+D[u[x,y,z,t],x, y,y] +D[u[x,y,z,t], x, z, z] ==0,u[x,y,z,t],{x,y,z,t},{alpha}]

PDESpecialSolutions[D[u[x,y,z,t],t] + alpha*u[x,y,z,t]*D[u[x,y,z,t],x] +D[u[x,y,z,t], {x,3}]+D[u[x,y,z,t], x, y,y] +D[u[x,y,z,t], x, z, z] ==0,u[x,y,z,t],{x,y,z,t},
{alpha}, Form->Sech]

(* Example 8: Modified KdV-ZK Equation (due to Das and Verheest) *)

PDESpecialSolutions[D[u[x,y,z,t], t] +alpha * u[x,y,z,t] ^ 2 * D[u[x,y,z,t],x] + D[u[x,y,z,t], {x,3}]+D[u[x,y,z,t], x, y,y] +D[u[x,y,z,t], x, z, z] ==0,u[x,y,z,t],{x,y,z,t},{alpha}]

PDESpecialSolutions[D[u[x,y,z,t], t] +alpha * u[x,y,z,t] ^ 2 * D[u[x,y,z,t],x] + D[u[x,y,z,t], {x,3}]+D[u[x,y,z,t], x, y,y] +D[u[x,y,z,t], x, z, z] ==0,u[x,y,z,t],{x,y,z,t},{alpha}, Form->Sech]

(* Example 9: Generalized Kuramoto-Sivashinsky Equation *)

PDESpecialSolutions[D[u[x,t],t] + u[x,t]* D[u[x,t],x] + D[u[x,t],{x,2}]+alpha* D[u[x,t],{x,3}] + D[u[x,t],{x,4}] == 0,u[x,t],{x,t},{alpha}]

(* Example 10: Coupled KdV Equations *)

PDESpecialSolutions[{D[u[x,t],t] -alpha * (6 * u[x,t] * D[u[x,t],x]  +  D[u[x,t], {x,3}]) +2 * beta * v[x,t]* D[v[x,t], x]  ==0,D[v[x,t],t] + 3*u[x,t]*D[v[x,t],x] +D[v[x,t],{x,3}] == 0},{u[x,t], v[x,t]},{x,t},{alpha, beta}, Form->Cn]

(* Example 11: Another Coupled KdV Systems (due to Guha and Roy) *)

PDESpecialSolutions[{D[u[x,t],t] +  α * v[x,t]*D[v[x,t],x] + β*u[x,t]*D[u[x,t],x] +γ * D[u[x,t],{x,3}] ==0,D[v[x,t],t] + δ*D[u[x,t]*v[x,t],x] +ϵ*v[x,t]*D[v[x,t],x] ==0},{u[x,t], v[x,t]},{x,t},{α, β, γ , δ,ϵ}, Form->Sech]

(* Example 12: Fisher Equation *)

PDESpecialSolutions[{D[u[x,t],t] -D[u[x,t],{x,2}] -u[x,t]*(1-u[x,t]) == 0},{u[x,t]},{x,t},{}, Verbose -> True]

(* Example 14: FitzHugh-Nagumo Equation *)

PDESpecialSolutions[{beta*D[v[z],z] + Sqrt[2]*D[v[z], {z,2}] -Sqrt[2]*v[z]*(1-Sqrt[2]*v[z])*(alpha-Sqrt[2]*v[z]) == 0},{v[z]},{z},{alpha, beta}]

(* Example 15: A Degenerate Hamiltonian System *)

PDESpecialSolutions[{D[u[x,t],t] -D[u[x,t],x] -2*v[x,t] == 0,D[v[x,t],t] -2*epsilon*u[x,t]*v[x,t] ==0},{u[x,t],v[x,t]},{x,t},{epsilon}, Form->SechTanh]

(* Example 16: The KdV-Burgers Equation *)

PDESpecialSolutions[D[u[x,t],t] +alpha*u[x,t]*D[u[x,t],x] +beta*D[u[x,t],{x,2}] +D[u[x,t], {x,3}] ==0,u[x,t],{x,t},{alpha, beta}, Verbose -> True]

PDESpecialSolutions[D[u[x,t],t] +6*alpha*u[x,t]*D[u[x,t],x] +6*beta*u[x,t]^2*D[u[x,t],x] +gamma*D[u[x,t], {x,3}] ==0,u[x,t],{x,t},{alpha, beta, gamma}, Form->SechTanh]

MapAll[PowerExpand,MapAll[FullSimplify,{{u[x,t]->-(1/(2 beta))(alpha-2 (Sqrt[beta]) (Sqrt[gamma]) c[1] √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]-gamma t ((c[1])^3)])^2))},{u[x,t]->-(1/(2 beta))(alpha+2 (Sqrt[beta]) (Sqrt[gamma]) c[1] √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]-gamma t ((c[1])^3)])^2))},{u[x,t]->-(1/(2 beta))(alpha-2 (Sqrt[beta]) (Sqrt[gamma ((c[1])^2)]) √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]-gamma t ((c[1])^3)])^2))},{u[x,t]->-(1/(2 beta))(alpha+2 (Sqrt[beta]) (Sqrt[gamma ((c[1])^2)]) √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]-gamma t ((c[1])^3)])^2))},{u[x,t]->-(1/(2 beta))(alpha-(Sqrt[beta]) (Sqrt[gamma ((c[1])^2)]) √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)-I (Sqrt[beta]) (Sqrt[gamma]) c[1] √(1-((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)))},{u[x,t]->-(1/(2 beta))(alpha+(Sqrt[beta]) (Sqrt[gamma ((c[1])^2)]) √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)-I (Sqrt[beta]) (Sqrt[gamma]) c[1] √(1-((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)))},{u[x,t]->-(1/(2 beta))(alpha-(Sqrt[beta]) (Sqrt[gamma ((c[1])^2)]) √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)+I (Sqrt[beta]) (Sqrt[gamma]) c[1] √(1-((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)))},{u[x,t]->-(1/(2 beta))(alpha+(Sqrt[beta]) (Sqrt[gamma ((c[1])^2)]) √((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)+I (Sqrt[beta]) (Sqrt[gamma]) c[1] √(1-((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+(1/2) gamma t ((c[1])^3)])^2)))},{u[x,t]->-(1/(2 beta))(alpha-2 I (Sqrt[beta]) (Sqrt[gamma]) c[1] √(1-((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+2 gamma t ((c[1])^3)])^2)))},{u[x,t]->-(1/(2 beta))(alpha+2 I (Sqrt[beta]) (Sqrt[gamma]) c[1] √(1-((Sech[phase+((3 (alpha^2) t c[1])/(2 beta))+x c[1]+2 gamma t ((c[1])^3)])^2)))}}]]

(* Example 17: Duffing Equation *)

PDESpecialSolutions[{D[u[x], {x, 2}] + u[x] - alpha*u[x]^3 == 0}, u[x], {x}, {alpha}, Form->Cn]

PDESpecialSolutions[{D[u[x], {x, 2}] + u[x] - alpha*u[x]^3 == 0}, u[x], {x}, {alpha}, Form->Tanh]

(* Example 18: Another Fisher-type Equation *)

generalizedfisherequation =  u[x,t]*D[u[x,t],t] -u[x,t]*D[u[x,t],{x,2}] -D[u[x,t],x]^2-u[x,t]^2*(1-u[x,t]^3)

PDESpecialSolutions[{generalizedfisherequation ==0}, u[x,t], {x,t}, {}, Form->Tanh, Verbose -> True]

(* Transform the generalized Fisher equation by setting u[x,t] = v[x,t]^(2/3) *)

transformedgeneralizedfisherequation = generalizedfisherequation /.
{u[x,t]  -> v[x,t]^(2/3), Derivative[m_,n_][u][x,t] -> D[v[x,t]^(2/3),{x,m},{t,n}]}

transformedfisherequation =Numerator[ Factor[transformedgeneralizedfisherequation]]

PDESpecialSolutions[{transformedfisherequation ==0}, v[x,t], {x,t}, {}, Form->Tanh, Verbose -> True]