Please login first
Practical PINN Implementation for a Fractional-Order Damped Oscillator with CppAD-Computed Gradients
* 1 , * 2 , 3
1  Department of Higher Mathematics, Institute of Digital Technologies and Modeling in Construction, Moscow State University of Civil Engineering (MGSU), Moscow 129337, Russia
2  Department of General and Applied Physics, Institute of Digital Technologies and Modeling in Construction, Moscow State University of Civil Engineering (MGSU), Moscow 129337, Russia
3  Department of Information Science Applied Mathematics, Institute of Digital Technologies and Modeling in Construction, Moscow State University of Civil Engineering (MGSU), Moscow 129337, Russia
Academic Editor: Haci Mehmet Baskonus

Abstract:

This work presents a practical C++ implementation of a physics-informed neural network (PINN) for a fractional-order damped oscillator. A fully connected network outputs displacement and velocity, so the governing dynamics are enforced through a compact state-space residual involving first and second time derivatives. Integer-order derivatives are obtained via automatic differentiation, which removes finite-difference noise and preserves smooth, consistent gradients during training. The history-dependent fractional damping term is incorporated using the classical L1 discretization on a uniform time grid, which makes each residual evaluation depend on the entire predicted solution history and naturally captures memory effects. The training objective combines the squared residual norms at collocation points with a strongly weighted initial-condition penalty to control drift and stabilize early iterations. Gradients of the complete objective with respect to all network parameters are computed using reverse-mode automatic differentiation in CppAD by constructing a scalar loss function of a flat parameter vector, enabling efficient gradient-based optimization. Parameters are updated with the Adam algorithm using bias correction and double-precision moment accumulation for numerical robustness. This implementation includes deterministic parameter packing, explicit size checks, and lightweight diagnostics of boundary values during training, improving reproducibility and debuggability. Overall, the code provides an end-to-end baseline for PINN-based simulation of fractional-order oscillatory systems and can be readily extended to include external forcing, alternative loss weight schedules, and parameter identification from measurement data.

Keywords: PINN; Fractional differential; Equations; Optimization
Top