Explicit Scheme, boundary conditions

The boundary conditions are $$ \begin{equation*} u(0,t)= a(t) \hspace{0.5cm} t \ge 0, \end{equation*} $$ and $$ \begin{equation*} u(L,t)= b(t) \hspace{0.5cm} t \ge 0, \end{equation*} $$ where \( a(t) \) and \( b(t) \) are two functions which depend on time only, while \( g(x) \) depends only on the position \( x \). Our next step is to find a numerical algorithm for solving this equation. Here we recur to our familiar equal-step methods and introduce different step lengths for the space-variable \( x \) and time \( t \) through the step length for \( x \) $$ \begin{equation*} \Delta x=\frac{1}{n+1} \end{equation*} $$ and the time step length \( \Delta t \). The position after \( i \) steps and time at time-step \( j \) are now given by $$ \begin{equation*} \begin{array}{cc} t_j=j\Delta t & j \ge 0 \\ x_i=i\Delta x & 0 \le i \le n+1\end{array} \end{equation*} $$