*6.1. One Dimensional Case*

For the numerical experiment, we consider the mixed problem

$$\begin{cases} \frac{\partial^2 u(t, \mathbf{x})}{\partial t^2} - \frac{\partial^2 u(t, \mathbf{x})}{\partial x^2} = 2e^{-t} \sin \mathbf{x} + \cos \left( u \left( t, \mathbf{x} \right) u \left( t - \mathbf{1}, \mathbf{x} \right) \right) \\\\ - \cos \left( e^{-t} \sin \mathbf{x} \left( t - \mathbf{1}, \mathbf{x} \right) \right), 0 < t < \infty, \ 0 < \mathbf{x} < 2\pi, \\\\ u \left( t, \mathbf{x} \right) = e^{-t} \sin \mathbf{x}, \ 0 \le \mathbf{x} \le 2\pi, \ -1 \le t \le 0, \\\\ u \left( t, 0 \right) = u \left( t, 2\pi \right), \ u\_x \left( t, 0 \right) = u\_x \left( t, 2\pi \right), \ t \ge 0 \end{cases} \tag{51}$$

for the semilinear delay one dimensional hyperbolic differential equation with nonlocal boundary conditions. The exact solution of problem (51) is *u* (*t*, *x*) = *e*−*<sup>t</sup>* sin *x*. We will consider the following iterative difference scheme of first order of approximation in *t* for the numerical solution of problem (51)

$$\begin{cases} \begin{aligned} & \frac{jk\_n^{k+1} - 2\left(j\_n^k \right) + j\_n^{k-1}}{\Gamma^2} - \frac{jk\_{n+1}^{k+1} - 2\left(j\_n^{k+1} \right) + j\_n^{k+1}}{\hbar^2} = 2e^{-t\_k}\sin x\_n \\ & + \cos\left(\left(j\_{-1}u\_n^k\right)u\_n^{k-N}\right) - \cos\left(e^{-t\_k}\sin x\_n \left(u\_n^{k-N}\right)\right), \\ & t\_k = k\pi, \ x\_n = nh, \ 1 \le k < \infty, \ 1 \le n \le M-1, \ N\pi = 1, \ Mh = 2\pi, \\\\ & \frac{j\_n^{k+1} - j\_n^k}{\Gamma} - \frac{\pi}{\hbar^2} \left(j\_n^{k+1} - j\_n^k u\_{n+1}^k - 2\left(j\_n^{k+1} - j\_n^k\right) + j\_n^{k+1} - j\_n u\_{n-1}^k\right) \\ & = \frac{j\_n^k - j\_n^{k-1}}{\Gamma}, \ k = mN + 1, m = 0, 1, \ldots, k \ge 1, \\\\ & u\_n^k = e^{-t\_k}\sin x\_n, \ k\_k = k\pi, \ x\_n = nh, \ 0 \le n \le M, \ -N \le k \le 0, \\\\ & j\_0^k = j\_n^k, \ j\_1^k - j\_1 u\_0^k = j\_n u\_{M-1}^k, \ 0 \le k < \infty, \ j = 1, 2, \ldots \end{aligned} \tag{52}$$

for the semilinear delay hyperbolic equation. Here and in future *j* denotes the iteration index and an initial guess <sup>0</sup>*u<sup>k</sup> <sup>n</sup>*, *k* ≥ 1, 0 ≤ *n* ≤ *M* is to be made.

For solving difference scheme (52), the numerical steps are given below. For 0 ≤ *k* < *N*, 0 ≤ *n* ≤ *M* the algorithm is as follows :


We write (52) in matrix form

$$A\left(\cdot\mu^{k+1}\right) + B\left(\cdot\mu^{k}\right) + C\left(\cdot\mu^{k-1}\right) = R\rho\left(\cdot\mu^{k}, \cdot\mu^{k-N}\right), \ 1 \le k < \infty,$$

$$u^{k} = \left\{e^{-t\_{k}}\sin x\_{n}\right\}\_{n=0}^{M} \quad -N \le k \le 0,\tag{53}$$

$$\dots \dots$$

$$\begin{split} \frac{u^{\underline{u}^{k+1}-\underline{\boldsymbol{u}}^{k}}}{\tau} - \left\{ \frac{\tau}{\mathbb{R}^{2}} \left( {}\_{j}^{\boldsymbol{u}} {u^{k+1}\_{n+1}} - {}\_{j}^{\boldsymbol{u}} {}\_{n+1} - 2 \left( {}\_{j}^{\boldsymbol{u}} {u^{k+1}\_{n}} - {}\_{j}^{\boldsymbol{u}} {}\_{n} \right) + {}\_{j}^{\boldsymbol{u}} {}\_{n-1} - {}\_{j}^{\boldsymbol{u}} {}\_{n-1} \right) \right\}\_{n=1}^{M-1} \\ = \frac{{\boldsymbol{u}^{k}-\boldsymbol{u}^{k-1}}}{\tau}, \; k = m\boldsymbol{N}+1, k \ge 1. \end{split} \tag{54}$$

Here *R*, *A*, *B*, and *C* are (*M* + 1) × (*M* + 1) matrices given below:

$$R = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & \dots & 0 & 0\\ 0 & 1 & 0 & 0 & 0 & \dots & 0 & 0\\ 0 & 0 & 1 & 0 & 0 & \dots & 0 & 0\\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots\\ 0 & 0 & 0 & 0 & 0 & \dots & 1 & 0\\ 0 & 0 & 0 & 0 & 0 & \dots & 0 & 1 \end{bmatrix}'$$

$$A = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & \cdot & 0 & -1 \\ a & b & a & 0 & 0 & \cdot & 0 & 0 \\ 0 & a & b & a & 0 & \cdot & 0 & 0 \\ 0 & 0 & a & b & a & \cdot & 0 & 0 \\ 0 & 0 & 0 & a & b & \cdot & 0 & 0 \\ \cdot & \cdot & \cdot & \cdot & \cdot & \cdot & \cdot \\ 0 & 0 & 0 & 0 & 0 & \cdot & b & a \\ 1 & -1 & 0 & 0 & 0 & \cdot & -1 & 1 \end{bmatrix},$$

$$B = \begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & c & 0 & 0 & 0 & \cdot & 0 & 0 \\ 0 & 0 & c & 0 & 0 & \cdot & 0 & 0 \\ 0 & 0 & 0 & c & 0 & \cdot & 0 & 0 \\ \cdot & \cdot & \cdot & \cdot & \cdot & \cdot & \cdot \\ 0 & 0 & 0 & 0 & 0 & \cdot & 0 \\ 0 & 0 & 0 & 0 & 0 & \cdot & 0 \\ 0 & 0 & 0 & 0 & 0 & \cdot & 0 \end{bmatrix},$$

$$C = \begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & d & 0 & 0 & 0 & \cdot & 0 & 0 \\ 0 & 0 & d & 0 & 0 & \cdot & 0 & 0 \\ 0 & 0 & 0 & d & 0 & \cdot & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \cdot & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \cdot & 0 & 0 \\ \end{bmatrix},$$

,

where

$$a = -\frac{1}{h^2}, \; b = \frac{1}{\pi^2} + \frac{2}{h^2}, \; c = -\frac{2}{\pi^2}, \; d = \frac{1}{\pi^2}.$$

Finally, here *<sup>ϕ</sup>*(*j*−1*uk*, *<sup>u</sup>k*−*N*) and *ju<sup>s</sup>* , *s* = *k*, *k* ± 1 are (*M* + 1) × 1 column vectors as

$$\begin{aligned} \,^j\boldsymbol{\varrho}(\_{j-1}\boldsymbol{u}^k, \boldsymbol{u}^{k-N}) &= \begin{bmatrix} 0\\ \,^j\boldsymbol{\varrho}\_1^k \\\end{bmatrix}, \, \, ^j\boldsymbol{\mu}^s = \begin{bmatrix} \,^j\boldsymbol{u}\_0^s\\\,^j\boldsymbol{u}\_1^s\\\,\cdot\\\,0 \end{bmatrix}, \\\ ^k\boldsymbol{\varrho} &= 2e^{-t\_k}\sin x\_n + \cos\left( \left( \,\_{j-1}\boldsymbol{u}\_n^k \right) (\boldsymbol{u}\_n^{k-N}) \right) - \cos\left( e^{-t\_k}\sin x\_n \boldsymbol{u}\_n^{k-N} \right) \end{aligned}$$

*jϕk* for 1 ≤ *k* ≤ *N* − 1, 1 ≤ *n* ≤ *M* − 1.

So, we have the initial value problem for the second order difference equation with respect to *k* with matrix coefficients. From Equations (53) and (54) it follows that

$$\begin{aligned} \, \_j\mu^{k+1} &= -A^{-1} \left( B\_j \mu^k - \mathbb{C}\_j \mu^{k-1} + A^{-1} R \varphi^k (\! \_{j-1} \mu^k \! \_t \mu^{k-N}) \right), \\\\ \_j\mu^k &= \left\{ \epsilon^{-t\_k} \sin \text{x}\_n \right\}\_{n=0}^M \; \_0 - N \le k \le 0, \end{aligned}$$

$$\, \_j\mu^{k+1} = \psi \left( \mu^k , \mu^{k-1} \right), \; k = mN+1, m = 0, 1, \ldots, k \ge 1. \tag{55}$$

Here, *ψ uk*, *uk*−<sup>1</sup> is (*M* + 1) × 1 column vector defined by formula (54).

In computations the initial guess is chosen as <sup>0</sup>*u<sup>k</sup>* <sup>=</sup> {sin *xn*}*<sup>M</sup> <sup>n</sup>*=<sup>0</sup> and when the maximum errors between two consecutive results of iterative difference scheme (52) become less than 10<sup>−</sup>8, the iterative process is terminated. We present numerical experimental results for different values of *N* and *M* and *u<sup>k</sup> <sup>n</sup>* represent the numerical solutions of difference scheme (52) at (*tk*, *xn*). The table of numerical results is constructed for *N* = *M* = 30, 60, 120 in *t* ∈ [0, 1] , *t* ∈ [1, 2] , *t* ∈ [2, 3], respectively and the errors are computed by the following formula

$$mE\_M^N = \max\_{mN+1 \le k \le (m+1)N, 0 \le n \le M} \left| \mu \left( t\_{k\prime} \mathbf{x}\_n \right) -\_j \boldsymbol{u}\_n^k \right|.$$

As can be seen from tables, these numerical experiments support the theoretical statements. The number of iterations and maximum errors are decreasing with the increase of grid points.

In Table 1, as we increase values of *M* and *N* each time starting from *M* = *N* = 30 by a factor of 2 the errors in the first order of accuracy difference scheme decrease approximately by a factor of 1/2. The errors presented in Table 1 indicate the first order of accuracy of the difference scheme.


**Table 1.** The errors (52) (Number of the iteration = *j*).
