Message Boards Message Boards

0
|
12486 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

NDSolve ODE variable should not go below zero

Posted 11 years ago
Hi, I have a set of ODEs that I've evaluated using NDSolve, none of the variables can go below zero and my x' is, how can I state this? 

sys = {x[0] == 0.0001, y[0] == .00000000000000000144, z[0] == 0,
    w[0] == 0, eq1, eq2, eq3, eq4} /. {p[1] -> 1.2, p[2] -> 1.19,
    p[3] -> .016, p[4] -> 19, p[5] -> .05};

sol = NDSolve[sys, {x[t], y[t], z[t], w[t]}, {t, 0, 200}]

 
I've tried WhenEvent and some variations of boundary conditions so far. When x = 0 I'd like it to stay at zero. 
Thanks for any help.
POSTED BY: Renee Dale
This is often harder to answer than it may seem at first. There can be numeric reasons why the WhenEvent isn't keeping your solution from crossing 0. WhenEvents can only detect that the equation has crossed 0. It doesn't predict that it will cross 0 and prevent this. 

Please see this post here which has more information about using WhenEvents to constrain the solution of a differential equation. It has some suggestions you might want to try. 

If the issue persists despite the suggestions, please try making a simple example of your problem, such as a simple differential equation with similar behavior to yours and post this.
POSTED BY: Sean Clarke
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