Plot solutions of ODE with discontinuous source

43 Views Asked by At

Consider the ODE $$ \begin{cases} \partial_t \Phi(t,x) = H(\Phi(t,x)), & t>0, x \in \mathbb{R} \\ \Phi(0,x) = x, & x \in \mathbb R, \end{cases} $$ where $H$ is the heaviside function. How can I compute the solution $\Phi$ and how can I plot it using Mathematica?

1

There are 1 best solutions below

0
On

Start with a simplification of the problem: make $x$ a discrete variable with a finite domain. For example: $x \in \{-1, 0, 1, 2\}$.

Then for each $t$, the function $\Phi(t, x)$ becomes a vector with coordinates indexed by $x$: $$ \phi(t) = \left( \phi_{-1}(t), \; \phi_{0}(t), \; \phi_{1}(t), \; \phi_{2}(t) \right) $$ Now your ODE can be considered for each coordinate. For example, for $x = -1$ we have: $$ \begin{array}{lll} \dot{\phi}_{-1}(t) & = & H( \phi_{-1}(t) ),\\ \phi_{-1}(0) & = & -1. \end{array} $$ Thus, $$ \dot{\phi}_{-1}(0) = H( -1) = 0. $$

And so on.