9
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ I face the same issue on V11.0.1 for Microsoft Windows 7 (32-bit). $\endgroup$ – zhk Oct 16 '17 at 2:07
  • 1
    $\begingroup$ @bbgodfrey In version 9 it works. $\endgroup$ – halirutan Oct 16 '17 at 2:39
  • 1
    $\begingroup$ @bbgodfrey. I was and still am using V10.0.1 on a Mac. The code still works for me. $\endgroup$ – march Oct 16 '17 at 3:30
  • 2
    $\begingroup$ You can change a[t /; t <= 0] to a[0] and the same for x. The conditional notation does not seem to be necessary here. That said, I would report it. $\endgroup$ – Szabolcs Oct 16 '17 at 13:13
  • 1
    $\begingroup$ @Szabolcs Your solution works, even though the real problem I am trying to solve, a delay differential equation, throws the warning message NDSolveValue::ihist : Conditions given at Notebook$$17$150701t = 0 will be interpreted as initial history functions for Notebook$$17$150701t/;Notebook$$17$150701t<=0.` before giving the desired answer. I shall report the problem. Many thanks. $\endgroup$ – bbgodfrey Oct 16 '17 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.