## 6 Numerical Experiments
### Triple-Frequency Tuning for Gain Factor Optimization
Therefore, our cost function is chosen as (at any spatial point \(x=x^{\prime}\))  
\[E_{st}(x=0\mu m,t)=1\times\sin\!\left(2\pi\!\left(3\times 10^{14}\right)\!\right) \ V/m,\ \ \ for\ \ \ 0\leq t\leq 40 ps\]4 \[E_{st}(x=0\mu m,t)=1\times\sin\!\left(2\pi\!\left(3\times 10^{14}\right)\!\right) \ V/m,\ \ \ for\ \ \ 0\leq t\leq 40 ps\]5  
_where \(\Delta T=40 ps,\ \ 0\leq t\leq 40 ps,\ \ \Big{(}3\times 10^{14}-\Delta f \Big{)}<\Omega<\Big{(}3\times 10^{14}+\Delta f\Big{)},\ \ \Delta f=0.5 THz\)_  
**Initial conditions:**  
\[E_{st}(x=0\mu m,t)=1\times\sin\!\left(2\pi\!\left(3\times 10^{14}\right)\!\right) \ V/m,\ \ \ for\ \ \ 0\leq t\leq 40 ps\]6  
\[E_{st}(x=0\mu m,t)=1\times\sin\!\left(2\pi\!\left(3\times 10^{14}\right)\!\right) \ V/m,\ \ \ for\ \ \ 0\leq t\leq 40 ps\]7 Configuration of the cavity and the parameters for Section 6.2. **Boundary and excitation conditions:**  
\[E_{st}(x=0\mu m,t)=1\times\sin\!\left(2\pi\!\left(3\times 10^{14}\right)\!\right) \ V/m,\ \ \ for\ \ \ 0\leq t\leq 40 ps\]8  
where \(A_{1}=1.5\times 10^{8}\), \(A_{2}=2\times 10^{8}\), \(A_{3}=2.5\times 10^{8}\), \(\Delta T_{1}=4 ps\), \(\Delta T_{2}=2 ps\), \(\Delta T_{2}=1 ps\)  
\[ \begin{array}{ll}E_{st}(x=0\mu m,t)&=1\times\frac{\sin(2\pi(3\times 10^{14})t)}{m},\ for\ \ 0\leq t\\ &\leq 40 ps,\ E_{lip}(x=15\mu m,t)=E_{st}(x=15\mu m,t)=0\ \ \ \ \ \ for\ 0<t\\ &<40 ps\end{array} \]  
**Absorbing boundary condition (perfectly matched layer):**  
\[\sigma(x)=\{\ (x-(L-\Delta))\sigma_{0}\,\ \ \ (L-\Delta)\leq x<L\ \ \ \},\ for\ L=15\mu m,\ \ \ \Delta=2.5\mu m,\ \ \sigma_{0}=4.5\times 10^{8}S/m\]  
**Optical isolator condition:** full reflection at \(x=0\mu m\); \(\Gamma(x=0\mu m,t)=1(Reflection coefficient=1)\)  
**Optical bandpass filter condition:** frequency-dependent reflection at \(x=10\mu\)m;  
\[\left|\Gamma(f^{\prime})\right|=1-e^{-(\frac{(f^{\prime}-3007 Hz)}{\sqrt{2}Th })^{2}}\ \ \ \,\ \ \ for\ \ \ x=10\mu m,\ \ 0<t<40 ps\]  
Augmented cost function to be maximized:  
\[ \begin{array}{ll}Q\Big{(}f_{p1},f_{p2},\ f_{p3}\Big{)}&=\left|E_{st}(f_{st}= 300 THz)\right|\\ &-\sum\limits_{i=1}^{3}\left\{\delta_{i,1}\Big{(}f_{p,i}-f_{max}\Big{)}^{2}+ \delta_{i,2}\Big{(}f_{min}-f_{p,i}\Big{)}^{2}\right\}\\ \delta_{i,1}=\left\{\begin{array}{ll}0&if\ \ f_{p,i}\leq f_{max}\\ \frac{\left|E_{st}(f_{st}=3007 Hz)\right|}{10^{27}}&if\ \ f_{p,i}>f_{max} \end{array}\right\},\ \delta_{i,2}=\left\{\begin{array}{ll}0&if\ \ f_{p,i}\geq f_{min}\\ \frac{\left|E_{st}(f_{st}=3007 Hz)\right|}{10^{27}}&if\ \ f_{p,i}<f_{min} \end{array}\right\}\end{array} \]  
**Optimization algorithm (BFGS):**  
\[\begin{array}{ll}Set\ \mathbf{H_{1}}=\left[ \begin{array}{ccc}1&0&0\\ 0&1&0\\ 0&0&1\end{array} \right]\ f_{p1,0}=2007 Hz,\ \ f_{p1,1}=205 THz\\ \\ f_{p2,0}=150 THz,\ \ f_{p2,1}=153 THz,\ \ f_{p3,0}=100 THz,\ \ f_{p3,1}=10 2 THz,\ \ \alpha_{1}=0.5\\ \\ \
abla\mathbf{Q}  
\[\mathbf{y}_{k}= \
abla\mathbf{Q}_{k+1}-\
abla\mathbf{Q}_{k}\ \ \ \rho_{k}=\frac{1}{\mathbf{y_{k}}^{T}\mathbf{ s_{k}}}\] \[\textit{BFGS update}\ \ \mathbf{H}_{k+1}=\Big{(}\mathbf{I}-\rho_{k}\mathbf{s}_{k}\mathbf{y_{k}}^{T} \Big{)}\mathbf{H}_{k}\Big{(}\mathbf{I}-\rho_{k}\mathbf{y_{k}}\mathbf{s_{k}}^{T}\Big{)}+\rho_{k} \mathbf{s_{k}}\mathbf{s_{k}}^{T}\] \[\mathbf{I}:\textit{Identity matrix}\]  
In order to satisfy the Wolfe conditions, the step size at each iteration is chosen as:  
\[\alpha_{k}=C^{(\log|\frac{Q(\rho_{k})}{|Q(\rho_{k})-Q(\rho_{k},k-1)}|)}\ /\ (\ | \frac{Q(\rho_{k},k)}{Q(\rho_{k})-Q(\rho_{k},k-1)}|)\]  
where \(C\) is just a constant (\(1<C<1.5\)) and \(\alpha_{k}\) is the step size at iteration k. In this simulation C = 1.45.