# INVERSE PROBLEM ANALYSIS IN THE DYNAMICS OF DAMPED HARMONIC OSCILLATORS USING PINNs

Charbel Mamlankou

► To cite this version:

Charbel Mamlankou. INVERSE PROBLEM ANALYSIS IN THE DYNAMICS OF DAMPED HARMONIC OSCILLATORS USING PINNs. 2025. hal-04949890

HAL Id: hal-04949890

https://hal.science/hal-04949890v1

Preprint submitted on 15 Feb 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# INVERSE PROBLEM ANALYSIS IN THE DYNAMICS OF DAMPED HARMONIC OSCILLATORS USING PINNs

Charbel Zeus J. MAMLANKOU

Université Nationale des Sciences, Technologies, Ingénierie et Mathématique (UNSTIM-Bénin)

École Nationale Supérieure de Génie Mathématique et Modélisation (ENSGMM)

charbelzeusmamlankou@gmail.com

## Abstract

This study explores the inverse problem of parameter estimation for an overdamped oscillator using Physics-Informed Neural Networks (PINNs) and nonlinear curve fitting. The first method, PINNs, demonstrates strong predictive power, achieving highly accurate estimates with minimal error, making it well-suited for inverse problems. The second method, nonlinear curve fitting, is effective but requires fixing one parameter to estimate others, reducing flexibility. In contrast, PINNs allow for simultaneous parameter estimation without prior assumptions, offering greater adaptability for complex systems. The results highlight PINNs' robustness and their potential for broader applications in modeling dynamic systems, particularly when analytical solutions or prior parameters are unavailable.

**Keywords:** Inverse problem, PINNs, Parameter estimation, damped oscillator, Curve fitting, Nonlinear least squares, Dynamical systems, Data-driven modeling

## 1 Introduction

The study of inverse problems plays a crucial role in various fields of science and engineering, particularly in understanding the dynamics of systems such as damped

harmonic oscillators. Inverse problems involve the reconstruction of model parameters from observed data, which is often corrupted by noise. The challenge lies in the ill-posed nature of these problems, where small changes in data can lead to significant variations in the reconstructed parameters [5]. Damped harmonic oscillators serve as a fundamental model for many physical systems, including mechanical vibrations and electrical circuits. The dynamics of these systems can be described by differential equations, where parameters such as damping coefficients and natural frequencies significantly influence their behavior. Traditional methods for solving inverse problems often rely on optimization techniques that minimize the difference between observed and predicted data [7]. However, these methods can be computationally expensive and may struggle with convergence when faced with nonlinearities or high-dimensional parameter spaces. Recently, Physics-Informed Neural Networks (PINNs) have emerged as a powerful tool for addressing inverse problems. By incorporating the underlying physics described by differential equations into the neural network architecture, PINNs enable efficient learning of model parameters while respecting the governing equations [7]. This approach not only enhances computational efficiency but also improves robustness against noise in the data. Applications of PINNs in the analysis of damped harmonic oscillators are diverse. They can be employed to identify unknown parameters from experimental data, optimize systems.
tem performance, and even predict future behavior under varying conditions. The integration of PINNs into inverse problem analysis thus presents a promising avenue for advancing our understanding of complex dynamical systems. In this paper, we will explore the application of PINNs to solve inverse problems associated with damped harmonic oscillators, highlighting their advantages over traditional methods and discussing potential applications in real-world scenarios.

## 2 Background

Damped harmonic oscillators [8] are ubiquitous in many physical phenomena and engineering systems. They play a key role in the modeling of vibrating mechanical systems, structural dynamics, RLC electrical circuits, as well as in more complex fields such as biomechanics and seismology.

In these systems, damping has a fundamental impact on the oscillatory behavior, ranging from an underdamped regime, where the oscillator undergoes multiple oscillations before coming to rest, to an overdamped regime, where it returns to equilibrium without oscillating.

Identifying the physical parameters of the system (mass $m$, damping coefficient $\gamma$, and stiffness $k$) from experimental observations constitutes an **inverse problem** [9, 3] of crucial importance in engineering and applied sciences. This study aims to address this problem using PINNs [7, 10], a modern approach that integrates differential equations directly into the learning process of models.

The motion of a damped harmonic oscillator in 1D [2] is governed by the following differential equation:

$$m \frac{d^2 x}{dt^2} + \gamma \frac{dx}{dt} + kx = 0 \quad (1)$$

where $x(t)$ is the position of the oscillator at time $t$, $m$ is the mass of the system, $\gamma$ is the damping coefficient, $k$ is the stiffness constant of the spring.

This equation describes the system's dynamics under the influence of inertial, damping, and elastic restoring forces. Determining the analytical solution to this problem is rudimentary. In fact, the characteristic equation can be written as follows:

$$m\lambda^2 + \gamma\lambda + k = 0.$$

The roots of this equation are given by the quadratic formula:

$$\lambda_{1,2} = \frac{-\gamma \pm \sqrt{\gamma^2 - 4mk}}{2m}.$$

The nature of the solutions depends on the discriminant $\Delta = \gamma^2 - 4mk$:

* **Overdamped regime ($\Delta > 0$)** The roots $\lambda_1$ and $\lambda_2$ are real and distinct. The general solution is:

$$x(t) = C_1 e^{\lambda_1 t} + C_2 e^{\lambda_2 t}.$$

* **Critically damped regime ($\Delta = 0$)** There is a double real root $\lambda = -\frac{\gamma}{2m}$. The solution takes the form:

$$x(t) = (C_1 + C_2 t)e^{\lambda t}.$$

* **Underdamped regime ($\Delta < 0$)** The roots are complex conjugates:

$$\lambda_{1,2} = \frac{-\gamma}{2m} \pm i\omega, \quad \text{where } \omega = \frac{\sqrt{4mk - \gamma^2}}{2m}.$$

The solution can then be written as:

$$x(t) = e^{-\frac{\gamma}{2m}t} (C_1 \cos(\omega t) + C_2 \sin(\omega t)).$$

## PINNs Inverse problem analysis

Inverse problems are fundamental in many scientific and engineering disciplines, as they allow the estimation of unknown system parameters from observed data.

In this study, we focus on the inverse problem of identifying the physical parameters of a damped harmonic oscillator 1. The objective is to infer these parameters from noisy observations of the system's motion using Physics-Informed Neural Networks (PINNs).
## 2.1 Formulation

The PINNs model represents the unknown function $x(t)$ using a neural network $\hat{x}(t, \theta)$, parameterized by $\theta$. The network is trained to satisfy both the observed data and the underlying physics encoded by the differential equation.

The forward pass of the network computes the position:

$$ \hat{x}(t) = \mathcal{N}(t; \theta), $$

and its derivatives are obtained via automatic differentiation:

$$ \hat{x}_t = \frac{d\hat{x}}{dt}, \quad \hat{x}_{tt} = \frac{d^2\hat{x}}{dt^2}. $$

The parameters $m$, $\gamma$, and $k$ are learned as trainable variables. The total loss function consists of two terms: physics and data loss.

To obtain the physical loss, the basic equation must be formulated directly.

$$ \mathcal{L}_{\text{physics}} = \frac{1}{N} \sum_{i=1}^{N} \left| m \hat{x}_{tt}(t_i) + \gamma \hat{x}_t(t_i) + k \hat{x}(t_i) \right|^2 $$

The Data Loss is relative to minimizing the error between the predicted and observed data.

$$ \mathcal{L}_{\text{data}} = \frac{1}{M} \sum_{j=1}^{M} \left| \hat{x}(t_j) - x_{\text{obs}}(t_j) \right|^2 $$

Thus, the total loss function is:

$$ \mathcal{L} = \lambda_{\text{physics}} \mathcal{L}_{\text{physics}} + \lambda_{\text{data}} \mathcal{L}_{\text{data}} $$

where $\lambda_{\text{physics}}$ and $\lambda_{\text{data}}$ the arbitrary weights that we will apply for stability.

## 2.2 Training and Optimization

Training is performed using the AdamW (Adam with weight decay) [6, 4] optimizer with learning rate scheduling. Also, the gradient clipping ensures stability, while early stopping is used to prevent overfitting.

The network updates the parameters $\theta$ to minimize $\mathcal{L}$. We note that the error $\epsilon$ in parameter estimation depends on the choice of $\lambda_{\text{physics}}$, $\lambda_{\text{data}}$, the complexity of the neural network architecture and the quality and amount of training data.

## 2.3 Observed data

To assess the predictive capability of Physics-Informed Neural Networks (PINNs) for inverse problems, we generate observational data by predefining the system parameters. These data will serve as reference points, representing the experimental measurements of the model. Initially, the position is set to 1, and the system's evolution is simulated using Python's odeint solver with parameters ($m = k = 1, \gamma \in \{0.1, 2, 4\}$). At $t = 30$s, the position is set to 0. The goal is to estimate these unknown parameters through neural network training, assuming no prior knowledge of their actual values.

The following graph shows the temporal evolution of observation data in each case for $\gamma$. These data cover a total period of 50s.

<figure><img src="image_2.png" /><figcaption>Figure 1: Observed data for the 3 regimes: underdamped(blue), critically (red) and overdamped (green).</figcaption></figure>

# 3 Parameter estimation

Although the values of $m$ and $k$ remain the same across different damping regimes in
our generated data, we will estimate them separately for each case. This approach reflects a real-world scenario where an external observer has no prior knowledge of these parameters, and we place ourselves in the same position.

For implementing the neural network for the inverse problem, we use PyTorch with an input layer, 4 hidden layers of 128 neurons and one output layer each activated by a tanh function. The total number of iterations is set to 10,000 for all 3 tests. To initialize our parameters, we randomly select a value between 1 and 7, and the model uses this as a starting point to improve this value before making its final prediction. A seed was applied to ensure reproducibility.

## 3.1 Overdamped case

Here, we use the overdamped data to predict the parameters, and the results are as follows:

<figure><img src="image_3.png" /><figcaption>Figure 2: Predicted value at each epoch: overdamped case</figcaption></figure>

The model shows convergence between epochs 6000 (and earlier in some cases) and 10000 for all three estimations. To analyze these results, we implement a mode-based analysis approach, where we identify and plot the most frequently occurring values across these three estimations during the stable period.

<figure><img src="image_4.png" /><figcaption>Figure 3: Predicted stable value (red)</figcaption></figure>

Note that in each of the predictions, the stable values correspond to the values with which we had generated the observation data. We obtain exactly

$$m = k = 1 \text{ and } \gamma = 4$$

## 3.2 Underdamped case

Underdamped observations data is used to forecast the parameter at this state.

<figure><img src="image_5.png" /><figcaption>Figure 4: Predicted value at each epoch: underdamped case</figcaption></figure>

The plot with the stable values is as follows:

<figure><img src="image_6.png" /><figcaption>Figure 5: Predicted stable value (red)</figcaption></figure>

Once again, we see that the predictions are very good and we have with precision:

$$m = k = 1 \text{ and } \gamma = 0.099992 \approx 0.1$$

These values testify to the robustness of the model and its ability to adjust parameters to the data.

## 3.3 Critical case

The data relating to the critical case are used in this section.

<figure><img src="image_7.png" /><figcaption>Figure 6: Predicted value at each epoch: critical case</figcaption></figure>
Once again, we plot the line based on the occurrences and we obtain:

<figure><img src="image_8.png" /><figcaption>Figure 7: Predicted stable value (red)</figcaption></figure>

Once again, the model demonstrated its capabilities by correctly predicting the parameters.

$$m = k = 1 \quad \text{and} \quad \gamma = 2$$

These values correspond exactly to those used to generate the observation data.

## 4 Discussion

The results obtained from the parameter estimation experiments are highly conclusive, once again demonstrating the effectiveness of Physics-Informed Neural Networks (PINNs) for inverse problems. This approach is broadly applicable to any system where observational data is available, but the underlying parameters are unknown.

A classical alternative to this problem would involve leveraging the analytical solution of the system and applying interpolation techniques to recover the parameters. However, in many practical cases, an explicit analytical solution is either unavailable or difficult to obtain. Also, estimating all 3 parameters simultaneously with this method is not directly possible, and we are obliged to set one of the parameters equal to a fixed value (see appendix B). This limitation justifies the need for more advanced approaches such as PINNs, which seamlessly integrate physical laws into the learning process, ensuring consistency with the governing equations.

Furthermore, the robustness and convergence of the model are reflected in the behavior of the loss functions used in this

study. All loss terms exhibit a clear trend toward zero, reaching values as low as $10^{-9}$ (see appendix A), indicating a high degree of accuracy in both the data fitting and the satisfaction of the underlying differential equation. This reinforces the potential of PINNs as a powerful tool for solving inverse problems, particularly in cases where traditional numerical or analytical techniques fall short.

## 5 Conclusion

In this study, we first harnessed the power of Physics-Informed Neural Networks (PINNs) to solve the inverse problem of parameter estimation in an over-damped oscillator. The results obtained demonstrate the excellent predictive ability of this approach, with rapid convergence and negligible errors, highlighting the relevance of PINNs for inferring unknown parameters.

Next, we explored a more conventional approach based on curve fitting, which also enables model parameters to be estimated from experimental observations. However, this method has one major limitation: it requires a priori fixing of one parameter in order to estimate the others. This constraint reduces its generality, unlike PINNs, which allow all parameters to be estimated simultaneously without any prior assumption about their value.

So, while curve fitting is an efficient and fast method for well-constrained models, PINNs prove to be a more flexible and efficient alternative when it comes to estimating all the parameters of a dynamic system. This study therefore highlights the value of PINNs in inverse problems, and opens up prospects for their application to more complex systems, including nonlinear dynamics or models with incomplete data.

## Appendix

**A:** We briefly present the losses of our models during parameter estimation.
<figure><img src="image_9.png" /><figcaption>Figure 8: Training loss for overdamped case</figcaption></figure>

As discussed earlier, the data loss is consistently on the order of $10^{-6}$, demonstrating the strong predictive capability of the trained model. Moreover, the losses associated with the governing equation and the total loss remain relatively low ($10^{-5}$, $10^{-4}$), further confirming the accuracy and robustness of the approach. Given these results, we can confidently rely on the model's predictive strength for parameter estimation. This highlights the effectiveness of PINNs in solving inverse problems, even in scenarios where traditional methods struggle due to the absence of analytical solutions or the complexity of the system dynamics.

In the case of underdamped, the observations remain the same, only this time the error ceiling is around $10^{-5}$. As this value is very close to 0, we can once again reiterate our assertions about the quality of the model.

<figure><img src="image_10.png" /><figcaption>Figure 9: Training loss for underdamped case</figcaption></figure>

The loss values obtained in this case confirm why the estimated value of $\gamma$ was

0.099992, closely approximating the exact value rather than matching it perfectly. In other words, we can reasonably assume that if the model were given more training time (i.e., increasing the number of iterations), convergence would be even more precise, potentially reducing errors below $10^{-5}$. However, the current approximation is already highly accurate and can be reliably used for further studies if needed.

For the critical case, the results are outstanding, as we achieve loss values on the order of $10^{-9}$. This confirms the high precision of the predictions in this scenario, with exact estimations similar to those obtained in the first case.

<figure><img src="image_11.png" /><figcaption>Figure 10: Training loss for critical case</figcaption></figure>

## B: Direct parameter estimation approach

The aim here is to estimate the parameters (stiffness) and (damping coefficient) of an overdamped oscillator from observational data. To achieve this, we use curve fitting [1] applied to an analytical solution of the differential system governing the oscillator. Let's take just one case as an example: overdamped.

In the overdamped regime, the characteristic roots of the auxiliary equation are real and distinct:

$$ \lambda_{1,2} = \frac{-\gamma \pm \sqrt{\gamma^2 - 4mk}}{2m} $$

The general solution for $x(t)$ in this case is:

$$ x(t) = A_1 e^{\lambda_1 t} + A_2 e^{\lambda_2 t} $$
where $A_1$ and $A_2$ are constants determined by the initial conditions.

The observational data $(t, x)$ is fitted to the function:

$$x(t) = A_1e^{\lambda_1 t} + A_2e^{\lambda_2 t}$$

Parameter estimation relies on optimizing the coefficients $A_1, A_2, \lambda_1, \lambda_2$ using nonlinear least squares fitting via `curve_fit` from `scipy.optimization`.

Once $\lambda_1$ and $\lambda_2$ are estimated, the parameters are retrieved using the relations:

$$\gamma = -m(\lambda_1 + \lambda_2)$$
$$k = m\lambda_1\lambda_2$$

In our case, we set $m = 1$, simplifying the expressions (necessary for solving the problem) to:

$$\gamma = -(\lambda_1 + \lambda_2)$$
$$k = \lambda_1\lambda_2$$

The obtained results are compared to the exact values $\gamma_{\text{true}} = 4.0$ and $k_{\text{true}} = 1.0$. The relative error is computed as:

$$\text{Rel error} = \left| \frac{\text{estimated value} - \text{true value}}{\text{true value}} \right| \times 100\%$$

Finally, the quality of the fit is evaluated using the coefficient of determination:

$$R^2 = 1 - \frac{\sum (x_i - \hat{x})^2}{\sum (x_i - \bar{x})^2}$$

A value of $R^2$ close to 1 indicates a good fit.

Unlike the neural network method, the estimation here is pointwise and with $m=1$, we obtain exactly $k = 1$ and $\gamma = 4$. This corresponds to the exact values (and therefore an $R^2 = 1$).

One of the reasons why the PINNs method for inverse problems is more suitable is that you necessarily have to fix a value for one of the parameters before finding the others. And we also note that when we choose a value for $m$ other than 1, the process has no way of correcting it so that it converges to its exact value.

## References

[1] Analytic curve fit: one gaussian curve fitting a bimodal model.

[2] Fabrice Fourcade. Oscillateurs à une dimension. In *Leçons de Physique*. 2020.

[3] Isma Kaddouri. Problèmes inverses pour des problèmes d'évolution paraboliques à coefficients périodiques. 2014.

[4] Diederik P. Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. *arXiv preprint arXiv:1412.6980*, 2014.

[5] S.N. Kruzhkov. First order quasilinear equations in several independent variables. *Mathematics of the USSR-Sbornik*, 10(2):217-243, 1970.

[6] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. *arXiv preprint arXiv:1711.05101*, 2019.

[7] M. Raissi and al. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. *Journal of Computational Physics*, 378:686-707, 2019.

[8] Jacques Romain. Théorie de l'oscillateur linéaire harmonique à l'aide de variables canoniques non hermitiennes. *Bulletin de la Société des Sciences et Techniques de l'Université de Lille*, 42(1):1-20, 1956.

[9] Rafael de O. Telolia and al. Physics-informed neural networks for inverse problems in structural dynamics. In *Nondestructive Evaluation*, Long Beach, California, United States, 2024.

[10] Roberta Tittarelli and al. Identification par des réseaux de neurones guidés par la physique. *Techniques de l'ingénieur*, 2024.