Bug introduced after 10.0, in 10.3 or earlier and persisting in 13.2.1
I'm fairly sure the following is a bug, and I would normally just report it to WRI. However, this is related to my answer to When using NDsolve, how to determine the positions of steady states? So I thought I would post it as a question, for two reasons. One is to let the community verify that it is in fact a bug. The other is to give a reference to the issue for the other question.
Here is a simplified example. With the WhenEvent
rule x[t] -> 1.
, NDSolve
fails to integrate the ODE and gives no message.
{sol} = NDSolve[
{x'[t] == -0.08 x[t], x[0] == 1.,
WhenEvent[Norm[{x'[t]}] < 0.0001, {x[t] -> 1.}]},
{x}, {t, 0, 200}]
One the other hand, using an empty action, the system is integrated:
{sol} = NDSolve[
{x'[t] == -0.08 x[t], x[0] == 1.,
WhenEvent[Norm[{x'[t]}] < 0.0001, {}]},
{x}, {t, 0, 200}]
Problem also seems connected to the use of the derivative x'[t]
in the event condition. It works fine with x[t]
.
Am I doing something wrong, or is it a bug?
[Mathematica 10.4.1, OSX 10.11.4.]
10.4.0 for Microsoft Windows (64-bit)
. Any deviation from your first example seems to work, e.g.WhenEvent[Norm[{x'[t]}] < 0.0001, {Print@t; x[t] -> 1.}]
, which indicates that the default step size and resolution is adequate to locate events. Seems like a bug to me. $\endgroup$Print@t
to any other expression also works (e.g. an empty list{}
). Pretty strange. $\endgroup$