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'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. >>
share|improve this question
    
NDSolve needs arguments and boundaries like this: {x, 0, 8} –  Kamov Sergey Jan 12 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}] –  Kamov Sergey Jan 12 at 16:43
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.