How Can I Solve A Stiff Boundary Value Problem In Mathematica 10?

Hello Everybody:

I am learning about NDSolve and how to apply it to “stiff” boundary value problems. The following example appears to show that NDSolve of Mathematica 10 “struggles”. Could you please let me know how can I make NDSolve work? Thanks for any help!!!

\[Lambda] = .62;
yn1 = NDSolve[{1*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, y[1] == 0},
    y[x], {x, 0, 1}];
yn2 = NDSolve[{.1*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, 
    y[1] == 0}, y[x], {x, 0, 1}];
yn3 = NDSolve[{.01*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, 
    y[1] == 0}, y[x], {x, 0, 1}];
yn4 = NDSolve[{.001*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, 
    y[1] == 0}, y[x], {x, 0, 1}];
Plot[{Evaluate[y[x] /. yn1], Evaluate[y[x] /. yn2], 
  Evaluate[y[x] /. yn3], Evaluate[y[x] /. yn4]}, {x, 0, 1}, 
 PlotRange -> {{0, 1}, {-.2, 1}}, 
 PlotStyle -> {Red, Blue, Green, Black}, AxesOrigin -> {0, 1} 
 ]

NDSolve::bvluc: The equations derived from the boundary conditions are numerically ill-conditioned. The boundary conditions may not be sufficient to uniquely define a solution. If a solution is computed, it may match the boundary conditions poorly. >>

NDSolve::berr: The scaled boundary value residual error of 1.0003677141389873` indicates that the boundary values are not satisfied to specified tolerances. Returning the best solution found. >>

The first-order test is adding Method → “StiffnessSwitching”. In this case it corrects the condition issue.

\[Lambda] = .62;
yn1 = NDSolve[{1*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, y[1] == 0},
    y[x], {x, 0, 1}, Method -> "StiffnessSwitching"];
yn2 = NDSolve[{.1*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, 
    y[1] == 0}, y[x], {x, 0, 1}, Method -> "StiffnessSwitching"];
yn3 = NDSolve[{.01*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, 
    y[1] == 0}, y[x], {x, 0, 1}, Method -> "StiffnessSwitching"];
yn4 = NDSolve[{.001*\[Lambda]*y''[x] - y[x] == 0., y[0] == 1, 
    y[1] == 0}, y[x], {x, 0, 1}, Method -> "StiffnessSwitching"];
Plot[{Evaluate[y[x] /. yn1], Evaluate[y[x] /. yn2], 
  Evaluate[y[x] /. yn3], Evaluate[y[x] /. yn4]}, {x, 0, 1}, 
 PlotRange -> {{0, 1}, {-.2, 1}}, 
 PlotStyle -> {Red, Blue, Green, Black}, AxesOrigin -> {0, 1}]

This is mentioned in the Details and Options section of NDSolve: Numerically solve a differential equation—Wolfram Documentation

and in StiffnessSwitching Method for NDSolve—Wolfram Documentation and

Stiffness Detection—Wolfram Documentation .

I think the “Details and Options” sections need to be renamed. Perhaps, “Important stuff you need to know”.

Hello:

Thanks a lot for the reply. I was away in military duties and recently returned. The usage of StiffnessSwitching helps. When I continue reducing lambda to around 0.58 suspicious results appear. Please share your comments on this. I am under the impression, as a novice, that NDSolve is reaching its limit in solving this problem.