pdetest - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

pdetest

test the solutions found by pdsolve for partial differential equations (PDEs) and PDE systems

 Calling Sequence pdetest(sol, PDE)

Parameters

 sol - solution for PDE PDE - partial differential equation, or a set or list of them representing a system that can also include boundary conditions

Description

 • The pdetest command returns either 0 (when the PDE is annulled by the solution sol), indicating that the solution is correct, or a remaining algebraic expression (obtained after simplifying the PDE with respect to the proposed solution), indicating that the solution might be wrong.
 • When PDE is a system, given as a set or list, possibly including boundary conditions, for each of the elements in the set/list pdetest will return a 0 or the remaining algebraic expression; the advantage of giving PDE as a list is that you can thus determine which element (if any) is not satisfied by the solution.
 • The pdetest command can also be used to reduce a PDE to a simpler problem by giving an "ansatz", instead of an explicit solution, since it will return the nonzero remaining part.

Examples

Define a PDE, solve it, and then test the solution.

 > $\mathrm{PDE}≔{ⅇ}^{\frac{{\partial }^{5}}{\partial {x}^{5}}f\left(x,y,z,t\right)}+\left(\frac{{\partial }^{4}}{\partial {y}^{4}}f\left(x,y,z,t\right)\right)g\left(x\right)h\left(y\right)=0$
 ${\mathrm{PDE}}{≔}{{ⅇ}}^{\frac{{{\partial }}^{{5}}}{{\partial }{{x}}^{{5}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}{,}{z}{,}{t}\right)}{+}\left(\frac{{{\partial }}^{{4}}}{{\partial }{{y}}^{{4}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}{,}{z}{,}{t}\right)\right){}{g}{}\left({x}\right){}{h}{}\left({y}\right){=}{0}$ (1)
 > $\mathrm{ans}≔\mathrm{pdsolve}\left(\mathrm{PDE}\right)$
 ${\mathrm{ans}}{≔}\left({f}{}\left({x}{,}{y}{,}{z}{,}{t}\right){=}\mathrm{f__1}{}\left({x}\right){+}\mathrm{f__2}{}\left({y}\right){+}\mathrm{f__5}{}\left({z}{,}{t}\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{&where}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left[\left\{\frac{{{ⅆ}}^{{4}}}{{ⅆ}{{y}}^{{4}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{f__2}{}\left({y}\right){=}{-}\frac{{{\mathrm{_c}}}_{{1}}}{{h}{}\left({y}\right)}{,}\frac{{{ⅆ}}^{{5}}}{{ⅆ}{{x}}^{{5}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{f__1}{}\left({x}\right){=}{\mathrm{ln}}{}\left({{\mathrm{_c}}}_{{1}}{}{g}{}\left({x}\right)\right)\right\}{,}\left(\mathrm{f__5}{}\left({z}{,}{t}\right){,}{\mathrm{are arbitrary functions.}}\right)\right]$ (2)
 > $\mathrm{pdetest}\left(\mathrm{ans},\mathrm{PDE}\right)$
 ${0}$ (3)
 > $\mathrm{PDE}≔\left(\frac{\partial }{\partial y}f\left(x,y\right)\right)\left(\frac{{\partial }}{{\partial }y}\mathrm{arctan}\left({x}^{\frac{1}{2}}y\right)\right)+\left(\frac{\partial }{\partial x}f\left(x,y\right)\right)\left(\frac{{\partial }}{{\partial }x}\mathrm{arctan}\left({x}^{\frac{1}{2}}y\right)\right)=0$
 ${\mathrm{PDE}}{≔}\left(\frac{{\partial }}{{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)\right){}\left(\frac{{\partial }}{{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{arctan}}{}\left(\sqrt{{x}}{}{y}\right)\right){+}\left(\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)\right){}\left(\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\mathrm{arctan}}{}\left(\sqrt{{x}}{}{y}\right)\right){=}{0}$ (4)
 > $\mathrm{ans}≔\mathrm{pdsolve}\left(\mathrm{PDE}\right)$
 ${\mathrm{ans}}{≔}{f}{}\left({x}{,}{y}\right){=}\mathrm{f__1}{}\left({-}{2}{}{{x}}^{{2}}{+}{{y}}^{{2}}\right)$ (5)
 > $\mathrm{pdetest}\left(\mathrm{ans},\mathrm{PDE}\right)$
 ${0}$ (6)
 > $\mathrm{PDE}≔x{\left(\frac{\partial }{\partial y}f\left(x,y\right)\right)}^{2}-\left(\frac{\partial }{\partial x}f\left(x,y\right)\right)=f\left(x,y\right)$
 ${\mathrm{PDE}}{≔}{x}{}{\left(\frac{{\partial }}{{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)\right)}^{{2}}{-}\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right){=}{f}{}\left({x}{,}{y}\right)$ (7)
 > $\mathrm{ans}≔\mathrm{pdsolve}\left(\mathrm{PDE},\mathrm{HINT}=\mathrm{strip}\right)$
 ${\mathrm{ans}}{≔}\left({x}{}{\left(\frac{{\partial }}{{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)\right)}^{{2}}{-}\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right){-}{f}{}\left({x}{,}{y}\right){=}{0}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{&where}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left[\left\{\left\{{f}{}\left({\mathrm{_s}}\right){=}\left({-}{\mathrm{_s}}{}{\mathrm{c__4}}^{{2}}{-}{{ⅇ}}^{{-}{\mathrm{_s}}}{}\mathrm{c__2}{+}\mathrm{c__1}\right){}{{ⅇ}}^{{2}{}{\mathrm{_s}}}{,}{x}{}\left({\mathrm{_s}}\right){=}{-}{\mathrm{_s}}{+}\mathrm{c__5}{,}{y}{}\left({\mathrm{_s}}\right){=}{2}{}\left({-}{\mathrm{_s}}{+}\mathrm{c__5}{+}{1}\right){}\mathrm{c__4}{}{{ⅇ}}^{{\mathrm{_s}}}{+}\mathrm{c__3}{,}{{\mathrm{_p}}}_{{1}}{}\left({\mathrm{_s}}\right){=}\left({-}{\mathrm{c__4}}^{{2}}{}{{ⅇ}}^{{\mathrm{_s}}}{+}\mathrm{c__2}\right){}{{ⅇ}}^{{\mathrm{_s}}}{,}{{\mathrm{_p}}}_{{2}}{}\left({\mathrm{_s}}\right){=}\mathrm{c__4}{}{{ⅇ}}^{{\mathrm{_s}}}\right\}\right\}{,}{&and}{}\left(\left\{{{\mathrm{_p}}}_{{1}}{=}\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right){,}{{\mathrm{_p}}}_{{2}}{=}\frac{{\partial }}{{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)\right\}\right)\right]$ (8)
 > $\mathrm{pdetest}\left(\mathrm{ans},\mathrm{PDE}\right)$
 ${0}$ (9)

You can use pdetest to solve a PDE.  First, define the PDE.

 > $\mathrm{PDE}≔x\left(\frac{\partial }{\partial y}f\left(x,y\right)\right)-\left(\frac{\partial }{\partial x}f\left(x,y\right)\right)=f\left(x,y\right)$
 ${\mathrm{PDE}}{≔}{x}{}\left(\frac{{\partial }}{{\partial }{y}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right)\right){-}\frac{{\partial }}{{\partial }{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({x}{,}{y}\right){=}{f}{}\left({x}{,}{y}\right)$ (10)

Next, give an ansatz.

 > $\mathrm{ansatz}≔f\left(x,y\right)=F\left(x\right){ⅇ}^{y}$
 ${\mathrm{ansatz}}{≔}{f}{}\left({x}{,}{y}\right){=}{F}{}\left({x}\right){}{{ⅇ}}^{{y}}$ (11)

Use pdetest to simplify the PDE with regard to the ansatz above.

 > $\mathrm{ans_1}≔\mathrm{pdetest}\left(\mathrm{ansatz},\mathrm{PDE}\right)$
 ${\mathrm{ans_1}}{≔}{{ⅇ}}^{{y}}{}\left({F}{}\left({x}\right){}{x}{-}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{F}{}\left({x}\right){-}{F}{}\left({x}\right)\right)$ (12)

The ansatz above separated the variables, so the PDE can now be solved for F(x).

 > $\mathrm{factor}\left(\mathrm{ans_1}\right)$
 ${{ⅇ}}^{{y}}{}\left({F}{}\left({x}\right){}{x}{-}\frac{{ⅆ}}{{ⅆ}{x}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{F}{}\left({x}\right){-}{F}{}\left({x}\right)\right)$ (13)
 > $\mathrm{ans_F}≔\mathrm{dsolve}\left(\mathrm{ans_1},F\left(x\right)\right)$
 ${\mathrm{ans_F}}{≔}{F}{}\left({x}\right){=}\mathrm{c__1}{}{{ⅇ}}^{\frac{{x}{}\left({x}{-}{2}\right)}{{2}}}$ (14)

Now, build a (particular) solution to the PDE by substituting the result above in "ansatz".

 > $\mathrm{ans}≔\mathrm{subs}\left(\mathrm{ans_F},\mathrm{ansatz}\right)$
 ${\mathrm{ans}}{≔}{f}{}\left({x}{,}{y}\right){=}\mathrm{c__1}{}{{ⅇ}}^{\frac{{x}{}\left({x}{-}{2}\right)}{{2}}}{}{{ⅇ}}^{{y}}$ (15)
 > $\mathrm{pdetest}\left(\mathrm{ans},\mathrm{PDE}\right)$
 ${0}$ (16)

Test solutions for PDE systems.

 > $\mathrm{sys}≔\left[\frac{\partial }{\partial t}u\left(x,t\right)=\frac{{\partial }^{2}}{\partial {x}^{2}}u\left(x,t\right)-v\left(x,t\right),\frac{\partial }{\partial t}v\left(x,t\right)=\frac{{\partial }^{2}}{\partial {x}^{2}}v\left(x,t\right)-u\left(x,t\right)\right]$
 ${\mathrm{sys}}{≔}\left[\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){-}{v}{}\left({x}{,}{t}\right){,}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right){=}\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{v}{}\left({x}{,}{t}\right){-}{u}{}\left({x}{,}{t}\right)\right]$ (17)
 > $\mathrm{sol}≔\mathrm{pdsolve}\left(\mathrm{sys},\left\{u\left(x,t\right),v\left(x,t\right)\right\}\right)$
 ${\mathrm{sol}}{≔}\left\{{u}{}\left({x}{,}{t}\right){=}\mathrm{c__1}{}{\mathrm{cos}}{}\left({x}\right){+}\mathrm{c__2}{}{{ⅇ}}^{{x}}{+}\mathrm{c__3}{}{\mathrm{sin}}{}\left({x}\right){+}\frac{\mathrm{c__4}}{{{ⅇ}}^{{x}}}{+}{{ⅇ}}^{{t}}{}\mathrm{c__6}{+}\frac{\mathrm{c__5}}{{{ⅇ}}^{{t}}}{,}{v}{}\left({x}{,}{t}\right){=}{-}{{ⅇ}}^{{t}}{}\mathrm{c__6}{+}\frac{\mathrm{c__5}}{{{ⅇ}}^{{t}}}{-}\mathrm{c__1}{}{\mathrm{cos}}{}\left({x}\right){+}\mathrm{c__2}{}{{ⅇ}}^{{x}}{-}\mathrm{c__3}{}{\mathrm{sin}}{}\left({x}\right){+}\frac{\mathrm{c__4}}{{{ⅇ}}^{{x}}}\right\}$ (18)
 > $\mathrm{pdetest}\left(\mathrm{sol},\mathrm{sys}\right)$
 $\left[{0}{,}{0}\right]$ (19)

Consider the following PDE, boundary condition, and solution

 > $\mathrm{pde}≔\frac{\partial }{\partial t}u\left(x,t\right)=k\left(\frac{\partial }{\partial x}\left(\frac{\partial }{\partial x}u\left(x,t\right)\right)\right)+Q$
 ${\mathrm{pde}}{≔}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right){=}{k}{}\left(\frac{{{\partial }}^{{2}}}{{\partial }{{x}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{u}{}\left({x}{,}{t}\right)\right){+}{Q}$ (20)
 > ${\mathrm{bc}}_{1}≔u\left(0,t\right)=2{ⅇ}^{kt}-\frac{1Q}{k}$
 ${{\mathrm{bc}}}_{{1}}{≔}{u}{}\left({0}{,}{t}\right){=}{2}{}{{ⅇ}}^{{k}{}{t}}{-}\frac{{Q}}{{k}}$ (21)
 > $\mathrm{sol}≔u\left(x,t\right)={\mathrm{_C1}}^{2}{ⅇ}^{x+kt}-\left({\mathrm{_C1}}^{2}-2\right){ⅇ}^{-x+kt}-\frac{1Q{x}^{2}}{2k}+\frac{1Q\left({\mathrm{_C1}}^{2}-2\right)x}{{\mathrm{_C1}}^{2}k}-\frac{1Q}{k}$
 ${\mathrm{sol}}{≔}{u}{}\left({x}{,}{t}\right){=}{\mathrm{c__1}}^{{2}}{}{{ⅇ}}^{{k}{}{t}{+}{x}}{-}\left({\mathrm{c__1}}^{{2}}{-}{2}\right){}{{ⅇ}}^{{k}{}{t}{-}{x}}{-}\frac{{Q}{}{{x}}^{{2}}}{{2}{}{k}}{+}\frac{{Q}{}\left({\mathrm{c__1}}^{{2}}{-}{2}\right){}{x}}{{\mathrm{c__1}}^{{2}}{}{k}}{-}\frac{{Q}}{{k}}$ (22)

You can test whether the sol solves pde using pdetest; the novelty is that you can now test whether it solves the boundary condition bc[1]

 > $\mathrm{pdetest}\left(\mathrm{sol},\left[\mathrm{pde},{\mathrm{bc}}_{1}\right]\right)$
 $\left[{0}{,}{0}\right]$ (23)

The boundary conditions can involve derivatives:

 > ${\mathrm{bc}}_{2}≔{\mathrm{D}}_{1,1}\left(u\right)\left(0,t\right)=2{ⅇ}^{kt}-\frac{1Q}{k}$
 ${{\mathrm{bc}}}_{{2}}{≔}{{\mathrm{D}}}_{{1}{,}{1}}{}\left({u}\right){}\left({0}{,}{t}\right){=}{2}{}{{ⅇ}}^{{k}{}{t}}{-}\frac{{Q}}{{k}}$ (24)
 > $\mathrm{pdetest}\left(\mathrm{sol},\left[\mathrm{pde},{\mathrm{bc}}_{2}\right]\right)$
 $\left[{0}{,}{0}\right]$ (25)