1
$\begingroup$

There is the partial differential equations, $$ \left.\left\{\begin{array}{c}u_t-3qu^2u_x+\frac{3}{2}q(uv)_x-\frac{1}{4}qu_{xxx}=0,\\v_t+\frac{3}{2}qvv_x-3q(u^2v)_x+3qu_xu_{xx}+\frac{3}{2}quu_{xxx}-\frac{1}{4}qv_{xxx}=0,\quad q(\neq0)\in\mathbb{R}.\end{array}\right.\right. $$

eqns = {D[u[x, t], t] - 
     3*q*u[x, t]^2*D[u[x, t], x] + (3/2)*q*
      D[u[x, t]*v[x, t], x] - (1/4)*q*D[u[x, t], {x, 3}] == 0, 
   D[v[x, t], t] + (3/2)*q*v[x, t]*D[v[x, t], x] - 
     3*q*u[x, t]^2*D[v[x, t], x] + 
     3*q*D[u[x, t], x]*D[u[x, t], {x, 2}] + (3/2)*q*u[x, t]*
      D[u[x, t], {x, 3}] - (1/4)*q*D[v[x, t], {x, 3}] == 0};

I want to check a group of solutions in partial differential equations,My previous program produced the following results,

solution1 = {{a0 -> 0, a1 -> -1, b0 -> -1, b1 -> 0, b2 -> 1,c -> -q}, 
{a0 -> -(1/2), a1 -> -(1/2), b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -q}, 
{a0 -> 0, a1 -> -(1/2), b0 -> -(1/2), b1 -> 0,b2 -> 1/2, c -> -(q/4)}, 
{a0 -> 1/2, a1 -> -(1/2), b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -q}, 
{a0 -> -(1/2), a1 -> 1/2, b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -q}, 
{a0 -> 0, a1 -> 1/2, b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -(q/4)}, 
{a0 -> 1/2, a1 -> 1/2, b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -q}, 
{a0 -> 0, a1 -> 1, b0 -> -1, b1 -> 0, b2 -> 1, c -> -q}}

where

u[x_, t_] := a0 + a1 Tanh[x - ct]
v[x_, t_] := b0 + b1Tanh[x - ct] + b2Tanh[x - ct]^2

First, I took the values of the coefficients in each solution from solution1, and substituted them into the functions u and v, and finally generated a list(I actually did not use u and 'v').

soluList = 
 Table[{a0 + a1 Tanh[x - c t], 
    b0 + b1 Tanh[x - c t] + b2 Tanh[x - c t]^2} /. sol, {sol, 
   solution1}]

(* {{-Tanh[q*t + x], -1 + 
   Tanh[q*t + x]^2}, {-(1/2) - (1/2)*Tanh[q*t + x], -(1/2) + (1/2)*
    Tanh[q*t + x]^2}, 
   {(-(1/2))*
   Tanh[(q*t)/4 + x], -(1/2) + (1/2)*Tanh[(q*t)/4 + x]^2}, {1/
    2 - (1/2)*Tanh[q*t + x], -(1/2) + (1/2)*Tanh[q*t + x]^2}, 
   {-(1/2) + (1/2)*Tanh[q*t + x], -(1/2) + (1/2)*
    Tanh[q*t + x]^2}, {(1/2)*
   Tanh[(q*t)/4 + x], -(1/2) + (1/2)*Tanh[(q*t)/4 + x]^2}, 
   {1/2 + (1/2)*Tanh[q*t + x], -(1/2) + (1/2)*Tanh[q*t + x]^2}, {Tanh[
   q*t + x], -1 + Tanh[q*t + x]^2}} *)

Finally I tried to make a module to hold the verifying process, but it outputs an error,

verifySolutions2[sol_, eqns_] := 
  Module[{uSol, vSol, eqn1, eqn2, verifiedEqn1, verifiedEqn2},
   {uSol, vSol} = sol;
   eqn1 = eqns[[1]] /. {u[x, t] -> uSol, v[x, t] -> vSol};
   eqn2 = eqns[[2]] /. {u[x, t] -> uSol, v[x, t] -> vSol};
   verifiedEqn1 = Simplify[eqn1 == 0];
   verifiedEqn2 = Simplify[eqn2 == 0];
   {verifiedEqn1, verifiedEqn2}];


verifiedSolutions = Map[verifySolutions2[#, eqns] &, soluList]

(* Something like that it's too long, so I copy the first one
{(4*Derivative[0, 1][u][x, t] == 
    q*(6*(1 + Tanh[q*t + x]^2)*Derivative[1, 0][u][x, t] + 
       6*Tanh[q*t + x]*Derivative[1, 0][v][x, t] + 
              Derivative[3, 0][u][x, t])) == 
  0, (4*Derivative[0, 1][v][x, t] == 
    q*(6*(1 + Tanh[q*t + x]^2)*Derivative[1, 0][v][x, t] + 
              
       12*Derivative[1, 0][u][x, 
         t]*(2*Sech[q*t + x]^2*Tanh[q*t + x] - 
          Derivative[2, 0][u][x, t]) + 
       6*Tanh[q*t + x]*Derivative[3, 0][u][x, t] + 
              Derivative[3, 0][v][x, t])) == 0}, *)

I find Mathematica’s handling of Replace operations to be quite tricky to a beginner like me, and I’m hoping to get some help. Any suggestions would be greatly appreciated.

$\endgroup$
3
  • $\begingroup$ You should not plugin solutions into the ode or the pde. The standard way to verify solution generated by DSolve is given in howtoCheckTheResultsOfDSolve so you can use this method for your solutions by iterating over each one. $\endgroup$
    – Nasser
    Feb 6 at 8:51
  • $\begingroup$ What I meant is you should use the Function form to plugin the solution into the ode or pde as explained in the above link. $\endgroup$
    – Nasser
    Feb 6 at 9:24
  • $\begingroup$ @Nasser I understand, so my work now is making {-Tanh[q*t + x], -1 + Tanh[q*t + x]^2} to the Function form of u and v ? $\endgroup$
    – godspeed
    Feb 6 at 9:30

1 Answer 1

1
$\begingroup$

I mean like this

eqns = {D[u[x, t], t] - 
     3*q*u[x, t]^2*D[u[x, t], x] + (3/2)*q*
      D[u[x, t]*v[x, t], x] - (1/4)*q*D[u[x, t], {x, 3}] == 0, 
   D[v[x, t], t] + (3/2)*q*v[x, t]*D[v[x, t], x] - 
     3*q*u[x, t]^2*D[v[x, t], x] + 
     3*q*D[u[x, t], x]*D[u[x, t], {x, 2}] + (3/2)*q*u[x, t]*
      D[u[x, t], {x, 3}] - (1/4)*q*D[v[x, t], {x, 3}] == 0};

solV = v -> Function[{x, t}, b0 + b1*Tanh[x - c*t] + b2*Tanh[x - c*t]^2]
solU = u -> Function[{x, t}, a0 + a1  Tanh[x - c*t]]

solution1 = {{a0 -> 0, a1 -> -1, b0 -> -1, b1 -> 0, b2 -> 1, 
    c -> -q}, {a0 -> -(1/2), a1 -> -(1/2), b0 -> -(1/2), b1 -> 0, 
    b2 -> 1/2, c -> -q}, {a0 -> 0, a1 -> -(1/2), b0 -> -(1/2), 
    b1 -> 0, b2 -> 1/2, c -> -(q/4)}, {a0 -> 1/2, a1 -> -(1/2), 
    b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -q}, {a0 -> -(1/2), 
    a1 -> 1/2, b0 -> -(1/2), b1 -> 0, b2 -> 1/2, c -> -q}, {a0 -> 0, 
    a1 -> 1/2, b0 -> -(1/2), b1 -> 0, b2 -> 1/2, 
    c -> -(q/4)}, {a0 -> 1/2, a1 -> 1/2, b0 -> -(1/2), b1 -> 0, 
    b2 -> 1/2, c -> -q}, {a0 -> 0, a1 -> 1, b0 -> -1, b1 -> 0, 
    b2 -> 1, c -> -q}};

Now to verify using the first set of parameters do

 eqns /. {solV /. solution1[[1]],solU /. solution1[[1]]} // FullSimplify

Mathematica graphics

So it verified the v solution but the u solution did not verify. To do all:

Map[(eqns /. {solV /. #, solU /. #} // FullSimplify) &, solution1] // Column

Mathematica graphics

It looks like your u solution is wrong. But v is correct.

Watch the spacing. ct is not same as c t. did you mean to give q some value also?

$\endgroup$
1
  • $\begingroup$ Thank you greatly! yes I found it is different in Function between ct and c t, qis a nonzero real constant.After running your code, my result is {True, True} ,maybe there is a typo in my answer. $\endgroup$
    – godspeed
    Feb 6 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.