**Algorithm 1** Numerical algorithm for solving the direct TVIDE problem via FIM-SCP

**Input:** *x*, *τ*, *L*, *T*, *N*, *φ*(*x*), *ψr*(*t*), *pi*(*x*, *t*), *κ*1(*x*, *t*), *κ*2(*x*, *t*), and *F*(*x*, *t*). **Output:** An approximate solution *u*(*x*, *T*). 1: Set *xk* = *<sup>L</sup>* 2 - cos - <sup>2</sup>*k*−<sup>1</sup> <sup>2</sup>*<sup>N</sup> <sup>π</sup>* + 1 for *k* ∈ {1, 2, 3, ..., *N*} in descending order. 2: Compute **A**, **B**, **S**, **S**¯, **S**<sup>−</sup>1, **X***n*, and **u**0. 3: Set *m* = 1 and *t*<sup>1</sup> = *τ*. 4: **while** *tm* ≤ *T* **do** 5: Compute **K***m* <sup>1</sup> , **<sup>K</sup>***m* <sup>2</sup> , **<sup>F</sup>***m*, **<sup>H</sup>***m*, **<sup>Ψ</sup>***m*, and **<sup>E</sup>***m* <sup>1</sup> . 6: Find **u***m* by solving the linear system (18). 7: Update *m* = *m* + 1. 8: Compute *tm* = *mτ*. 9: **end while**

10: **return** Find *u*(*x*, *T*) = **s**(*x*)**S**−1**u***m*.

**Algorithm 2** Numerical algorithm for solving the inverse TVIDE problem via FIM-SCP

**Input:** *x*, *p*, *τ*, *δ*, *L*, *T*, *N*, *λ*0, *φ*(*x*), *g*(*t*), *ψr*(*t*), *pi*(*x*, *t*), *κ*1(*x*, *t*), *κ*2(*x*, *t*), and *f*(*x*, *t*).

**Output:** An approximate solution *u*(*x*, *T*) and the source terms *β*(*tm*) at all discretized times.

1: Set *xk* = *<sup>L</sup>* 2 - cos - <sup>2</sup>*k*−<sup>1</sup> <sup>2</sup>*<sup>N</sup> <sup>π</sup>* + 1 for *k* ∈ {1, 2, 3, ..., *N*} in descending order.

2: Compute **A**, **B**, **S**, **S**¯, **S**<sup>−</sup>1, **X***n*, **A***N*, and **u**0.

```
3: Set m = 1 and t1 = τ.
```

```
4: while tm ≤ T do
```

```
5: Set the measurement data g(tm) = g(tm) + , where  ∼ N (0, p2|g(tm)|
                                                                        2).
```

```
9: Compute yλn = (RR + λnI)−1Rb.
```

```
10: Compute ∇yλn = −(RR + λnI)−1yλn .
```

```
13: Compute λn+1 = λn − G(λn)
                           G(λn).
```

```
14: Update n = n + 1.
```

```
19: Compute tm = mτ.
```
20: **end while**

```
21: return Find u(x, T) = s(x)S−1um.
```
### **4. Numerical Experiments**

In this section, we implement our devised numerical algorithms for solving the direct and inverse TVIDE problems through several examples, in order to demonstrate the efficiency and accuracy of the solutions obtained by proposed methods. Examples 1 and 2 are used to examine Algorithm 1 for the direct TVIDE problems (8). Examples 3 and 4 are inverse TVIDE problems (19), as solved by Algorithm 2. Additionally, time convergence rates and CPU times(s) for each example are presented to indicate the computational cost and time. The time convergence rate is defined by Rate <sup>=</sup> lim*tm*→*<sup>T</sup>* **<sup>u</sup>**∗(*tm*+1)−**u**(*tm*+1)<sup>∞</sup> **<sup>u</sup>**∗(*tm*)−**u**(*tm*)<sup>∞</sup> , where *<sup>T</sup>* is the terminal time, *tm* is a partitioned time contained in [0, *T*], **u**∗(*tm*) is the exact solution at time *tm*, **u**(*tm*) is the numerical solution at time *tm*, and ·<sup>∞</sup> is the *l* <sup>∞</sup> norm. Graphical solutions of each example are also depicted. Our numerical algorithms were implemented using the MatLab R2016a software, run on a Intel(R) Core(TM) i7-6700 CPU @ 3.40 GHz computer system.

**Example 1.** *Consider the following direct TVIDE problem, which consists of a second-order derivative with constant coefficient for x* ∈ (0, 1) *and t* ∈ (0, *T*]*:*

$$u\mu + u\_{\rm XX} + u = \int\_0^t 2e^{-\mathbf{x}} u(\mathbf{x}, \eta) d\eta + \int\_0^\mathbf{x} (\xi + t) u(\xi, t) d\xi + F(\mathbf{x}, t), \tag{27}$$

*where*

$$F(\mathbf{x}, t) = -t - \boldsymbol{\varepsilon}^x (t^2 - 3t + t\mathbf{x} - 1),$$

*subject to the homogeneous initial condition u*(*x*, 0) = 0 *for x* ∈ [0, 1] *and the Dirichlet boundary conditions <sup>u</sup>*(0, *<sup>t</sup>*) = *t and u*(1, *<sup>t</sup>*) = *te for t* ∈ [0, *<sup>T</sup>*]*. The analytical solution of this problem is u*∗(*x*, *<sup>t</sup>*) = *tex.*

In the numerical testing based on Algorithm 1, we first took the double-layer integral of both sides of (27) and transformed it into matrix form (16). Then, we obtained the approximate solutions *u*(*x*, *T*) for this problem (27) by applying the numerical Algorithm 1. The accuracy of our obtained approximate results was measured by the mean absolute error, which compared it to the analytical solution at different values of *x* ∈ {0.1, 0.3, 0.5, 0.7, 0.9} and the terminal time *T* = 1, as shown in Table 1. From Table 1, we observe that, when the partitioning number of the temporal domain *M* was fixed and nodal numbers *N* were increasingly varied, then the accuracy was significantly improved. Similarly, for a fixed nodal number *N* but various time partitioning numbers *M*, the accuracy results were also significantly improved. Moreover, the convergence rates with respect to the time in Algorithm 1 were estimated for various numbers of the time partition (*M* ∈ {5, 10, 15, 20, 25}) for the spatial points *N* = 10, as shown in Table 2. We can notice, from Table 2, that these time convergence rates for the -∞ norm indeed approached linear convergence for *T* ∈ {5, 10, 15}. The computational cost, in terms of CPU times (s), is also displayed in Table 2. Finally, a graph of our approximate solutions *u*(*x*, *t*) for different times *t* and the surface plot of the solution under the parameters *N* = 20, *M* = 20, and *T* = 1 are depicted in Figure 1.

**Table 1.** Mean absolute errors between exact and numerical solutions of *u*(*x*, 1) for Example 1.



**Table 2.** Time convergence rates and CPU times (s) for Example 1 by Algorithm 1 with *N* = 10.

**Figure 1.** The graphical results of Example 1 for *N* = 20, *M* = 20, and *T* = 1.

**Example 2.** *Consider the following direct TVIDE problem, which consists of a third-order derivative with variable coefficient for x* ∈ (0, 1) *and t* ∈ (0, *T*]*:*

$$u\_t + tu\_{xxx} + \cos(\mathbf{x})u\_{xx} = \int\_0^t \frac{2}{\mathbf{x} - 1} u(\mathbf{x}, \eta) d\eta + \int\_0^\mathbf{x} \frac{6t}{\mathfrak{J} - 1} u(\mathbf{\bar{\zeta}}, t) d\mathfrak{J} + F(\mathbf{x}, t), \tag{28}$$

*where*

$$F(\mathbf{x},t) = \mathbf{x} - \mathbf{x}^2 + \mathbf{x}t^2(3\mathbf{x} + 1) - 2t\cos(\mathbf{x})\_\prime$$

*subject to the initial condition u*(*x*, 0) = 0 *for x* ∈ [0, 1] *and the boundary conditions u*(0, *t*) = 0*, u*(1, *t*) = 0*, and u* (0, *<sup>t</sup>*) = *t for t* ∈ [0, *<sup>T</sup>*]*. The analytical solution of this problem is u*∗(*x*, *<sup>t</sup>*)=(*<sup>x</sup>* − *<sup>x</sup>*2)*t.*

We test the efficiency and accuracy of the proposed Algorithm 1 via the problem (28). First, we took a triple-layer integral on both sides of (28) and utilized the shifted Chebyshev integration matrix to transform it into matrix form (16). Next, we implemented Algorithm 1 to obtain numerical solutions *u*(*x*, *T*) for this problem (28). Table 3 shows the precision of our obtained approximate results at different values of *x* ∈ {0.1, 0.3, 0.5, 0.7, 0.9} and at the terminal time *T* = 1, through the mean absolute error. We can see that the accuracy was significantly improved according to an increase in the number of both the partitioning space and time domains. However, we observe that, in the case of fixed *N*, when *M* was increased, the mean absolute errors provide accurate results with a lower computational number *M*. Furthermore, the time convergence rates concerning the -<sup>∞</sup> norm and CPU times (s) are demonstrated in Table 4, under various values of *M* (*M* ∈ {5, 10, 15, 20, 25}) and final times *T* (*T* ∈ {5, 10, 15}). The graphical solutions for *u*(*x*, *t*) in both one and two dimensions are shown in Figure 2.


**Table 3.** Mean absolute errors between exact and numerical solutions of *u*(*x*, 1) for Example 2.

**Table 4.** Time convergence rates and CPU times (s) for Example 2 by Algorithm 1 with *N* = 10.


**Figure 2.** The graphical results of Example 2 for *N* = 20, *M* = 20, and *T* = 1.

**Example 3.** *Consider the following inverse TVIDE problem, which consists of a second-order derivative with constant coefficient and a continuous forcing function f*(*x*, *t*) *for x* ∈ (0, 1) *and t* ∈ (0, *T*]*:*

$$u\_t - u\_{xx} + 2u = \int\_0^t 2\ln(\mathbf{x}) u(\mathbf{x}, \eta) d\eta + \int\_0^\mathbf{x} e^{-\frac{\mathbf{x}}{\eta}} u(\xi, t) d\xi + \beta(t) f(\mathbf{x}, t), \tag{29}$$

*where*

$$f(\mathbf{x}, t) = \varepsilon^{2t} \left[ 1 + t - \mathbf{x} + \varepsilon^{\mathbf{x}} + t\varepsilon^{-\mathbf{x}} - (2\varepsilon^{\mathbf{x}} + t)t \ln \mathbf{x} \right], \mathbf{y}$$

*subject to the initial condition <sup>u</sup>*(*x*, 0) = *<sup>e</sup><sup>x</sup> for <sup>x</sup>* ∈ [0, 1] *and the boundary conditions <sup>u</sup>*(0, *<sup>t</sup>*) = *<sup>t</sup>* + <sup>1</sup> *and u*(1, *t*) = *t* + *e for t* ∈ [0, *T*]*. The additional condition, in terms of the aggregated solution of the system, is <sup>g</sup>*(*t*) = *<sup>t</sup>* + *<sup>e</sup>* − <sup>1</sup>*. The analytical solutions of this problem are u*∗(*x*, *<sup>t</sup>*) = *<sup>t</sup>* + *<sup>e</sup><sup>x</sup> and <sup>β</sup>*∗(*t*) = *<sup>e</sup>*−2*<sup>t</sup> .*

Implementing the numerical Algorithm 2 by taking the double-layer integral of both sides of (29) and transforming it into matrix form (24), we obtained the approximate solutions *u*(*x*, 1) and *β*(*t*) for this problem (29). As the additional condition was measurement data, there may be an error in the measurement. Therefore, we perturbed the additional condition *g*(*t*) with a percentage *p* of the noise (*p* ∈ {0%, 1%, 3%, 5%}). In Table 5, we show the accuracy of the solutions *u*(*x*, 1) and *β*(*t*), in terms of the mean absolute error, respectively, denoted by <sup>E</sup>*<sup>u</sup>* <sup>=</sup> <sup>1</sup> *<sup>N</sup>* <sup>∑</sup>*<sup>N</sup> <sup>i</sup>*=<sup>1</sup> |*u*<sup>∗</sup> *<sup>i</sup>* <sup>−</sup> *ui*<sup>|</sup> and <sup>E</sup>*<sup>β</sup>* <sup>=</sup> <sup>1</sup> *<sup>M</sup>* <sup>∑</sup>*<sup>M</sup> <sup>j</sup>*=<sup>1</sup> |*β*<sup>∗</sup> *<sup>j</sup>* − *βj*|, and the values of the optimal regularization parameters *λ* at time *t* = 1 with various *M* = *N* ∈

{5, 10, 15, 20}. From Table 5, we can observe that the optimal regularization parameters *λ* were close to zero and the mean absolute errors for both E*<sup>u</sup>* and E*<sup>β</sup>* significantly increased with an increasing percentage *p* of the perturbation. Furthermore, we used the regularization parameter *λ* = 0 to explore the rates of convergence with respect to the -<sup>∞</sup> norm and CPU times (s) for *<sup>M</sup>* <sup>=</sup> *<sup>N</sup>* ∈ {5, 10, 15, 20} with the final times *T* ∈ {1, 2, 3} as shown in Table 6. The graphical solutions of the perturbed functions *u*(*x*, 1) and *β*(*t*) for *p* ∈ {1%, 3%, 5%} are depicted in Figure 3.


**Table 5.** Mean absolute errors of *u*(*x*, 1) and *β*(*t*) for optimal regularization parameter *λ* of Example 3.

**Table 6.** Time convergence rates and CPU times (s) for Example 3 by Algorithm 2 with *N* = 10.


**Figure 3.** The graphical results of *u*(*x*, 1) and *β*(*t*) for Example 3 with *N* = 30 and *M* = 20.

**Example 4.** *Consider the following inverse TVIDE problem, which consists of a second-order derivative with variable coefficient and the piecewise forcing function f*(*x*, *t*) *for x* ∈ (0, 1) *and t* ∈ (0, *T*]*:*

$$u\_t + u\_{xx} + u\_x - \cos(\mathbf{x}t)u = \int\_0^t 2\sin(\mathbf{x})u(\mathbf{x}, \eta)d\eta - \int\_0^\mathbf{x} 3t\cos(\boldsymbol{\xi})u(\boldsymbol{\xi}, t)d\boldsymbol{\xi} + \beta(t)f(\mathbf{x}, t), \tag{30}$$

*where*

$$f(x,t) = \begin{cases} \frac{1}{2} \left[ 2t\cos(2x) + t\sin(2x) + (t\cos(xt) + 1)\sin^2 x \right], & 0 < t \le \frac{T}{3}, \\\frac{1}{3} \left[ 2t\cos(2x) + t\sin(2x) + (t\cos(xt) + 1)\sin^2 x \right], & \frac{T}{3} < t \le \frac{2T}{3}, \\\frac{1}{4} \left[ 2t\cos(2x) + t\sin(2x) + (t\cos(xt) + 1)\sin^2 x \right], & \frac{2T}{3} < t \le T, \end{cases}$$

*subject to the initial condition u*(*x*, 0) = 0 *for x* ∈ [0, 1] *and the Dirichlet boundary conditions u*(0, *t*) = 0 *and <sup>u</sup>*(1, *<sup>t</sup>*) = *<sup>t</sup>* sin2(1) *for <sup>t</sup>* <sup>∈</sup> [0, *<sup>T</sup>*]*. The additional condition, in terms of the aggregated solution of the system, is g*(*t*) = *<sup>t</sup>* <sup>4</sup> (<sup>2</sup> − *sin*(2)) + *<sup>e</sup><sup>t</sup> . The analytical solutions of this problem are u*∗(*x*, *t*) = *t* sin2(*x*) *and*

$$\beta^\*(t) = \begin{cases} 2, & 0 < t \le \frac{T}{3}, \\ 3, & \frac{T}{3} < t \le \frac{2T}{3}, \\ 4, & \frac{2T}{3} < t \le T. \end{cases}$$

Based on the numerical Algorithm 2, we took the double-layer integral to both sides of (30) and transformed it into matrix form (24). We obtained the approximate solutions *u*(*x*, 1) and *β*(*t*) for (29) by implementing Algorithm 2. Table 7 shows the accuracy of the solutions *u*(*x*, 1) and *β*(*t*) obtained by our numerical algorithm, in terms of the mean absolute errors E*<sup>u</sup>* and E*β*, as well as the values of the optimal regularization parameter *λ* at time *t* = 1 with the noisy percentage *p* ∈ {0%, 1%, 5%, 10%} under various *M* = *N* ∈ {6, 9, 12, 15}. Although this problem had the piecewise forcing term *f*(*x*, *t*), our Algorithm 2 perfectly performed in providing accurate results, as shown in Table 7. The time convergence rates concerning the -<sup>∞</sup> norm and CPU times (s) are shown in Table 8, under various numbers of *M* ∈ {6, 9, 12, 15, 18} with the final times *T* ∈ {1, 2, 3}. The graphical perturbed solutions *u*(*x*, 1) and *β*(*t*) for *p* ∈ {1%, 5%, 10%} are shown in Figure 4.


**Table 7.** Mean absolute errors of *u*(*x*, 1) and *β*(*t*) for optimal regularization parameter *λ* of Example 4.


**Table 8.** Time convergence rates and CPU times (s) for Example 4 by Algorithm 2 with *N* = 12.

**Figure 4.** The graphical results *u*(*x*, *T*) and *β*(*t*) for Example 4 with *N* = 30 and *M* = 21.
