How can I use Mathematica to plot the flow of the following ODE in $\mathbb R$? $$\frac{d}{dt} X(t,x) = \chi_{\{x>0\}}(X(t,x)), t \in [0,T],$$ $X(0,x) = x, x \in \mathbb R$

where $\chi$ denotes the indicator function of a set.

I know about the command NDSolve, but is it applicable in this situation given the discontinuity in the source term? And I'd be mostly interested in rendering a nice picture of the flow.

Note that a related question was posed on MathOverflow.


1 Answer 1

T = 1;
Y = ParametricNDSolveValue[{X'[t] == Boole[X[t] > 0], X[0] == x}, X, {t, 0, T}, {x}];
  ParametricPlot[{Y[x][t], t}, {t, 0, T}],
  {x, -1, 1, 0.1}
 PlotRange -> All,
 AxesLabel -> {"x", "t"}

enter image description here

  • $\begingroup$ Incidentally, this is why I like Iverson brackets more than indicator functions; I find the latter more confusing to parse in general, whereas the Boole[] expression is concise and clear. $\endgroup$ Nov 29, 2019 at 22:08
  • $\begingroup$ Thank you very much. This looks very nice. It seems that there may be a nonuniqueness problem for trajectories starting at $x=0$. How does one identify in this picture the unique flow in the sense of DiPerna-Lions (php.math.unifi.it/users/cime/Courses/2005/02/…)? $\endgroup$
    – Riku
    Nov 30, 2019 at 12:37
  • $\begingroup$ No, there is no nonuniqueness problem in thi case: For initial condition x>0, the right branch is taken and the left one for z <= 0. $\endgroup$ Nov 30, 2019 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.