## 5 Numerical Method
### FEM Solution of the Direct Problem  
Consider uniform partition of the space interval by grid nodes \(x_{i+1}=ih,i=0,1\ldots,N\), \(h=1/N\). We apply Galerkin FEM [32; 33] in space for the problem (1)-(5) to find functions \(u^{h}\) and \(B^{h}\) from \(V_{0}^{h}=\{v^{h}\in C([0,1]),\ \ v^{h}(0)=v^{h}(1)=0\}\), satisfying the variational form of the problem (1)-(5) for all \(\varphi\in V_{0}^{h}\). We seek the solution in the form  
\[u^{h}(x,t)=\sum_{i=1}^{N}V_{i}(t)\varphi_{i}(x),\ \ B^{h}(x,t)=\sum_{i=1}^{N}W_{i}(t) \varphi_{i}(x).\]  
Figure 3: Exact (_solid line_) and recovered functions \(\beta\) (_dashed line_) at different iterations \(k\), TP2, \(N=40\), \(\tau=h^{2}\), Example 1. Figure 2: Exact (_solid line_) and recovered function \(f\) (_dashed line_) at different iterations \(k\), TP1, \(N=40\), \(\tau=h^{2}\), Example 1. In Figure 5, we show the convergence of the iteration processes for TP1 and TP2. The iteration process is efficient at recovering smooth and non-smooth and discontinuous functions. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline  & \multicolumn{4}{c}{**TP1**} & \multicolumn{4}{c}{**TP2**} \\ \cline{2-9}  & \(\mathcal{E}_{u}\) & \(\mathcal{CR}_{u}\) & \(\mathcal{E}_{B}\) & \(\mathcal{CR}_{B}\) & \(\mathcal{E}_{u}\) & \(\mathcal{CR}_{U}\) & \(\mathcal{E}_{b}\) & \(\mathcal{CR}_{b}\) \\ \hline
20 & \(4.7178\times 10^{-3}\) & & \(3.4785\times 10^{-3}\) & & \(1.3368\times 10^{-2}\) & & \(8.2245\times 10^{-3}\) & \\
40 & \(1.2236\times 10^{-3}\) & \(1.9470\) & \(8.9581\times 10^{-4}\) & \(1.9572\) & \(3.5848\times 10^{-3}\) & \(1.8988\) & \(2.2157\times 10^{-3}\) & \(1.8921\) \\
80 & \(3.1005\times 10^{-4}\) & \(1.9805\) & \(2.2663\times 10^{-4}\) & \(1.9829\) & \(9.2213\times 10^{-4}\) & \(1.9589\) & \(5.7206\times 10^{-4}\) & \(1.9535\) \\
160 & \(7.7300\times 10^{-5}\) & \(2.0040\) & \(5.6944\times 10^{-5}\) & \(1.9927\) & \(2.3260\times 10^{-4}\) & \(1.9871\) & \(1.4507\times 10^{-4}\) & \(1.9794\) \\
320 & \(1.9307\times 10^{-5}\) & \(2.0013\) & \(1.4242\times 10^{-5}\) & \(1.9994\) & \(5.7585\times 10^{-5}\) & \(2.0141\) & \(3.6478\times 10^{-5}\) & \(1.9916\) \\ \hline \end{tabular}
\end{table} 
Table 1: Errors and convergence rate of the numerical solutions \(u^{h}\) and \(B^{h}\) of the inverse problem, Example 1. **Example 2** (_Noisy data_). : _Now, we deal with perturbed measurements, generated as follows_  
\[E^{\sigma}(t_{n})=E(t_{n})+2\sigma_{1}E(t_{n})(\rho_{1}(t_{n})-0.5),\ \ F^{\sigma}(t_{n})=F(t_{n})+2\sigma_{2}E(t_{n})(\rho_{2}(t_{n})-0.5),\]  
_where \(E(t_{n})\), \(F(t_{n})\) are obtained as in Example 1, \(\sigma_{1}\), \(\sigma_{2}\) are noise levels and \(\rho_{1}(t_{n})\), \(\rho_{2}(t_{n})\) are a random vectors uniformly distributed at an interval of \([0,1]\). Then, we smooth the data using a polynomial curve fitting of 7 degrees._  
_All of the computations are performed for \(N=320\) and \(\tau=h\). In Figure 6, we plot the exact and recovered functions determined by Algorithm 1, using functions \(\beta\) and \(f\) for TPI, \(\sigma_{1}=0.003\), \(\sigma_{2}=0.002\). In this case, \(\mathcal{E}_{U}=4.3647\times 10^{-3}\), \(\mathcal{E}_{b}=1.6098\times 10^{-3}\) and the accuracy \(\epsilon\) is obtained at \(k=54\) iterations. In Figure 7, we illustrate the recovery in the case of bigger noise. The errors of the numerical solutions are \(\mathcal{E}_{U}=1.4443\times 10^{-2}\), \(\mathcal{E}_{b}=2.4217\times 10^{-2}\) and \(k=54\). In Figure 8, we depict exact recovered functions of \(\beta\) and \(f\) for TP2, \(\sigma_{1}=0.01\), \(\sigma_{2}=0.03\). In this case, \(k=53\) and \(\mathcal{E}_{U}=2.6049\times 10^{-2}\), \(\mathcal{E}_{b}=2.9370\times 10^{-2}\). Note that the number of iterations required to reach the error tolerance \(\epsilon\) is only slightly increased compared with the noise-free data test.