(* Last modified by Hereman on Sunday, March 21, 2010 at 21:10 *)

(* Set the location with the SetDirectory command. 
For example, if the saved the software in the directory demoddespecialsolutions on drive d, use *)

SetDirectory["d:\\demoddespecialsolutions"]

SetDirectory["e:\\data\\demoddespecialsolutions\\analyzesolvemarch2010"]

(* Then load the package DDESpecialSolutionsV2.m with the Get command as follows *)

Get["DDESpecialSolutionsV3.m"]

?? DDESpecialSolutions

(* In difficult cases, there may be freedom in the choice of the degree of the polynomial solution. Thus, the software investigates all the possible solutions between MinDegreeOfThePolynomial and MaxDegreeOfThePolynomial.  *)

(* Single Toda equation *)

DDESpecialSolutions[{D[u[n,t], {t,2}] == (1+D[u[n,t], t])*(u[n-1,t]-2*u[n,t]+u[n+1,t])},{u}, {n},{t}, {}, Verbose -> True]

(* Toda equation as a system of first-order *)
(* Use the Verbose -> True, option to see a trace of the steps of the algorithm. *)

DDESpecialSolutions[{D[u[n,t],t]-v[n,t]==0, D[v[n,t],t]-(1+v[n,t])*(u[n-1,t]-2*u[n,t]+u[n+1,t])==0}, {u, v}, {n},{t}, {},Verbose -> True]

(* Relativistic Toda equation *)
(* To use the symbolic test, use the SymbolicTest -> True option. *)

DDESpecialSolutions[{D[u[n,t] ,t] == (1+alpha*u[n,t])*(v[n,t]-v[n-1,t]), D[v[n,t], t] ==v[n,t]*(u[n+1,t]-u[n,t]+alpha*v[n+1,t]-alpha*v[n-1,t])}, {u,v},{n},{t},{alpha},SymbolicTest->True, Verbose -> True]

(* To force the function to use your choice of ansatz, use the DegreeOfThePolynomial option. *)

DDESpecialSolutions[{Derivative[0,1][u][n,t]==(1+alpha u[n,t]) (-v[-1+n,t]+v[n,t]),Derivative[0,1][v][n,t]==v[n,t] (-u[n,t]+u[1+n,t]-alpha v[-1+n,t]+alpha v[1+n,t])},{u,v},{n},{t},{alpha}, DegreeOfThePolynomial->{m[1]->1,m[2]->1}, Verbose -> True]

(* Volterra equation *)

(* To get the output in a copyable form, use the InputForm -> True option. *)

DDESpecialSolutions[{D[u[n,t], t] == u[n,t]*(v[n,t]-v[n-1,t]), D[v[n,t], t] == v[n,t]*(u[n+1,t]-u[n,t])}, {u, v}, {n},{t}, {}, InputForm->True, Verbose -> True]

(* If you would like to solve the algebraic system using other software, use the SolveAlgebraicSystem -> False option. *)

DDESpecialSolutions[{D[u[n,t], t] == u[n,t]*(v[n,t]-v[n-1,t]), D[v[n,t], t] == v[n,t]*(u[n+1,t]-u[n,t])}, {u, v}, {n},{t}, {}, SolveAlgebraicSystem->False, Verbose -> True]

(* A new integrable system related to the relativistic Toda equation *)
(* Ref: Suris, J.Phys.A.30 (1997) 1745 *)

DDESpecialSolutions[{D[u[n,t],t]==(u[n+1,t]-v[n,t])*v[n,t]-(u[n-1,t]-v[n-1,t])*v[n-1,t],D[v[n,t],t]==v[n,t]*(u[n+1,t]-u[n,t])},{u, v},{n},{t},{}, Verbose -> True]

(* On some integrable systems related to the Toda equations *)
(* Ref: Suris, J.Phys.A.30 (1997) 2235 *)

DDESpecialSolutions[{D[u[n,t],t]==u[n,t]*(v[n,t]-v[n-1,t]),D[v[n,t],t]==v[n,t]*(u[n+1,t]-u[n,t])},{u,v},{n},{t},{}, Verbose -> True]

(* Schrodinger system *)

DDESpecialSolutions[{D[u[n,t],t]-alpha*(u[n+1,t]-2*u[n,t]+u[n-1,t])-u[n,t]*v[n,t]*(u[n+1,t]+u[n-1,t])==0,D[v[n,t],t]+alpha*(v[n+1,t]-2*v[n,t]+v[n-1,t])+u[n,t]*v[n,t]*(v[n+1,t]+v[n-1,t])==0},{u, v}, {n},{t}, {alpha}, Verbose -> True]

(* Ablowitz-Ladik discretization of NLS equation *)

DDESpecialSolutions[{D[u[n,t], t] == aa*(u[n+1,t]-2*u[n,t]+u[n-1,t])+u[n,t]*v[n,t]*(u[n+1,t]+u[n-1,t]),D[v[n,t],t] ==-aa*(v[n+1,t]-2*v[n,t]+v[n-1,t])-u[n,t]*v[n,t]*(v[n+1,t]+v[n-1,t])},{u, v},{n},{t},{aa}, Verbose -> True]

(* NLS equation (Ablowitz-Ladik discretization) *)

DDESpecialSolutions[{D[u[n,t],t] ==aa*(bb*u[n+1,t]-2*bb*u[n,t]+bb*u[n-1,t])+u[n,t]*v[n,t]*(bb*u[n+1,t]+bb*u[n-1,t]),D[v[n,t],t] ==-aa*(bb*v[n+1,t]-2*bb*v[n,t]+bb*v[n-1,t])-u[n,t]*v[n,t]*(bb*v[n+1,t]+bb*v[n-1,t])},{u,v},{n},{t},{aa,bb}, Verbose -> True]

(* Modified KdV equation (with parameter) *)

DDESpecialSolutions[D[u[n,t],t]==(aa^2-u[n,t]^2)*(u[n+1,t]-u[n-1,t]),u,{n},{t},{aa}, Verbose -> True]

(* 1-D Volterra system *)
(* On the Dynamics of Rational Solutions for 1D Volterra System by A. S. Carstea in SIDE III. *)

DDESpecialSolutions[{D[q[n,t],t] == (a+b*q[n,t]-c*q[n,t]^2)*(r[n+1,t] - r[n-1,t]),D[r[n,t], t] == (a+b*r[n,t] - c*r[n,t]^2)*(q[n+1,t]-q[n-1,t])},{q,r},{n},{t},{a,b,c}, Verbose -> True]

(* Self-dual nonlinear network equation *)
(* Time-discretization of soliton equations by Ryogo Hirota and Masataka Iwao in SIDE III. *)

DDESpecialSolutions[D[v[n,t],t] == (1-v[n,t]^2)*(v[n-1,t] - v[n+1,t]),v,n,t,{}, Verbose -> True]

(* Hybrid equation *)
(* Time-discretization of soliton equations by Ryogo Hirota and Masataka Iwao in SIDE III. *)

DDESpecialSolutions[D[w[n,t],t] == (1+b*w[n,t]+c*w[n,t]^2)*(w[n-1,t] - w[n+1,t]),w,n,t,{b,c}, Verbose -> True]

(* (1+2)-dimensional Toda equations *)

DDESpecialSolutions[D[s[n,x,t], x,t] == (s[n-1,x,t] - 2*s[n,x,t]+s[n+1,x,t])*(D[s[n,x,t],t] + 1),s,n, {x, t},{}, Verbose -> True]

DDESpecialSolutions[{D[u[n,x,t], t] == v[n,x,t], D[v[n,x,t], x] == (u[n-1,x,t] - 2*u[n,x,t]+u[n+1,x,t])*(v[n,x,t] + 1)},{u,v},n, {x, t},{}, Verbose -> True]

(* Related to the discrete sine-Gordon equation. Software cannot solve the nonlinear algebraic system. *)

(* DDESpecialSolutions[(1+ v[n,t]^2)* D[v[n+1,t],t]== (1+v[n+1,t]^2)*D[v[n,t],t] - (v[n,t]+v[n+1,t])*(v[n,t]*v[n+1,t] - 1),v,n, t,{}, Verbose -> True] *)