Group Abstract Group Abstract

Message Boards Message Boards

0
|
11.8K Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Runge-Kutta Method, stiffness occur, how to solve it?

Posted 11 years ago
POSTED BY: Thai Kee Gan
6 Replies
Posted 11 years ago
POSTED BY: Thai Kee Gan
Posted 11 years ago
POSTED BY: Thai Kee Gan

Your function has a square root term of negative value:

In[182]:= Clear["Global`*"]

In[183]:= Simplify[
 y[x]^3 (1 - y[x]) x^2 - (1 - y[x])^3 x^2 + 3/8 y[x] (1/2 y[x]^(-1/2))]

Out[183]= 
x^2 (-1 + y[x])^3 + (3 Sqrt[y[x]])/16 - x^2 (-1 + y[x]) y[x]^3

In[184]:= s = 
 NDSolve[{y'[x] == 
    x^2 (-1 + y[x])^3 + (3 Sqrt[Abs[y[x]]])/16 - 
     x^2 (-1 + y[x]) y[x]^3, y[0] == 0}, y, {x, 0.000, 1}, 
  Method -> Automatic]

Out[184]= {{y -> InterpolatingFunction[{{0., 1.}}, <>]}}

It works if I take absolute value underneath the square root. I also used Automatic as the integration method.

POSTED BY: Kay Herbert
Posted 11 years ago

Hello guys, thanks for the replies. My equation is:

NDSolve[{y'[x] == 
   y[x]^3 (1 - y[x]) x^2 - (1 - y[x])^3  x^2 + 
    3/8 y[x] (1/2 y[x]^(-1/2)), y[0] == 0.`}, y, {x, 0, 1`}, 
 Method -> "ExplicitRungeKutta", "StartingStepSize" -> 1/1000]

Is there any mistake on how I load the Runge-Kutta Package? Or is there any mistake in the equation?

POSTED BY: Thai Kee Gan

May I make explicit a point which was implicit already in David's answer: The 'normal' way to obtain numerical solutions for ODEs from Mathematica is to call NDSolve and leave it to the system to find out among the many built-in methods and merthod variants the one which seems to be most suited for your equation. Since it definitively has methods which are designed to cope with stiff equations it should come up with a reliable solution whenever it exists mathematically. Of course, it can only make you learn and understand if you compare the behavior of standard methods for cases in which some of them get into trouble. Unfortunately the documentation on the 'Method' option of NDSolve is poor, so that some experimentation is needed to see which methods are implemented.

POSTED BY: Ulrich Mutze

Could you include the system of equations you are trying to solve? In some recent work, I have had 'stiffness' warning messages from NDSolve for certain sets of input parameters when the same set of equations solve perfectly well under different initial conditions.

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