pdetest
test the solutions found by pdsolve for partial differential equations (PDEs) and PDE systems
Calling Sequence
Parameters
Description
Examples
pdetest(sol, PDE)
sol
-
solution for PDE
PDE
partial differential equation, or a set or list of them representing a system that can also include boundary conditions
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.
Define a PDE, solve it, and then test the solution.
PDE≔exp⁡diff⁡f⁡x,y,z,t,`$`⁡x,5+diff⁡f⁡x,y,z,t,`$`⁡y,4⁢g⁡x⁢h⁡y=0
PDE≔ⅇ∂5∂x5f⁡x,y,z,t+∂4∂y4f⁡x,y,z,t⁢g⁡x⁢h⁡y=0
ans≔pdsolve⁡PDE
ans≔f⁡x,y,z,t=f__1⁡x+f__2⁡y+f__5⁡z,twhereⅆ4ⅆy4f__2⁡y=−_c1h⁡y,ⅆ5ⅆx5f__1⁡x=ln⁡_c1⁢g⁡x,f__5⁡z,t, are arbitrary functions.
pdetest⁡ans,PDE
0
PDE≔diff⁡f⁡x,y,y⁢Diff⁡arctan⁡x12⁢y,y+diff⁡f⁡x,y,x⁢Diff⁡arctan⁡x12⁢y,x=0
PDE≔∂∂yf⁡x,y⁢ⅆⅆyarctan⁡x⁢y+∂∂xf⁡x,y⁢ⅆⅆxarctan⁡x⁢y=0
ans≔f⁡x,y=f__1⁡−2⁢x2+y2
PDE≔x⁢diff⁡f⁡x,y,y2−diff⁡f⁡x,y,x=f⁡x,y
PDE≔x⁢∂∂yf⁡x,y2−∂∂xf⁡x,y=f⁡x,y
ans≔pdsolve⁡PDE,HINT=strip
ans≔x⁢∂∂yf⁡x,y2−∂∂xf⁡x,y−f⁡x,y=0wheref⁡_s=−_s⁢c__42−ⅇ−_s⁢c__2+c__1⁢ⅇ2⁢_s,x⁡_s=−_s+c__5,y⁡_s=2⁢−_s+c__5+1⁢c__4⁢ⅇ_s+c__3,_p1⁡_s=−c__42⁢ⅇ_s+c__2⁢ⅇ_s,_p2⁡_s=c__4⁢ⅇ_s,and_p1=∂∂xf⁡x,y,_p2=∂∂yf⁡x,y
You can use pdetest to solve a PDE. First, define the PDE.
PDE≔x⁢diff⁡f⁡x,y,y−diff⁡f⁡x,y,x=f⁡x,y
PDE≔x⁢∂∂yf⁡x,y−∂∂xf⁡x,y=f⁡x,y
Next, give an ansatz.
ansatz≔f⁡x,y=F⁡x⁢exp⁡y
ansatz≔f⁡x,y=F⁡x⁢ⅇy
Use pdetest to simplify the PDE with regard to the ansatz above.
ans_1≔pdetest⁡ansatz,PDE
ans_1≔ⅇy⁢F⁡x⁢x−ⅆⅆxF⁡x−F⁡x
The ansatz above separated the variables, so the PDE can now be solved for F(x).
factor⁡ans_1
ⅇy⁢F⁡x⁢x−ⅆⅆxF⁡x−F⁡x
ans_F≔dsolve⁡ans_1,F⁡x
ans_F≔F⁡x=c__1⁢ⅇx⁢x−22
Now, build a (particular) solution to the PDE by substituting the result above in "ansatz".
ans≔subs⁡ans_F,ansatz
ans≔f⁡x,y=c__1⁢ⅇx⁢x−22⁢ⅇy
Test solutions for PDE systems.
sys≔diff⁡u⁡x,t,t=diff⁡u⁡x,t,`$`⁡x,2−v⁡x,t,diff⁡v⁡x,t,t=diff⁡v⁡x,t,`$`⁡x,2−u⁡x,t
sys≔∂∂tu⁡x,t=∂2∂x2u⁡x,t−v⁡x,t,∂∂tv⁡x,t=∂2∂x2v⁡x,t−u⁡x,t
sol≔pdsolve⁡sys,u⁡x,t,v⁡x,t
sol≔u⁡x,t=c__1⁢cos⁡x+c__2⁢ⅇx+c__3⁢sin⁡x+c__4ⅇx+ⅇt⁢c__6+c__5ⅇt,v⁡x,t=−ⅇt⁢c__6+c__5ⅇt−c__1⁢cos⁡x+c__2⁢ⅇx−c__3⁢sin⁡x+c__4ⅇx
pdetest⁡sol,sys
0,0
Consider the following PDE, boundary condition, and solution
pde≔diff⁡u⁡x,t,t=k⁢diff⁡diff⁡u⁡x,t,x,x+Q
pde≔∂∂tu⁡x,t=k⁢∂2∂x2u⁡x,t+Q
bc1≔u⁡0,t=2⁢exp⁡k⁢t−1k⁢Q
bc1≔u⁡0,t=2⁢ⅇk⁢t−Qk
sol≔u⁡x,t=_C12⁢exp⁡x+k⁢t−_C12−2⁢exp⁡−x+k⁢t−12⁢k⁢Q⁢x2+1_C12⁢k⁢Q⁢_C12−2⁢x−1k⁢Q
sol≔u⁡x,t=c__12⁢ⅇk⁢t+x−c__12−2⁢ⅇk⁢t−x−Q⁢x22⁢k+Q⁢c__12−2⁢xc__12⁢k−Qk
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]
pdetest⁡sol,pde,bc1
The boundary conditions can involve derivatives:
bc2≔D1,1⁡u⁡0,t=2⁢exp⁡k⁢t−1k⁢Q
bc2≔D1,1⁡u⁡0,t=2⁢ⅇk⁢t−Qk
pdetest⁡sol,pde,bc2
See Also
dchange
PDEtools
pdsolve
splitstrip
strip
Download Help Document