Solving a first order PDE system [closed]

How can I solve using Mathematica the simple 1st order PDE system:

$\frac{\partial P}{\partial x}=f(x,y,z)$

$\frac{\partial P}{\partial y}=g(x,y,z)$

$\frac{\partial P}{\partial z}=h(x,y,z)$

I want the complete expression for the scalar function P.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Nov 26 '15 at 13:57
• People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful -- You might also want to put your TeX between dollar signs. – Michael E2 Nov 26 '15 at 13:57
• @MichaelE2 That depends on whether the subscripts on f represent derivatives. If not, then additional relationships are required for the equations to have any solution at all, as I am sure you know. – bbgodfrey Nov 26 '15 at 14:05
• the subscripts do not indicate differentiation. I ve changed the notation so as to avoid this confusion. The functions f,g,h are given by very large expressions so I would like to solve it using Mathematica rather by hand. Actually It's not possible to manipulate the system by hand... – DK13 Nov 26 '15 at 15:47
• and f,g and h are components of a vector field – DK13 Nov 26 '15 at 15:51

1 Answer

In order for the set of equations in the question to have a solution, the vector must be Curl-free. In other words, all components of

Curl[{f[x, y, z], g[x, y, z], h[x, y, z]}, {x, y, z}]
(* {-Derivative[0, 0, 1][g][x, y, z] + Derivative[0, 1, 0][h][x, y, z],
Derivative[0, 0, 1][f][x, y, z] - Derivative[1, 0, 0][h][x, y, z],
-Derivative[0, 1, 0][f][x, y, z] + Derivative[1, 0, 0][g][x, y, z]} *))


must equate to zero.

Example

For instance, if the vector is given by the gradient of v,

vec = Grad[v[x, y, z], {x, y, z}]
(* {Derivative[1, 0, 0][v][x, y, z],
Derivative[0, 1, 0][v][x, y, z],
Derivative[0, 0, 1][v][x, y, z]} *)


Then, of course, the curl vanishes

Curl[vec, {x, y, z}]
(* {0, 0, 0} *)


and DSolve can provide an answer.

DSolve[{D[P[x, y, z], x] == vec[[1]], D[P[x, y, z], y] == vec[[2]],
D[P[x, y, z], z] == vec[[3]]}, P[x, y, z], {x, y, z}]
(* {{P[x, y, z] -> C[1] + v[x, y, z]}} *)


as expected. In contrast, if vec is not the gradient of a scalar, there is no solution, and DSolve returns unevaluated. Unfortunately, the converse is not necessarily true. If DSolve returns unevaluated, it is possible that it merely was unable to recognize that vec is the gradient of a scalar.

• Thank you for the advice, I tried it... The Curl of {f,g,h} does not vanish... – DK13 Nov 26 '15 at 20:23
• So I suppose that I have to modify, the components f,g,h so as to represent an Curl-free field... If the physical model permitts such a modification! – DK13 Nov 26 '15 at 20:24
• @DK13 Also, remember to run Simplify and, if necessary and not too slow, FullSimplify to be sure the vector is not curl-free. In my all too lengthy experience as a physicist, I have observed that most vectors in fundamental theories are either curl-free or divergence-free. – bbgodfrey Nov 26 '15 at 20:27