Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to solve the equation:

$-(d^2/dx^2+d^2/dy^2)\psi+(x^2+y^2-2)\psi=0$

Here, is my code:

Eq = -(D[ψ[x, y], {x,2}] + D[ψ[x, y], {y,2}]) + (x^2 + y^2 - 2) ψ[x, y] == 0;

DSolve[Eq, ψ, {x, y}]

The output returns an unevaluated expression.

Why do I receive such a thing? The solution to the PDE is:

$\psi=\exp(-1/2(x^2+y^2))$

share|improve this question

closed as off-topic by m_goldberg, rasher, Öskå, ubpdqn, Szabolcs Jun 14 at 13:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, rasher, Öskå, ubpdqn, Szabolcs
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
I think your equation should be expressed as Eq = -(D[ψ[x, y], {x, 2}] + D[ψ[x, y], {y, 2}]) + (x^2 + y^2 - 2) ψ[x, y] == 0; –  m_goldberg Jun 13 at 23:57
    
I tried your suggestion. But, the output is not sensible. Why do you think so? Can you explain it more? –  NoOne Jun 14 at 0:02
    
@NoOne Another way of writing it would be Eq = -(Derivative[2, 0][\[Psi]][x, y] + Derivative[0, 2][\[Psi]][x, y]) + (x^2 + y^2 - 2) \[Psi][x, y] == 0;. But since that returns evaluated it means MMA couldn't solve it. Update the question with the correct syntax and ask instead how one can get MMA to solve this PDE. –  Pickett Jun 14 at 0:04
    
@Pickett; Why do you put [0, 2] and [2, 0] in some places? I do not understand it. –  NoOne Jun 14 at 0:08
1  
Ok, I validated your particular solution after an initial typo. Here is the code fyi: eq = -(D[phi[x, y], {x, 2}] + D[phi[x, y], {y, 2}]) + (x^2 + y^2 - 2) phi[x, y] == 0; eq /. phi -> (Exp[-1/2 (#1^2 + #2^2)] &) Simplify[%] gives True !Mathematica graphics but as was said, this is just one particular solution. DSolve finds general solutions –  Nasser Jun 14 at 0:56

2 Answers 2

up vote 2 down vote accepted

You can derive the radial solution to your differential equation as follows:

Eq = -(D[f[x, y], {x, 2}] + D[f[x, y], {y, 2}]) + (x^2 + y^2 - 2) f[x,y] == 0;

Assume that the solution is of the form fr[r] where r^2 = x^2 + y^2, and transform the {x, y} differential equation to the corresponding r differential equation.

Eqr = Eq /. f -> (fr[Sqrt[#1^2 + #2^2]] &) /. y^2 -> r^2 - x^2 // PowerExpand // Simplify

(* (-2 + r^2) fr[r] == Derivative[1][fr][r]/r + (fr^\[Prime]\[Prime])[r] *)

Solve the radial differential equation.

solfr = DSolve[Eqr, fr, {r}][[1]]

(*
  {fr -> Function[{r}, E^(-(r^2/2)) C[1]
                 + 1/2 E^(-(r^2/2)) C[2] ExpIntegralEi[r^2]]}
*)

Transform the radial solution fr[r] back to the corresponding f[x, y] solution.

solf = solfr /. {fr -> f, {r} -> {x, y}, r^2 -> x^2 + y^2}

(*
  {f -> Function[{x, y}, E^(-(1/2) (x^2 + y^2)) C[1]
                   + 1/2 E^(-(1/2) (x^2 + y^2)) C[2] ExpIntegralEi[x^2 + y^2]]}
*)

Verify that this solves the differential equation.

Eq /. solf // Simplify

(* True *)
share|improve this answer
    
It is really helpful! –  NoOne Jun 14 at 10:50

The Mathematica code you posted does not correspond to the equation you wrote. D[f[x],x] denotes/computes a single derivative. The second derivative, f''[x], should be written as D[f[x],{x,2}].

Please read the documentation of D.

The correct way to translate this equation into Mathematica code is

-(D[ψ[x, y], {x,2}] + D[ψ[x, y], {y,2}]) + (x^2 + y^2 - 2) ψ[x, y] == 0

Using DSolve on this equation returns unevaluated. This mean that Mathematica can not solve this equation symbolically.

Note: The solution you quote is valid, but it is not general. It is not the only solution this equation has.

share|improve this answer
    
Is it possible to obtain the specific solution, which I said in the question, from the above code in some way? –  NoOne Jun 14 at 0:17
    
@NoOne You'd have to explain in what way that particular solution is special, and use that criterion. At this point we are getting into math (not Mathematica). For example if you are looking for a rotationally symmetric solution (like the one you posted), you can use that criterion to rewrite the equation as a 1D one. –  Szabolcs Jun 14 at 0:20

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