I have this partial differential equation (G and M are constants):

enter image description here

and a solution is:

enter image description here

Mathematica doesn't find any solutions. My code for DSolve is:

DSolve[-2*G*M^2*r*Derivative[0, 2][γ][r, z] + 2*G*M^2*Derivative[1, 0][γ][r, z] + 
  2*G*M^2*r*Derivative[2, 0][γ][r, z] == 0, γ[r, z], {r, z}]

and as a result I just got an echo:

enter image description here

Any suggestions? Or nothing can be done in this case?

  • $\begingroup$ Sorry. Now it is working. $\endgroup$ Commented Jul 26, 2013 at 1:50
  • $\begingroup$ Well, it's not surprising to see that DSolve fails in solving a PDE… $\endgroup$
    – xzczd
    Commented Jul 26, 2013 at 8:47

1 Answer 1


Since there doesn't seem to be an easy automated way of solving this partial differential equation in general, it may be worth asking at least for the minimum of manual work required to get a solution. I'll omit the various common constants in the original differential equation because they can be divided out.

From the equation it is pretty obvious that we should expect separation of variables to work (the particular solution g = r^2 + 2z^2 in the question is not of this type, but since there are no boundary conditions specified it seems we should find a set of general solutions). Therefore, I'll guide Mathematica to obtain the separated equations for the z and r coordinates:


equations = -r*Derivative[0, 2][γ][r, z] + 
   Derivative[1, 0][γ][r, z] + 
   r*Derivative[2, 0][γ][r, z] == 0

$r \,\text{g2}(z) \text{g1}''(r)+\text{g2}(z) \text{g1}'(r)-r \,\text{g1}(r) \text{g2}''(z)=0$

γ[r_, z_] := g1[r] g2[z]

separatedEqn = Simplify[Map[#/(r g1[r] g2[z]) &, equations], r > 0]

$\frac{\text{g1}''(r)+\frac{\text{g1}'(r)}{r}} {\text{g1}(r)}=\frac{\text{g2}''(z)}{\text {g2}(z)}$

γ[r, z] /. 
 Flatten@{DSolve[separatedEqn[[1]] == K, g1, r, 
    GeneratedParameters -> CR], 
   DSolve[separatedEqn[[2]] == K, g2, z, GeneratedParameters -> CZ]}

$\left(\text{CZ}(1) e^{\sqrt{K} z}+\text{CZ}(2) e^{-\sqrt{K} z}\right) \left(\text{CR}(1) J_0\left(i \sqrt{K} r\right)+\text{CR}(2) Y_0\left(-i \sqrt{K} r\right)\right)$

Here, K is the separation constant which has to be set equal to the left and right-hand side of separatedEqn by the standard argument of the separation technique: each side manifestly depends only on one of the two independent variables (r or z), and therefore both sides must be equal to a common constant.

The resulting ordinary differential equations with z and r as variables can then be solved with DSolve, leading to four additional integration constants. Since I want to combine the solutions for the factors g1[r] and g2[z], I have to make sure to use different names for the integration constants, which is done using GeneratedParameters.

  • $\begingroup$ Very nice addition, thanks! $\endgroup$ Commented Jul 27, 2013 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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