PDESolutionTester.m Examples

SetDirectory["c:\\yourdirectory"]

<< PDESolutionTester.m

PDESolutionTester[
{ 
        D[u[x, t], t] - D[u[x, t], {x, 2}] - 
            u[x, t]*(1 - u[x, t]) == 0 }, 
{u[x, 
          t]}, {x, t}, {}, 
{ 
        u[x, t] -> 
          1/4 + 1/2*Tanh[1/(2*Sqrt[6])*x + 5/12*t] + 
            1/4*(Tanh[
                    1/(2*Sqrt[6])*x + 
                      5/12*t])^2 }, 
{}, {}, {}, {}, 
SymbolicTest -> True, NumericTest -> True, 
      Verbose -> True, DebugLevel -> 0]

(* Example 2: FitzHugh-Nagumo Equation (Tested Solutions) *)

testedSolutions  =  {u[x, t] -> 
            (1/2) (1 + Tanh[(1/4) (t - 2 alpha t - (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/2) (1 - Tanh[(1/4) (-t + 2 alpha t - (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/2) (1 + Tanh[(1/4) (t - 2 alpha t + (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/2) (1 - Tanh[(1/4) (-t + 2 alpha t + (Sqrt[2]) x)]), 
          u[x, t] -> -(1/2) alpha (-1 + 
                  Tanh[(1/4) (2 alpha t - 
                          (alpha^2) t - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/2) alpha (1 + 
                  Tanh[(1/4) (-2 alpha t + 
                          (alpha^2) t - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/2) (1 + alpha + 
                  Tanh[(1/4) (t - 
                          (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)] - 
                  alpha Tanh[
                      (1/4) (t - 
                            (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/2) (1 + alpha - 
                  Tanh[(1/4) (-t + 
                          (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)] + 
                  alpha Tanh[
                      (1/4) (-t + 
                            (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)]), 
          u[x, t] -> -(1/2) alpha (-1 + 
                  Tanh[(1/4) (2 alpha t - 
                          (alpha^2) t + (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/2) alpha (1 + 
                  Tanh[(1/4) (-2 alpha t + 
                          (alpha^2) t + (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/2) (1 + alpha + 
                  Tanh[(1/4) (t - 
                          (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)] - 
                  alpha Tanh[
                      (1/4) (t - 
                            (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/2) (1 + alpha - 
                  Tanh[(1/4) (-t + 
                          (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)] + 
                  alpha Tanh[
                      (1/4) (-t + 
                            (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)])};

PDESolutionTester[{D[u[x, t], t] - D[u[x, t], {x, 2}] + 
                u[x, t]*(1 - u[x, t])*(alpha - u[x, t]) == 
              0}, 
{u[x, t]}, {x, 
            t}, {alpha}, 
{#}, 
{alpha}, {alpha}, {}, {}, 
NumericTest -> True,  
          SymbolicTest -> True,  Verbose -> True] & /@ 
      testedSolutions

(* Example 3: FitzHugh-Nagumo Equation (Failed Solutions) *)

nonzeroSolutions  =  {u[x, t] -> 
            (1/6) (4 + alpha - 
                  3 alpha Tanh[
                      (1/4) (-2 alpha t + 
                            (alpha^2) t - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (4 + alpha - 
                  3 alpha Tanh[
                      (1/4) (-2 alpha t + 
                            (alpha^2) t + (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (4 + alpha + 
                  3 alpha Tanh[
                      (1/4) (2 alpha t - 
                            (alpha^2) t - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (4 + alpha + 
                  3 alpha Tanh[
                      (1/4) (2 alpha t - 
                            (alpha^2) t + (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (1 + 4 alpha - 
                  3 Tanh[(1/4) (t - 2 alpha t - (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/6) (1 + 4 alpha - 
                  3 Tanh[(1/4) (t - 2 alpha t + (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/6) (1 + 4 alpha + 
                  3 Tanh[(1/4) (-t + 2 alpha t - (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/6) (1 + 4 alpha + 
                  3 Tanh[(1/4) (-t + 2 alpha t + (Sqrt[2]) x)]), 
          u[x, t] -> 
            (1/6) (1 + alpha + 
                  3 Tanh[
                      (1/4) (-t + 
                            (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)] - 
                  3 alpha Tanh[
                      (1/4) (-t + 
                            (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (1 + alpha + 
                  3 Tanh[
                      (1/4) (-t + 
                            (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)] - 
                  3 alpha Tanh[
                      (1/4) (-t + 
                            (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (1 + alpha - 
                  3 Tanh[
                      (1/4) (t - (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)] + 
                  3 alpha Tanh[
                      (1/4) (t - 
                            (alpha^2) t + (Sqrt[2]) x - (Sqrt[2]) alpha x)]), 
          u[x, t] -> 
            (1/6) (1 + alpha - 
                  3 Tanh[
                      (1/4) (t - (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)] + 
                  3 alpha Tanh[
                      (1/4) (t - 
                            (alpha^2) t - (Sqrt[2]) x + (Sqrt[2]) alpha x)])};

PDESolutionTester[{D[u[x, t], t] - D[u[x, t], {x, 2}] + 
                u[x, t]*(1 - u[x, t])*(alpha - u[x, t]) == 
              0}, 
{u[x, t]}, {x, 
            t}, {alpha}, 
{#}, 
{alpha}, {alpha}, {}, {}, 
NumericTest -> True,  
          SymbolicTest -> True,  Verbose -> True] & /@ 
      nonzeroSolutions