Bug introduced in 9.0 and fixed in 11.0.0
WhenEvent
is new in 9.0.
This is an example from the docs, slightly modified (action is wrapped in { }
), working as expected.
NDSolve[{x'[t] == x[t], x[0] == 1,
WhenEvent[Mod[t, 1] == 0, {x[t] -> x[t] + (-1)^t}]}, x, {t, 0, 3}]
{{x -> InterpolatingFunction[{{0., 3.}}, <>]}}
When the action is deliberately removed (because for example the action is programmatically generated for a list of variables that can be empty), it crashes the kernel.
Warning: the following line might crash the kernel. Save your work.
NDSolve[{x'[t] == x[t], x[0] == 1,
WhenEvent[Mod[t, 1] == 0, {(*x[t] -> x[t] + (-1)^t*)}]}, x, {t, 0, 3}]
Can anyone reproduce this?
(Mathematica 10.4.0 for Microsoft Windows (Win7, 64-bit))