I want to solve the following PDE on $[0,T]\times \mathbb R$ using an explicit finite-difference scheme
$$-\partial_t u(t,x) - \frac 1 2 \sup_{a\in [1,2]} a^2 \partial_x^2 u(t,x) = 0,$$ where $u(T,x) = 1_{[0,\infty)}(x)$, $\lim_{x\to \infty} u(t,x) = 1$ and $\lim_{x\to -\infty} u(t,x) = 0$.
I came up with the following scheme
$$-\frac{U(i,j) - U(i-1,j)}{\Delta t} - \frac 1 2 \max_{i=0}^{n_a} a_i^2 \frac{U(i,j+1) - 2U(i,j) + U(i,j-1)}{\Delta x^2} = 0$$
where $U(i,j) = u(i\Delta t, j\Delta x)$ and $a_i = 1 + i/n_a$.
But there are some things that don't make sense
how do I use the boundary conditions correctly? I can iterate backwards or forward in $j$, but each time I can only use one of the latter two boundary conditions.
how can this be made explicit? $U(i,j)$ appears in the maximum when I try to compute $U(i,j)$. I think I solved this: just solve for $U(i-1,j)$.