Backslide introduced in 9.0, persisting through 11.0.1
I want to clarify upfront, This is not a please help me get the answer to my homework question. I know what I need to do I just do not know how to get mathematica to do it.
I am working on an assignment from my Quantum Mechanics professor, where we attempt to glean the form of the wave functions for the first two eigenstates of a single electron in a potential. We are just taking a guess at the energy and using NDsolve to get a solution to the problem. Then inspecting it visually to make sure it looks right. Here is what I have for part I the harmonic Potential:
(*Constants*)
me = 9.11*10^(-31);
h = 6.62607 10^(-34);
hbar = h/(2 Pi);
nm = 1.00*10^(-9);
eV = 1.60218 10^(-19);
U = 1.5*eV;
L = 1.5*nm;
k = eV/nm^2;
Vhar[x_] := (k*x^2)/2;
ω = (k/me)^(1/2);
L = 1.5*nm;
α = Sqrt[(me*k/hbar^2)];
Ehar = (ν + 1/2) hbar*ω;
Do[
Print[
Plot[Evaluate[
f[x] /. NDSolve[{(-hbar^2/(2 *me))
f''[x] == (((ν + 1/2) hbar*ω) - Vhar[x]) f[x],
f[L] == 0, f'[-L] == 0.1}, f, {x, -L, L}]], {x, -L, L},
PlotRange -> All, PlotStyle -> Thick]], {ν, 0, 1, 1}];
Works Flawlessly, Great! I have a similar solution for the particle in a rectangular potential with an infinite wall at X=0, and a Finite one at x=L.
The last part of the problem wants us to look at a potential with infinite walls at x=+/=L, and a barrier of height U at -0.1L
Here I cant get the equations to solve. I have the Potential for part two in the form of a piece wise function but there appears to be an issue with the new one for part 3. My code is below:
Vb3[x_] := If[x < -L, 10^10, If[-0.1*L < x < 0.1*L, U, 0]];
NDSolve[{(-hbar^2/(2 *me)) f''[x] == (2.40986*^-20 - Vb3[x]) f[x],
f[L] == 0, f'[-L] == 0.1}, f, {x, -L, L}];
I get the following error.
NDSolve is not currently able to solve boundary value problems with discrete variables.
I cant find anything in the docs about how to fix this, but I know the problem is able to be solved. So how can I change my setup to avoid this problem with the boundary condition error?