9

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.

bbgodfrey
  • 61,439
  • 17
  • 89
  • 156
  • 1
    I face the same issue on V11.0.1 for Microsoft Windows 7 (32-bit). – zhk Oct 16 '17 at 02:07
  • @March, your answer to question 99576 seems to have stopped working. What version of Mathematica were you using when you submitted that answer? Thanks. – bbgodfrey Oct 16 '17 at 02:23
  • 1
    @bbgodfrey In version 9 it works. – halirutan Oct 16 '17 at 02:39
  • 1
    @bbgodfrey. I was and still am using V10.0.1 on a Mac. The code still works for me. – march Oct 16 '17 at 03:30
  • 2
    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. – Szabolcs Oct 16 '17 at 13:13
  • 1
    @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. – bbgodfrey Oct 16 '17 at 14:02
  • Please use a more descriptive post title, that makes it clear what the issue is related to. – Jason B. Apr 14 '18 at 12:43
  • @JasonB. Is the new title along the lines of what you had in mind? – bbgodfrey Apr 14 '18 at 14:47
  • Perfect - that makes it much more likely a future user who has the same issue can find the question! – Jason B. Apr 14 '18 at 15:40

0 Answers0