# Optimizing Physics-Informed Neural Network in Dynamic System Simulation and Learning of Parameters
## 5 Computational Simulations of Dynamical Systems
### First-Order Irreversible Chain Reactions
6: Return PINN solution \(z_{1 NN}(t_{n};\omega)\) and \(z_{2 NN}(t_{n};\omega),n=1,\ldots,X\)
7: Return Parameter \(k_{1}\): \(k_{1}(t_{n};\Phi),n=1,\ldots,X\)
8: Return Parameter \(k_{2}\): \(k_{2}(t_{n};\Phi),n=1,\ldots,X\)
```  
**Algorithm 1** PINN algorithm for learning the parameters of the first-order irreversible chain reactions model Figure 4: The first-order irreversible chain reactions solution of the actual output of species \(z_{1},z_{2}\) against \(t_{data}\) and the predicted output of species \(z_{1},z_{2}\) against \(t_{data}\). Figure 5: The phase space plot of the actual output of species \(z_{1}\) against species \(z_{2}\) and the predicted output of species \(z_{1}\) against species \(z_{2}\). Figure 5.0 The learned time-varying parameter values of the first-order irreversible chain reactions model. (**a**) Time-varying parameter \(k_{1}\). (**b**) Time-varying parameter \(k_{2}\). Table 2 shows the obtained time-varying parameters and error metrics through the approaches described in Scenario 1 and Scenario 2. We observe that Scenario 1 proved more accurate than Scenario 2. The accuracy of the PINN technique is evaluated by comparing the predicted concentrations of \(z_{1}\) and \(z_{2}\) with the actual values obtained from the data. These metrics provide insights into the fitting accuracy of the PINN technique. The results of the simulations show that the PINN algorithm can accurately predict the concentrations and learn the time-varying parameters of the first-order irreversible chain reactions model. The obtained time-varying parameter values are close to the true values, and the error metrics indicate high accuracy and good fitting of the model to the data. In addition, we compared the results we achieved using physics-informed neural networks to those obtained using deep neural networks, as shown in Tables 3 and 4. This comparison study used a setup of 90,000 epochs and one hidden layer containing 40 neurons, with processing time measured in seconds. Figure 7 explores the model's accuracy by showing the absolute error between the target and the predictions. Specifically, Figure 7 indicates that the absolute error is bounded by \(1\times 10^{-6}\) when using PINN, while Figure 7 reveals that the error is bounded by \(1\times 10^{-5}\) using DNN. This comparative analysis highlights the difference in accuracy between the two techniques, PINN and DNN, used in the modeling process. Finally, the results show that the PINN technique achieves comparable or better parameter estimation accuracy than the DNN technique. Additionally, the PINN technique exhibits faster computation times, making it an efficient choice for solving and identifying parameters in dynamical systems. \begin{table}
\begin{tabular}{c c c} \hline \hline  & \(k_{1}(t)\) & \(k_{2}(t)\) \\ \hline True Values & 5.0 & 1.0 \\ Approach 1 & 5.0000086 & 0.99999505 \\ Error of Approach 1 & 0.0000086 & 0.00000495 \\ Approach 2 & 5.0005193 & 1.0001917 \\ Error of Approach 1 & 0.0005193 & 0.0001917 \\ \hline  & \(z_{1}(t)\) & \(z_{2}(t)\) \\ \hline MAE of Approach 1 & 2.7979 \(\times\)\(10^{-7}\) & 3.0801 \(\times\)\(10^{-6}\) \\ MAE of Approach 2 & 1.7826 \(\times\)\(10^{-5}\) & 3.7310 \(\times\)\(10^{-5}\) \\ MSE of Approach 1 & 1.3095 \(\times\)\(10^{-13}\) & 1.1916 \(\times\)\(10^{-11}\) \\ MSE of Approach 2 & 4.8358 \(\times\)\(10^{-10}\) & 2.0368 \(\times\)\(10^{-9}\) \\ RMSE of Approach 1 & 3.6187 \(\times\)\(10^{-7}\) & 3.4519 \(\times\)\(10^{-6}\) \\ RMSE of Approach 2 & 2.1991 \(\times\)\(10^{-5}\) & 4.5131 \(\times\)\(10^{-5}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison of the two approaches using PINN. Figure 7: Absolute error plot between the data, PINN solution, and DNN solution. (**a**) Absolute error plot using PINN. (**b**) Absolute error plot using DNN. Furthermore, we also conducted a detailed investigation on the impact of augmenting the number of layers in the network called shallow vs. deep layers.