# Unable to Solve Two-Point Boundary Value Problem

I'm trying to solve the equation -u''[x] + ((x - k)^2 - en[x]) u[x] == 0 using the boundary conditions u[0] == u[8] == 0, u'[0] == 1. en[x] is meant to be an eigenvalue that depends upon the value k. For this reason I wrote

Block[{k = 4},
sol = NDSolve[{-u''[x] + ((x - k)^2 - en[x]) u[x] == 0, en'[x] == 0,
u[0] == u[8] == 0, u'[0] == 1}, {u, en}, x]];


But plotting (Plot[u[x] /. First[sol], {x, 0, 10}]) this gives solutions u[x] which look nothing like they should and values en[x] nowhere near the values they should have and the following messages:

FindRoot::cvmit: Failed to converge to the requested accuracy or precision within
100  iterations. >>

NDSolve::berr: There are significant errors {-0.0000120696,-0.0000359624,-0.99995} in
the boundary value residuals. Returning the best solution found. >>

• NDSolve needs arguments and boundaries like this: {x, 0, 8} Commented Jan 12, 2014 at 16:31
• For some initial conditions there is "good" solution: k = 4; sol = NDSolve[{-u''[x] + ((x - k)^2 - en[x]) u[x] == 0, en'[x] == 0, u[0] == 4, u[8] == 0, u'[0] == 0}, {u, en}, {x, 0, 8}] Commented Jan 12, 2014 at 16:43