For such a equation

$$-y''(x) + x^2\cdot y(x) - |y(x)|^2\cdot y(x) = 0$$

with initial conditions: $y(-500) = 0$ and $y(500) = 0$.

I write in mathematica

ic1 = 0;
xmax = 500;
xmin = -500;
sol = NDSolve[{-y''[x] + x^2*y[x] - Abs[y[x]]^2*y[x] == 0, 
   y[xmax] == ic1, y[xmin] == ic1}, y[x], {x, xmin, xmax}]
Plot[y[x] /. sol, {x, xmin, xmax}]

but the graph is incorrect. Please help me

  • $\begingroup$ Can you show the output? It produces a straight zero line for me. $\endgroup$
    – m0nhawk
    Commented May 24, 2015 at 12:21
  • $\begingroup$ as far as i know, straight zero line is incorrect for this differential equation $\endgroup$
    – ssemish
    Commented May 24, 2015 at 12:25
  • 4
    $\begingroup$ Well, you can see pretty easily that y(x)=0 is a solution to the DE and the boundary conditions. $\endgroup$ Commented May 24, 2015 at 12:30
  • $\begingroup$ ok, let me correct my expression it is mistake to say incorrect, but are you saying it has only trivial solution ? $\endgroup$
    – ssemish
    Commented May 24, 2015 at 12:37
  • 1
    $\begingroup$ Solving for y[x], we can see that there is only one real root. (Solve[-y''[x] + x^2*y[x] - Abs[y[x]]^2*y[x] == 0, y[x]]). Moreover, your conditions suggestion that, there will be only trivial solution to this problem. Please paste a link, where we can see the equation ourselves. $\endgroup$
    – zhk
    Commented May 24, 2015 at 15:12

1 Answer 1


It seems that the ode under discussion has only trivial solution.

I checked it with both Mathematica and maple and got what was expected.

Mathematica output

Plot[y[x] /. sol, {x, xmin, xmax}]

enter image description here

Maple output






enter image description here

  • $\begingroup$ Thanks for all reply....@ Dr. Wolfgang Hintze yes i am searching for its eigenvalue problem as an exercise either, as you mentioned, with added the term like E*y(x) where E is eigenvalue, Do you have any idea? $\endgroup$
    – ssemish
    Commented May 25, 2015 at 9:14

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.