shooting method

Hello everybody

I want to solve Schrodinger equation for a quantum dot by shooting method. My code is:

v[x_] := If[0 < x < 0.5, 0, 50];
energy = 6;
xMax = 5;
solution =
NDSolve[{psi’‘[x] + (2/x) psi’[x] == -2 (energy - v[x]) psi[x],
psi[xMax] == 0, psi’[xMax] == 0.001}, psi, {x, 0, xMax}];
Plot[psi[x] /. solution, {x, 0, xMax}]

The plotted wave function is not the correct one. What is my mistake?

The plotted wave function is not the correct one

You did not tell the readers what the correct one should be? But this eliminates the warnings you were getting, may be it will get you started. I have no idea what the plot should look like, or if your equation and parameters are correct or not.

ClearAll[x, psi, v];
v[x_] := If[0 < x < 0.5, 0, 50];
energy = 6; xMax = 1;

solution = NDSolve[{psi''[x] + (2/x) psi'[x] == -2 (energy - v[x]) psi[x],psi[xMax] == 0, psi'[xMax] == 0.001},
  psi, {x, 0.00001, xMax}, Method -> "StiffnessSwitching"]
Plot[psi[x] /. solution, {x, 0.00001, xMax}]

I’ve found the quasi-linearization has better convergence for boundary value problems than the shooting method.

Thanks for your reply. it should be something like the wavefunction corresponding to n=1 in the attached figure.

Thanks for your suggestion. Unfortunately I have to use shooting method not other numerical methods.

I suspect the 2/x term, which is singular at the origin, is what’s causing problems.