Message Boards Message Boards

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. >>
POSTED BY: Marcolino R-M
3 Replies

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

POSTED BY: Frank Kampas

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 http://reference.wolfram.com/language/ref/NDSolve.html
and in http://reference.wolfram.com/language/tutorial/NDSolveStiffnessSwitching.html and
http://reference.wolfram.com/language/tutorial/NDSolveStiffnessTest.html .

POSTED BY: Bruce Miller

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.

POSTED BY: Marcolino R-M
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract