I was considering the following piece of code
u[y_, z_] = 36*y*(1 - y)*z*(1 - z);
sys = {x'[t] == u[y[t], z[t]], y'[t] == 0, z'[t] == -2.2*^-3,
x[0] == 0, y[0] == y0, z[0] == z0,
WhenEvent[x[t] > 500, "StopIntegration"]};
sol = Table[
NDSolve[sys, {x, y, z}, {t, 0, 500}], {y0, 0.1, 0.9, 0.1}, {z0,
0.1, 0.9, 0.1}];
ParametricPlot3D[{x[t], y[t], z[t]} /. sol, {t, 0, 500},
PlotRange -> {{0, 1000}, {0, 1}, {0, 1}}, ImageSize -> 500,
BoxRatios -> {5, 1, 1}]
However, it does not seem that WhenEvent captures correctly the event x>500, indeed Mathematica does not stop integration. I've also tried with "==" but I have the same problem.
What is wrong?
Thanks!
t
from0
to500
even for the solutions that stop at some earlier time. Try looking at just the solution for{y0 -> 0.5 , z0 -> 0.9}
and dox["Domain"]/.sol
to get the domain of the function. Also, you can replace"StopIntegration"
withPrint[{y0, z0, t}]; "StopIntegration"
to make Mathematica spit out the times at which it stops and for which parameters. $\endgroup$Plot
(et al) suppress the warnings about extrapolation of theInterploatingFunction
. Is there a way to disable that (ie. show the warnings )? $\endgroup$