## 2 Materials and Methods
### Discrete Analogs of Optimization Methods  
For the practical implementation of inverse problem-solving methods, it is necessary to transition from continuous mathematical models to their discrete analogs. This transition is driven by the requirements of numerical stability, computational accuracy, and the need for algorithmic implementation. Accordingly, discrete schemes for solving direct and adjoint problems have been developed, which exhibit the required properties of conservation and stability.  
To perform numerical calculations, we limit the analysis to the finite domain \(Q=[0,T]\times[0,L]\).  
We consider the inverse boundary value problem in the wave formulation, where the goal is to determine the approximate value of \(\varepsilon\). The governing equations are as follows:  
\[\mu\
u U_{tt}+\mu\sigma U_{t}=U_{zz}-\lambda^{2}U, \tag{6}\]  
\[\left.U\right|_{t=0}=0,\ \left.U_{t}\right|_{t=0}=0, \tag{7}\]  
\[\left.U_{z}\right|_{z=0}=\mu g(t),\ \left.U\right|_{z=L}=0, \tag{8}\]  
Here, \(p(z)\) is an approximate solution to the inverse problem, and the function \(g(t)\) is a Gaussian pulse with parameter \(\alpha\):  
\[g(t)=\frac{\alpha}{\sqrt{\pi}}e^{-\left(at\right)^{2}}. \tag{9}\]  
The quadratic functional is defined as  
\[J\Big{[}p^{(n)}\Big{]}=\int_{0}^{T}\Big{[}U\Big{(}0,t;p^{(n)}\Big{)}-f(t) \Big{]}^{2}dt,\ \ \ \ \ n=0,\ \ 1,\ 2,\ \ldots. \tag{10}\]  
The gradient of the functional is given by  
\[\
abla J\Big{[}p^{(n)}\Big{]}=\mu\int_{0}^{T}U_{tt}\Big{(}z,t;p^{(n)}\Big{)} \cdot\psi\Big{(}z,t;p^{(n)}\Big{)}dt,\ n=0,\ \ 1,\ 2,\ \ldots. \tag{11}\]  
Adjoint problem:  
\[\mu\
u\psi_{tt}-\mu\sigma\psi_{t}=\psi_{zz}-\lambda^{2}\psi, \tag{12}\]  
\[\left.\psi\right|_{t=T}=0,\ \left.\psi_{t}\right|_{t=0}=0, \tag{13}\]  
\[\left.\psi_{z}\right|_{z=0}=2[U(0,t;p)-f(t)],\ \left.\psi\right|_{z=L}=0, \tag{14}\]  
The derivation of formulas (11) for calculating the gradient and the corresponding adjoint problem (12)-(14) is provided in [22].  
Additional information:  
\[y_{0}^{k}\{p_{i}\}=f^{k},\;\;k=\overline{2,M}. \tag{25}\]  
The adjoint problem (12)-(14) is also approximated using an implicit difference scheme [34]:  
\[\frac{\mu p_{i}}{\overline{\tau}_{k}}\Bigg{(}\frac{\varphi_{i}^{k+1}-\varphi_{i }^{k}}{\tau_{k+1}}-\frac{\varphi_{i}^{k}-\varphi_{i}^{k-1}}{\tau_{k}}\Bigg{)}- \mu\sigma_{i}\frac{\varphi_{i}^{k+1}-\varphi_{i}^{k-1}}{2\overline{\tau}_{k}} =\frac{\varphi_{i+1}^{k-1}-\varphi_{i}^{k-1}+\varphi_{i-1}^{k-1}}{h^{2}}- \lambda^{2}\varphi_{i}^{k-1},\;\;\;i=\overline{1,N-1},\;\;\;k=\overline{M-1,1}, \tag{26}\]  
\[\varphi_{i}^{M}=0,\;\;\;\;\;\varphi_{i}^{M-1}=0,\;\;\;\;\;\varphi_{N}^{k}=0, \;\;\;\;\;\;i=\overline{1,N-1},\;\;\;k=\overline{M-2,0} \tag{27}\]  
\[\varphi_{1}^{k-1}=\varphi_{0}^{k-1}+h\Big{[}y_{0}^{k-1}-g^{k-1}\Big{]}+\frac {h^{2}}{2}\left(\frac{\mu p_{0}}{\overline{\tau}_{k}}\left(\frac{\varphi_{0}^ {k+1}-\varphi_{0}^{k}}{\overline{\tau}_{k+1}}-\frac{\varphi_{0}^{k}-\varphi_ {0}^{k-1}}{\tau_{k}}\right)-\mu\sigma_{0}\frac{\varphi_{0}^{k-1}-\varphi_{0}^ {k-1}}{2\overline{\tau}_{k}}+\lambda^{2}\varphi_{0}^{k-1}\right),\;k= \overline{M-1,1}. \tag{28}\]  
(b) We consider a discrete analog of the functional (10) and its gradient (11) as follows:  
\[J[p]=\sum_{k=1}^{M-1}\Big{[}y_{0}^{k}\{p_{i}\}-f^{k}\Big{]}^{2}\overline{\tau }_{k}, \tag{29}\]  
\[\overline{V}J[p_{i}]=\mu\sum_{k=1}^{M-1}\;y_{i}^{k}\{p_{i}\}\Bigg{(}\frac{ \varphi_{i}^{k+1}-\varphi_{i}^{k}}{\tau_{k+1}}-\frac{\varphi_{i}^{k}-\varphi_ {i}^{k-1}}{\tau_{k}}\Bigg{)},\;\;i=\overline{1,N-1}. \tag{30}\]  
These formulas were derived to ensure that the difference schemes preserve the conservative property of energy, namely, the conservation of energy at the discrete level. The derivation of the formulas for the gradient (30), along with the corresponding adjoint problem (26)-(28), has been performed.  
To minimize the functional, we employ the conjugate gradient method [22].