Bug introduced between versions 10.1 and 10.4, and resolved in 11.3.
Using either 11.2 or 10.4 on Windows 10 (64 bit), I am unable to reproduce the answer by March to question 99576. Specifically,
timeLimit = 10;
z[t_] = Piecewise[{{1, t <= 2}, {3/2, 2 < t <= 5}}, 2];
NDSolve[{x'[t] == 1/1.5 t, WhenEvent[x[t] == z[t], a[t] -> t],
WhenEvent[t == a[t] + 1, {x[t] -> 0, a[t] -> 0}],
a[t /; t <= 0] == timeLimit, x[t /; t <= 0] == 0},
{x[t], a[t]}, {t, 0, timeLimit}, DiscreteVariables -> {a}];
NDSolve::overdet: There are fewer dependent variables, {x[t],a[t]}, than equations, so the system is overdetermined. >>
Is this a bug? Is there a work-around?
Work-Around
Szabolcs provides a work-around in a comment below, "change a[t /; t <= 0]
to a[0]
and the same for x
". It also works for the problem I originally set out to solve, a delay differential equation, but only because my initial conditions for t <= 0
are constant. Even then, Mathematica 11.2 returns the warning message
NDSolve::ihist : Conditions given at t = 0 will be interpreted as initial history functions for t /; t <= 0.
before returning the correct answer.
Addendum: "11.3.0 for Microsoft Windows (64-bit) (March 7, 2018)" gives the correct answer without error or warning messages.
V11.0.1 for Microsoft Windows 7 (32-bit)
. $\endgroup$a[t /; t <= 0]
toa[0]
and the same forx
. The conditional notation does not seem to be necessary here. That said, I would report it. $\endgroup$NDSolveValue::ihist : Conditions given at Notebook$$17$150701
t = 0 will be interpreted as initial history functions for Notebook$$17$150701t/;Notebook$$17$150701
t<=0.` before giving the desired answer. I shall report the problem. Many thanks. $\endgroup$