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 ≔ ⅇ∂5∂x5⁢f⁡x,y,z,t+∂4∂y4⁢f⁡x,y,z,t⁢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,t&whereⅆ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 ≔ ∂∂y⁢f⁡x,y⁢∂∂y⁢arctan⁡x12⁢y+∂∂x⁢f⁡x,y⁢∂∂x⁢arctan⁡x12⁢y=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⁢∂∂y⁢f⁡x,y2−∂∂x⁢f⁡x,y=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=0&wheref⁡_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⁢∂∂y⁢f⁡x,y−∂∂x⁢f⁡x,y=f⁡x,y
PDE≔x⁢∂∂yf⁡x,y−∂∂xf⁡x,y=f⁡x,y
Next, give an ansatz.
ansatz ≔ f⁡x,y=F⁡x⁢ⅇ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 ≔ ∂∂t⁢u⁡x,t=∂2∂x2⁢u⁡x,t−v⁡x,t,∂∂t⁢v⁡x,t=∂2∂x2⁢v⁡x,t−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 ≔ ∂∂t⁢u⁡x,t=k⁢∂∂x⁢∂∂x⁢u⁡x,t+Q
pde≔∂∂tu⁡x,t=k⁢∂2∂x2u⁡x,t+Q
bc1 ≔ u⁡0,t=2⁢ⅇk⁢t−1⁢Qk
bc1≔u⁡0,t=2⁢ⅇk⁢t−Qk
sol ≔ u⁡x,t=_C12⁢ⅇx+k⁢t−_C12−2⁢ⅇ−x+k⁢t−1⁢Q⁢x22⁢k+1⁢Q⁢_C12−2⁢x_C12⁢k−1⁢Qk
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⁢ⅇk⁢t−1⁢Qk
bc2≔D1,1⁡u⁡0,t=2⁢ⅇk⁢t−Qk
pdetest⁡sol,pde,bc2
See Also
dchange
PDEtools
pdsolve
splitstrip
strip
Download Help Document