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.

  • $\begingroup$ 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! $\endgroup$ – Michael E2 Nov 26 '15 at 13:57
  • 1
    $\begingroup$ 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. $\endgroup$ – Michael E2 Nov 26 '15 at 13:57
  • $\begingroup$ @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. $\endgroup$ – bbgodfrey Nov 26 '15 at 14:05
  • $\begingroup$ 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... $\endgroup$ – DK13 Nov 26 '15 at 15:47
  • $\begingroup$ and f,g and h are components of a vector field $\endgroup$ – DK13 Nov 26 '15 at 15:51

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.


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.

  • $\begingroup$ Thank you for the advice, I tried it... The Curl of {f,g,h} does not vanish... $\endgroup$ – DK13 Nov 26 '15 at 20:23
  • $\begingroup$ 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! $\endgroup$ – DK13 Nov 26 '15 at 20:24
  • $\begingroup$ @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. $\endgroup$ – bbgodfrey Nov 26 '15 at 20:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.