Previous Article in Journal
Dihedral Corner Region Camouflage in Radar Vision by Super-Dispersion Encoded Surfaces
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Improved Physics-Informed Neural Network Approach for Solving the FitzHugh–Nagumo Equation

by
Miloš Ivanović
1,
Matija Savović
2 and
Svetislav Savović
1,*
1
Faculty of Science, University of Kragujevac, R. Domanovića 12, 34000 Kragujevac, Serbia
2
Faculty of Medical Sciences, University of Kragujevac, Svetozara Markovića 69, 34000 Kragujevac, Serbia
*
Author to whom correspondence should be addressed.
Computation 2025, 13(12), 275; https://doi.org/10.3390/computation13120275
Submission received: 6 October 2025 / Revised: 15 November 2025 / Accepted: 20 November 2025 / Published: 25 November 2025

Abstract

The FitzHugh–Nagumo (FHN) equation in one dimension is solved in this paper using an improved physics-informed neural network (PINN) approach. Examining test problems with known analytical solutions and the explicit finite difference method (EFDM) allowed for the demonstration of the PINN’s effectiveness. Our study presents an improved PINN formulation tailored to the FitzHugh–Nagumo reaction–diffusion system. The proposed framework is efficiently designed, validated, and systematically optimized, demonstrating that a careful balance among model complexity, collocation density, and training strategy enables high accuracy within limited computational time. Despite the very strong agreement that both methods provide, we have demonstrated that the PINN results exhibit a closer agreement with the analytical solutions for Test Problem 1, whereas the EFDM yielded more accurate results for Test Problem 2. This study is crucial for evaluating the PINN’s performance in solving the FHN equation and its application to nonlinear processes like pulse propagation in optical fibers, drug delivery, neural behavior, geophysical fluid dynamics, and long-wave propagation in oceans, highlighting the potential of PINNs for complex systems. Numerical models for this class of nonlinear partial differential equations (PDEs) may be developed by existing and future model creators of a wide range of various nonlinear physical processes in the physical and engineering sectors using the concepts of the solution methods employed in this study.

Graphical Abstract

1. Introduction

Analytical techniques and numerical simulations of nonlinear partial differential equations (PDEs) have been extensively studied across various fields, including mathematics, physics, chemistry, and engineering. The complexity of nonlinear PDEs continues to grow as more real-world factors influencing engineering systems are incorporated. Among these, the FitzHugh–Nagumo (FHN) equation plays a crucial role. It is widely used in the study of diverse engineering problems, fiber optics, and neurophysiology [1]. The FHN model effectively describes phenomena such as solitary pulses and periodic wave trains in systems like photonic crystals, semiconductors, and fiber optic communication networks [2]. Since analytical solutions for the FHN equation are rare, there is intensive research on numerical methods. Thus, a variety of numerical methods have been applied to solve the FHN equation, including the Haar-scale-3 wavelet collocation method [3], Rabotnov’s fractional exponential function approach [4], the two-step hybrid block method [5], the local meshless method [6], the Chebyshev polynomial-based collocation method [7], the compact finite difference method [8], the spectral Galerkin method [9], semi-analytical methods [10], the cubic B-spline-based one-step optimal hybrid block method [11], the fully discrete implicit-explicit finite element method [12], and the sixth-order compact finite difference method [13].
One should note that the classical FHN model consists of two coupled fields: an activator, which evolves rapidly and includes a cubic nonlinear reaction term, and an inhibitor (recovery variable), which evolves on a slower timescale and provides negative feedback. The one-field PDE with a cubic reaction term, which we solve in this work, corresponds to the fast subsystem of the FHN model, obtained by assuming that the inhibitor variable equilibrates instantaneously (i.e., adiabatic or singular perturbation limit). Mathematically, this corresponds to taking the limit where the inhibitor relaxation time tends to zero, so that the inhibitor variable can be expressed algebraically as a function of the activator and eliminated. This reduction is valid in the regime where (i) timescale separation is extreme, and the inhibitor recovers much faster than the activator evolves, (ii) spatial coupling of the inhibitor is negligible, or its diffusion is either vanishingly small or homogenized, and (iii) the dominant dynamics of interest arise from wave propagation shaped primarily by the cubic reaction term. This reduced model is therefore appropriate for studying front propagation, bistability, and excitable pulse initiation in regimes where recovery is effectively instantaneous. By eliminating the inhibitor variable, the features of the full FHN system, such as slow recovery dynamics, inhibitor diffusion, relaxation oscillations, and spike frequency adaptation, are no longer captured.
Most traditional numerical methods for solving PDEs rely on discretizing the problem domain using a mesh (or grid) of finite points. This approach requires the problem to be formulated in terms of discrete spatial and temporal variables. While such mesh-based techniques are widely used and considered effective in many scenarios, they face significant challenges when applied to high-dimensional problems. As the number of dimensions increases, the mesh must become increasingly refined, which leads to an exponential growth in the number of grid points. This, in turn, results in a sharp increase in computational complexity, as the algorithm requires more processing power and memory to handle the larger grid. This high-dimensional scaling problem becomes especially pronounced in fields like fluid dynamics, material science, and complex biological systems, where the number of variables and their interactions can be vast. In response to these limitations, a new class of modeling approaches has emerged, driven by advancements in artificial intelligence and computational power. One such technique, PINNs, represents a significant departure from traditional mesh-based methods. Unlike conventional approaches, PINNs leverage neural networks to learn the solution to a PDE directly from the governing equations and data, without the need for a predefined mesh. By incorporating physical laws into the loss function of the neural network, PINNs can efficiently solve complex nonlinear PDEs, even in high-dimensional spaces, without suffering from the computational burdens associated with grid refinement. Recent work by Raissi et al. [14] has highlighted the power and versatility of PINNs in solving a range of challenging nonlinear PDEs. Their research demonstrated that PINNs can effectively tackle problems such as nonlinear Schrödinger equations, Allen–Cahn equations, Navier–Stokes equations, Korteweg–de Vries equations, and Burgers’ equation. Furthermore, they have proven to be a valuable tool for addressing high-dimensional inverse problems, where traditional methods often struggle with scalability and efficiency. These developments mark a promising shift towards more flexible and scalable techniques for solving complex, real-world problems across various scientific disciplines.
In this study, we compare an improved PINN approach with the standard EFDM to solve the FHN equation. The FDM approximates derivatives at discrete points by constructing a grid and calculating differences between nearby values, with accuracy depending on grid step size and derivative approximation order. In contrast, PINN is a machine learning-based method where a neural network is trained to minimize the residual between the predicted and actual solution, effectively handling complex boundary conditions and geometries. However, PINNs can be computationally expensive and sensitive to hyperparameters like network architecture.
Although promising, PINN’s accuracy compared to conventional methods like FDM still remains largely unexplored. In our previous work, EFDM outperformed PINN in solving the Burgers’ and Sine-Gordon equations [15,16]. To make further progress in this regard, in this work, we present the first comparison, to the best of our knowledge, of EFDM and improved PINN for solving the FHN equation, using two test problems with different initial and boundary conditions. This contrasts with other studies focused primarily on comparison between conventional numerical methods, like explicit and implicit time-stepping methods for the FHN equation [17].

2. The FitzHugh–Nagumo Equation

We considered the FHN equation, which is a nonlinear PDE given by [8]
u x , t t = α t 2 u x , t x 2 + β t u x , t x γ t u x , t u x , t μ 1 u x , t , a x b ,       0 t T
We note that in Equation (1a), α(t) multiplies the second spatial derivative (diffusion term), whereas β(t) multiplies the first spatial derivative (advection term). In the case of α t = 1 ,   β t = 0 ,   γ t = 1 ,   E q u a t i o n   1 a   b e c o m e s [11]:
u x , t t = 2 u x , t x 2 + u x , t u x , t μ 1 u x , t ,   a x b ,       0 t T
The initial condition for Equation (1a,b) is given as follows:
u x , t = 0 = u 0 x ,           a x b    
and boundary conditions read as
u x = a , t = u a t ,           u x = b , t = u b t ,         0 < t T
where μ is the positive parameter and t and x are space and time variables, respectively.

3. Explicit Finite Difference Method

Using the EFDM, where the forward FD scheme is used to represent the derivative term u ( x , t ) / t = u i j + 1 u i j / t and central FD schemes are used to represent derivative terms u ( x , t ) / x = ( u i + 1 j u i 1 j ) / 2 Δ x and u ( x , t ) / x = u i + 1 j 2 u i j + u i 1 j / x 2 , Equation (1a) is written in the following form:
    u i j + 1 u i j t = α t j u i + 1 j 2 u i j + u i 1 j x 2 + β t j u i + 1 j u i 1 j 2 x + γ t j u i j 3 u i j 2 1 + μ + μ u i j
and Equation (1b) is given as follows:
u i j + 1 u i j t = u i + 1 j 2 u i j + u i 1 j ( x ) 2 u i j 3 + u i j 2 1 + μ μ u i j
where u i j u ( x i , t j ) , and indexes i and j refer to the discrete step lengths Δ x and Δ t for the coordinate x and time t. The grid dimensions in the x and t directions are K = 1 / Δ x and M = T / Δ t , respectively. Using the FD scheme, the initial condition (2) and boundary conditions (3) are given as follows:
u i 1 = u 0 x i ,           a x i b ,       i = 1 ,   2 , , K       ( t = 0 )
u 1 j = u a t j ,           u K j = u b t j ,           j = 1 ,   2 , , M       ( x = a   a n d   x = b )
Equation (4b) represents a formula for u i j + 1 at the (i, j+1)th mesh point in terms of the known values along the jth time row. The truncation error can be reduced using small enough values of Δ t and Δ x until the precision attained is within the error tolerance.

4. Physics-Informed Neural Networks

4.1. The Basic Concept of the PINNs Is Solving PDEs

A machine learning method called the PINN can be used to approximately solve PDEs. A general form of PDEs with corresponding initial and boundary conditions is
u ( x , t ) t + Ν u ( x , t ) = 0 , x Ω , t [ 0 , T ] u ( x , t = 0 ) = h ( x ) , x Ω u ( x , t ) = g ( x , t ) , x Ω g , t [ 0 , T ]
Here, N is a differential operator, x Ω R d and t R represent spatial and temporal dimensions, respectively, Ω R d is a computational domain, Ω g Ω is a computational domain of the exposed boundary conditions, and u ( x , t ) is the solution of the PDEs with the initial condition h ( x ) and boundary conditions g ( x , t ) .
The approximator network and the residual network are the two subnets that make up PINN in its original construction [18]. The approximator network receives input ( x , t ) , undergoes the training process, and provides an approximate solution u ( x , t ) as an output. The approximator network is trained using a grid of collocation points, which are sampled randomly or regularly from the simulation domain. To optimize the network’s weights and biases, a composite loss function is minimized:
L = L r + L 0 + L b
where
L r = 1 N r i = 1 N r u ( x i , t i ) + N [ u ( x i , t i ) ] 2   L 0 = 1 N 0 i = 1 N 0 u ( x i , t i ) h i ) ] 2   L b = 1 N b i = 1 N b u ( x i , t i ) g i ) ] 2
Here, L r , L 0 , and L b represent residuals of governing equations and initial and boundary conditions, respectively. N r , N 0 , and N are the numbers of mentioned collocation points of the computational domain and initial and boundary conditions, respectively. The residuals are computed by the residual network, a non-trainable component of the PINN model. To calculate these residuals, PINN requires derivatives of the outputs with respect to inputs x and t. Automated differentiation (AD) is used to compute these derivatives by integrating the derivatives of individual operations, which is a key feature distinguishing PINNs from earlier methods that relied on manually derived back-propagation rules. Only first- and second-order spatial derivatives appear in the residual. Automatic differentiation computes these exactly and directly. No hidden higher-order derivatives or regularization terms are introduced through the AD graph. The script can be checked at GitHub Repository. Deep learning frameworks like TensorFlow 2.13.0 and PyTorch 2.1.0 provide robust AD, enabling efficient calculation of derivatives of all orders in space–time without the need for manual derivation or numerical discretization. We use default unity weights for loss components for the PDE itself, as well as boundary and initial conditions. To check the impact of various weight distributions on the result, we checked three different weight distributions, with each of them putting emphasis on the PDE, boundary condition (BC), and initial condition (IC). The findings show that, for this specific problem, there is no statistically significant impact, bearing in mind the variance introduced by different seeds.
A schematic of the PINN is demonstrated in Figure 1, in which a simple PDE f / x + f / y = u is used as an example. The approximator network is used to approximate the solution u ( x , t ) , which then goes to the residual network to calculate the residual loss L r , boundary condition loss L b , and initial condition loss L 0 . The weights and biases of the approximator network are trained using a composite loss function consisting of residuals L r , L 0 , and L b through the gradient-descent technique based on the back-propagation. For a simple PDE shown at the top of Figure 1, the residuals are defined as R = f / x + f / y u and I = f ( 0 , 0 ) i . The total loss function combines the mean squared errors of these two terms, ensuring both the PDE and its conditions are satisfied: MSE = MSER + MSEI, where MSER represents the mean squared residual of the PDE and MSEI enforces the initial or boundary conditions. During training, the network parameters are optimized to minimize this combined loss, leading to a solution that simultaneously approximates f(x, y) and adheres to the underlying physical constraints. This approach enables the PINN to solve PDEs in a mesh-free manner while integrating physical laws directly into the learning process, making it highly effective for modeling complex systems in fluid dynamics, heat transfer, and other physics-based domains.
It is also interesting to note that a previous research study focused on the synthesis of a four-bar mechanism for the trajectory planning of a point belonging to the connecting rod [19]. The objective was to generate a tool that synthesizes the mechanism topology given the desired trajectory. This preliminary study has shown how PINNs are suitable to automate the synthesis of mechanisms, where regular NNs would generally fail. Numerical analyses also demonstrate that a PINN learns relations from a physical numerical model in a more efficient way than a traditional NN.

4.2. Implementation of PINN in Solving the FitzHugh–Nagumo Equation

We used the DeepXDE 1.14.0 library to construct the PINN model for solving the FHN equation [20]. Our PINN has two inputs (x, t) and three layers, and each layer has 30 neurons. All neurons use a Tanh activation function. The collocation points are divided into three subsets: the largest (8000 points) covers the problem domain, while the second and third subsets (400 and 800 points) impose boundary and initial conditions. Both test cases share the same conditions. The PINN training consists of two phases: in the first, weights and biases are optimized using the Adam algorithm with a learning rate of 10−3. In the second phase, the Limited Memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) algorithm is used to refine the solution after the “global” search phase, as described in [21]. The entire training process takes about 85 s on the NVIDIA Tesla T4 GPU. Due to lost implementation details, we approximated the training as follows: Adam was run for ~40,000 epochs until the loss stabilized, followed by L-BFGS for ~200 iterations, with early stopping criteria activated. The stopping criterion was defined as either the loss dropping below 1 × 10−8 or minimal change between iterations. Sample points were chosen using uniform random sampling in the domain. The assumed boundary and initial conditions are given in Equation (7).
While different hyperparameters, activation functions, training methods, and PINN topologies could yield better solutions, we chose the most common values from the FHN literature, as hyperparameter tuning is a time-consuming process beyond the scope of this work. We conducted a brief hyperparameter analysis, changing one kind of hyperparameter at a time and monitoring the change in RMSE:
  • Various activation functions: tanh—0.000039; swish—0.000040; sin—0.000035; sigmoid—0.000070.
  • Various PINN architectures (layers × neurons per layer): 3 × 10—0.000046; 3 × 30—0.000039; 3 × 50—0.000020; 4 × 30—0.000018; 4 × 50—0.000014.
  • Various numbers of collocation points (PDE, BC, IC): (2000, 100, 200)—0.000059; (4000, 200, 400)—0.000055; (8000, 400, 800)—0.000039; (16,000, 800, 1600)—0.000017.
On the other hand, RMSE variance calculated from 10 random seeds is 1.5 × 10−5, which is approximately 35% in relative RMSE terms, making the change in hyperparameters statistically insignificant. This variance justifies our choice of PINN with 3 × 30 neurons using tanh activation.
It is worth noting that the prior studies [22,23] have used hybrid neural network–metaheuristic frameworks for reliability and survival analysis. In contrast, our study introduces a PINN formulation tailored to the FHN reaction–diffusion system, with an efficient, validated, and systematically optimized PINN framework. The study achieved several key advancements in applying PINNs to the FHN system. It systematically explored hyperparameters, analyzing activation functions, network architectures, and collocation point densities, revealing that increasing both network depth and collocation density significantly improved accuracy. Despite examining larger architectures, the final model of three layers with 30 neurons struck a balance between accuracy and computational efficiency, requiring only approximately 85 s of GPU training, demonstrating that moderately sized PINNs can deliver highly accurate solutions without extensive resources. A two-stage optimization strategy combining Adam and L-BFGS enhanced convergence stability, with Adam providing global search and L-BFGS refining local minima, resulting in smoother and more precise final solutions. The robustness of the approach was verified across ten random seeds, showing a relative RMSE variance of about 35% and indicating consistent performance with low sensitivity to initialization. Comparative validation against both analytical solutions and the EFDM confirmed that the PINN accurately reproduced the expected dynamics of the FHN system. Finally, the study demonstrated that accuracy scales predictably with model complexity, as RMSE improved monotonically with increasing network depth and collocation point density, highlighting the method’s scalability and providing valuable insights for potential extensions to higher-dimensional or more complex reaction–diffusion systems.
The accuracy of the numerical results for two FHN equation test problems generated using the EFDM and PINN approach is compared to the analytical solutions presented in the literature in this research.

5. Numerical Results and Discussion

To illustrate the accuracy of the EFD scheme and PINN approach, several numerical computations are carried out for two test problems.
Test Problem 1: Consider the FHN Equation (1b) with the initial condition
u x , t = 0 = 1 2 + 1 2 t a n h x 2 2 , 10 x 10
and boundary conditions
u x = 10 , t = 1 2 + 1 2 t a n h 1 2 2 ( 10 2 μ 1 2 t ) ,         0 < t T
u x = 10 , t = 1 2 + 1 2 t a n h 1 2 2 ( 10 2 μ 1 2 t ) ,         0 < t T
The analytical solution of the problem is given as [11]
u x , t = 1 2 + 1 2 t a n h 1 2 2 ( x 2 μ 1 2 t )
Equation (12) represents a traveling-wave solution, where the hyperbolic tangent describes a wavefront moving through space over time. Such a solution is characteristic of excitable media, where a localized disturbance propagates as a pulse or wave—exactly what the FHN model captures in nerve impulse transmission or cardiac excitation.
Equation (4b) represents the EFD solution of this test problem; the initial condition (10) in terms of finite differences becomes
  u i 1 = 1 2 + 1 2 t a n h x i 2 2 ,       10 x i 10 ,       i = 1,2 , , K       ( t = 0 )
and boundary conditions (11) are given as
            u 1 j = 1 2 + 1 2 t a n h 1 2 2 ( 10 2 μ 1 2 t j ) ,           j = 1,2 , , M       ( x = 10 )
            u K j = 1 2 + 1 2 t a n h 1 2 2 ( 10 2 μ 1 2 t j ) ,             j = 1,2 , , M       ( x = 10 )
The comparison of the numerical solutions to Test Problem 1 obtained by the EFDM (step lengths are Δx = 0.5 and Δt = 0.0001) and PINN with the analytical solution (12) at different times T, by taking the parameter μ = 0.75 , is shown in Table 1 (for T = 0.1), Table 2 (for T = 3), and Table 3 (for T = 5). Table 4 displays the accuracy of the EFDM and PINN in solving Test Problem 1 at various points in time, where the shown root mean square error is calculated as
E r r o r = 1 N i = 1 K u i m e t h o d u i a n a l y t i c a l 2
where K is the total number of observed points along the x axis.
For FHN Equation (1a), there are three Courant–Friedrichs–Lewy (CFL)-like constraints: (i) diffusion CFL: r = α t / ( x ) 2 0.5 ; (ii) advection CFL: D = β t / x 1 ; and (iii) reaction CFL: t 1 / ( γ max f u ) , where f u = d f ( u ) / d u and f u = γ u ( u μ ) ( 1 u ) . For Δx = 0.5 and Δt = 0.0001, the numeric bounds are α 1250 , β 5000 , and γ 10 4 . Beyond these stability limits, the numerical solution blows up, or one will also often see high-frequency spatial oscillations before blow-up.
In the EFDM calculation, the spatial step Δx = 0.5 and time step Δt = 0.0001 were chosen to ensure both accuracy and stability. The small spatial step allows the steep wavefront to be resolved precisely, while the time step satisfies the CFL condition for explicit schemes, preventing numerical instability. These values ensure that the numerical solution converges to the true solution without introducing significant errors, while still keeping computational costs manageable, providing a good balance between resolution, stability, and efficiency. Further reducing Δt and Δx did not lead to an improvement in the accuracy of the numerical solution.
In order to make the PINN implementation clearer, we give here the exact equation for the loss function:
LOSS   =   weight _ pde · u t α 2 u x 2 β u x γ u ( u μ ) ( 1 u )   [ whole   doman ] +   weight _ bc · u μ 2 + μ 2 · tanh μ 2 ( x 3 μ sin t )   [ on   boundary ] +   weight _ ic · 0.5 + 0.5 · tanh x 2 2   [ on   initial ]
For the sake of reproducibility, we provide the Python code on GitHub (https://github.com/imilos/FHN-efdm-pinn) (accessed on 20 October 2025).
Although a good agreement between our numerical solutions and analytical solution can be seen, it is important to emphasize that the PINN provides a better fit with the analytical solution. Figure 2 provides a further demonstration of the physical behavior of the EFD and PINN solutions to Test Problem 1 in 3-dim. Figure 3 shows a heatmap of the predicted solution u(x, t) over the full space–time domain for Test Problem 1.
Test Problem 2: Consider the FHN Equation (1a) with α t = cos t ,   β t = cos t ,   γ t = 2 cos t , the initial condition
u x , t = 0 = μ 2 + μ 2 t a n h μ x 2 , 10 x 10
and boundary conditions
u x = 10 , t = μ 2 + μ 2 t a n h μ 2 ( 10 3 μ sin t ) ,       0 < t T
u x = 10 , t = μ 2 + μ 2 t a n h μ 2 ( 10 3 μ sin t ) ,   0 < t T
The analytical solution of the problem is given as [8]
u x , t = μ 2 + μ 2 t a n h μ 2 ( x 3 μ sin t )
Test Problem 2 models a traveling wave in an excitable medium that oscillates periodically over time, capturing how signals or disturbances can speed up, slow down, or reverse under rhythmic forcing. This behavior appears across many real-world systems: in neuroscience, it reflects neurons responding to periodic inputs, influencing spike timing and synchronization; in cardiac tissue, it represents pacemaker-driven excitation waves and helps study arrhythmias; in chemistry, it describes oscillating reaction fronts under external forcing, such as in Belousov–Zhabotinsky reactions; in ecology, it models population waves affected by seasonal or cyclical environmental changes; and in engineering and materials science, it illustrates nonlinear wave propagation in semiconductors, plasmas, or memristive devices under periodic driving. Overall, the problem provides a controlled setting to test numerical and machine learning methods on non-stationary, periodically forced waves, linking mathematical theory to practical excitable systems.
The EFD solution of this test problem is given as
u i j + 1 u i j t = cos t j u i + 1 j 2 u i j + u i 1 j x 2 cos t j u i + 1 j u i 1 j 2 x 2 cos t j u i j 3 u i j 2 1 + μ + μ u i j
                u i j + 1 = u i 1 j cos t j t 2 x + cos t j t x 2 + u i j 1 2 cos t j t x 2 2 μ cos t j t   2 cos t j t u i j 3 + 2 u i j 2 1 + μ cos t j t + u i + 1 j cos t j t 2 x + cos t j t x 2
The initial condition (16) in terms of finite differences becomes
u i 1 = μ 2 + μ 2 t a n h μ x i 2 ,       10 x i 10 ,       i = 1 ,   2 , , K       ( t = 0 )
and boundary conditions (17) are given as
u 1 j = μ 2 + μ 2 t a n h μ 2 10 3 μ sin t j ,           j = 1 ,   2 , , M       ( x = 10 )
  u K j = μ 2 + μ 2 t a n h μ 2 10 3 μ sin t j ,             j = 1 ,   2 , , M       ( x = 10 )
One should mention that we used one-sided second-order differences for the advection term at two boundaries, in the following form:
u x , t x i = 1 = ( 3 u 1 + 4 u 2 u 3 ) / ( 2 x )
and
u x , t x i = K = ( 3 u K 4 u K 1 + u K 2 ) / ( 2 x )
where u 1 and u K are given in Equation (20a) and Equation (20b), respectively. Compared to the alternative choice of ghost nodes, one-sided second-order differences provide a much better propagation, preserving amplitude and speed. The truncation error for the difference Equation (21a,b) is O((Δx)2).
A comparison of the numerical solutions to Test Problem 2 obtained by the EFDM (step lengths are Δx = 0.5 and Δt = 0.0001) and PINN with the analytical solution (18) at different times T, by taking the parameter μ = 0.75 , is shown in Table 5 (for T = 0.001), Table 6 (for T = 0.01), and Table 7 (for T = 0.05). Further reducing Δt and Δx did not lead to an improvement in the accuracy of the numerical solution. Table 8 displays the accuracy of the EFDM and PINN in solving Test Problem 2 at various points in time. Although a good agreement between our numerical solutions and analytical solution can be seen, it is important to emphasize that the EFDM provides a better fit with the analytical solution. Figure 4 provides a further demonstration of the physical behavior of the EFD and PINN solutions to Test Problem 2 in 3-dim. Figure 5 shows a heatmap of the predicted solution u(x, t) over the full space–time domain for Test Problem 2.

6. Accuracy Assessment of EFDM and PINN

We conducted a brief grid/time refinement study for EFDM, using L2 error as a measure of accuracy:
L 2   e r r o r = 1 N i = 1 N ( u n u m e r i c a l ( x i ) u a n a l y t i c a l ( x i ) ) 2
In both test problems, the rates are approximately 2, as expected from the order of the problem being solved (see Table 9 and Table 10).
Figure 6 illustrates the integrated space–time L2 error plot for EFDM and PINN. One can see from Figure 6 that quite different patterns for space–time L2 error characterize EFDM and PINN. It can be seen that, for EFDM, areas with higher absolute error are concentrated towards higher values of t, while for PINN, the errors are evenly distributed. This happens because, in EFDM, the error accumulates due to the explicit time-stepping method, while in PINN, there is no classical time-stepping.
The phase error measures the timing/distance discrepancy in wave propagation. Figure 7 and Figure 8 show phase errors for traveling waves with front position x f ( t ) , for Test Problems 1 and 2, respectively, calculated using the following equation:
p h a s e e r r o r t = x f n u m e r i c a l t x f a n a l y t i c a l t
The EFDM requires 1.1 s to solve Test Problem 1 (T = 0.05) and 21 s to solve Test Problem 2 (T = 5). These computation times are significantly shorter than the 85 s required by the PINN approach. Unlike EFDM, the PINN framework does not employ a classical time-stepping scheme; therefore, its total computational time corresponds solely to the training time of the PINN.
In Test Problem 2, although we admit time-varying coefficients α(t), β(t), and γ(t), the tests still follow smooth traveling-wave tanh profiles. In general, using smooth traveling-wave profiles (e.g., tanh functions) with time-varying coefficients α(t), β(t), and γ(t) simplifies the FHN model, focusing on core dynamics like wave propagation and the effects of time-varying parameters, while avoiding the complexities of pulse formation and front interactions. Stiffer, multi-scale, or pattern-forming dynamics require more advanced numerical methods and greater computational resources, so avoiding them helps reduce complexity and computational cost. In many real-world applications, such as real-time simulations or large-scale modeling, smoother, simpler profiles are more practical. While pattern formation and front interactions are relevant in some biological contexts, many systems do not exhibit these behaviors unless under specific conditions. By starting with smoother dynamics, one aligns with more controlled experimental setups or theoretical models where the system behaves in a simpler, steady-state regime. Early testing with simpler cases ensures the accuracy of numerical methods, allowing one to scale up to more complex systems later. In cases like neural or cardiac modeling, where wave propagation is often smooth, focusing on smoother dynamics better represents these scenarios.
Finally, to the best of our knowledge, we compare the accuracy of the EFDM and improved PINN approach for solving the FHN equation in this work. We obtained that, for solving the FHN equation, the PINN approach demonstrates better accuracy than numerical solutions produced by EFDM. It should be noted that the PINN approach is one or even two orders of magnitude more computationally demanding than the EFDM. In our previous work, we demonstrated that the EFDM outperforms the PINN approach in terms of accuracy when solving Burgers’ equation [15] and the Sine-Gordon equation [16]. PINN outperforms EFDM for the FHN equation because its smooth, dissipative, and stiff nature aligns with the strengths of NN-based smooth approximations and global optimization. In contrast, Burgers’ and Sine–Gordon equations involve shocks or oscillatory conservative dynamics, where traditional numerical schemes better preserve sharp or oscillatory structures, while PINNs’ smooth approximators struggle [15,16]. The results of this study are particularly important for assessing the performance of the PINN in solving the FHN equation, especially for various nonlinear physical processes. These processes include phenomena such as pulse propagation in optical fibers, geophysical fluid dynamics, and long-wave propagation in both shallow and deep ocean environments. This highlights the potential of PINNs to handle complex, nonlinear systems, despite their initial limitations compared to EFDM. The PINN flowchart used in this work is shown in Figure 9.
Finally, while the classical FHN model captures the basic excitability of neurons and other excitable media, real-world systems are often far more complex. In such systems, singularities naturally arise due to the interplay of multiple timescales, strong nonlinearities, and spatial or network interactions. Fast–slow dynamics, for instance, create regions where the state variables change abruptly over very short spatial or temporal scales, producing boundary layers or spike bursts that cannot be captured by the simple smooth FHN equations. Discontinuous or piecewise nonlinearities further introduce singular points in the system, where the derivative of the response changes suddenly, modeling threshold-like behavior observed in real neurons, cardiac tissue, and chemical reactions. High-dimensional extensions of FHN, such as coupled networks or spatially extended reaction–diffusion systems, produce singular wave phenomena including spiral cores, wave collisions, and reentrant patterns, all of which play a central role in arrhythmias, seizure dynamics, and pattern formation in chemical media. In addition, stochastic perturbations or external forcing can amplify these singular behaviors, leading to complex phenomena like chaotic bursting or wavefront breakup. From a numerical standpoint, singularities present significant challenges. Standard explicit methods may become unstable or fail to resolve sharp gradients, while naive discretization can smear essential features of the solution. Accurate simulation requires adaptive time-stepping, mesh refinement, or specialized singular perturbation techniques, and these approaches must balance computational efficiency with the need to capture critical dynamical features. Ultimately, studying singular FHN-type models provides deeper insight into the rich dynamics of excitable systems, revealing mechanisms behind rhythmic bursting, conduction block, pattern formation, and nonlinear wave interactions that the classical smooth FHN model cannot represent. By incorporating singularities, these models bridge the gap between idealized theory and the complex behaviors observed in biology, chemistry, and materials science.

7. Conclusions

We compared the analytical solutions that had previously been reported in the literature with our numerical results for the solution of the nonlinear parabolic differential equation of the FHN type, which we obtained using the improved PINN and standard EFD approach. While both approaches provide good agreement with analytical solutions, our findings reveal that the PINN method aligns more closely with the analytical solutions in Test Problem 1, whereas the EFDM achieves higher accuracy in Test Problem 2. This study is key to assessing the PINN’s effectiveness in solving the FHN equation and its application to nonlinear phenomena, such as pulse dissipative dynamics in optical fibers, drug delivery, neural behavior, geophysical fluid dynamics, and long-wave propagation in oceans, showcasing the potential of PINNs for tackling complex systems. The principles underlying the methods of solution employed in this study may be used to create numerical models for nonlinear PDEs employed for the investigation of a wide range of nonlinear physical processes in physical and engineering problems.

Author Contributions

Conceptualization, S.S., M.I., and M.S.; methodology, software, M.I., S.S., and M.S.; writing—original draft preparation, S.S., M.I., and M.S.; writing—review and editing, S.S., and M.I.; supervision, S.S.; project administration, funding acquisition, M.I., and S.S. All authors have read and agreed to the published version of the manuscript.

Funding

Funding for this study is provided by the grants from the Serbian Ministry of Science, Technological Development, and Innovations (Agreement No. 451-03-137/2025-03/200122).

Data Availability Statement

The data presented in this study are available upon request from the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Cebrián-Lacasa, D.; Parra-Rivas, P.; Ruiz-Reynés, D.; Gelens, L. Six decades of the FitzHugh–Nagumo model: A guide through its spatio-temporal dynamics and influence across disciplines. Phys. Rep. 2024, 1096, 1–39. [Google Scholar] [CrossRef]
  2. Zemskov, E.P.; Tsyganov, M.A.; Ivanitsky, G.R.; Horsthemke, W. Solitary pulses and periodic wave trains in a bistable FitzHugh-Nagumo model with cross diffusion and cross advection. Phys. Rev. E 2022, 105, 014207. [Google Scholar] [CrossRef] [PubMed]
  3. Arora, S.; Kumar, R. Application of Haar-scale-3 wavelet collocation method to the solution of Fitzhugh–Nagumo non-linear partial differential equation. Res. Math. 2025, 12, 2463183. [Google Scholar] [CrossRef]
  4. Aychluh, M.; Suthar, D.L.; Purohit, S.D. Analysis of the nonlinear Fitzhugh–Nagumo equation and its derivative based on the Rabotnov fractional exponential function. Partial. Differ. Equ. Appl. Math. 2024, 11, 100764. [Google Scholar] [CrossRef]
  5. Rufai, M.A.; Kosti, A.A.; Anastassi, Z.A.; Carpentieri, B. A new two-step hybrid block method for the FitzHugh–Nagumo model equation. Mathematics 2024, 12, 51. [Google Scholar] [CrossRef]
  6. Ahmad, I.; Ahsan, M.; Din, Z.U.; Masood, A.; Kumam, P. An efficient local formulation for time-dependent PDEs. Mathematics 2019, 7, 216. [Google Scholar] [CrossRef]
  7. Abd-Elhameed, W.M.; Alqubori, O.M.; Atta, A.G. A collocation procedure for the numerical treatment of FitzHugh–Nagumo equation using a kind of Chebyshev polynomials. AIMS Math. 2025, 10, 1201–1223. [Google Scholar] [CrossRef]
  8. Akkoyunlu, C. Compact finite differences method for FitzHugh-Nagumo equation. Univers. J. Math. Appl. 2019, 2, 180–187. [Google Scholar] [CrossRef]
  9. Yang, R.; Li, H. Numerical analysis of the stochastic FitzHugh–Nagumo model driven by multiplicative noise based on the spectral Galerkin method. Results Appl. Math. 2024, 23, 100477. [Google Scholar] [CrossRef]
  10. Dehghan, M.; Heris, J.M.; Saadatmandi, A. Application of semi-analytic methods for the Fitzhugh-Nagumo equation, which models the transmission of nerve impulses. Math. Methods Appl. Sci. 2010, 33, 1384–1398. [Google Scholar] [CrossRef]
  11. Ramos, H.; Kaur, A.; Kanwar, V. Using a cubic B-spline method in conjunction with a one-step optimized hybrid block approach to solve nonlinear partial differential equations. Comput. Appl. Math. 2022, 41, 34. [Google Scholar] [CrossRef]
  12. Cai, L.; Sun, Y.; Jing, F.; Li, Y.; Shen, X.; Nie, Y. A fully discrete implicit-explicit finite element method for solving the FitzHugh-Nagumo model. J. Comput. Math. 2020, 38, 469–486. [Google Scholar] [CrossRef]
  13. Fu, J.; Yu, X.; Zhang, X.-Y.; Fang, Q. A sixth-order compact finite difference framework for solving nonlinear reaction-diffusion equations: Application to FitzHugh-Nagumo model. AIMS Math. 2025, 10, 21040–21060. [Google Scholar] [CrossRef]
  14. Raissi, M.; Perdikaris, P.; Karniadakis, G.E. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. J. Comput. Phys. 2019, 378, 686–707. [Google Scholar] [CrossRef]
  15. Savović, S.; Ivanović, M.; Min, R. A Comparative study of the explicit finite difference method and physics-informed neural networks for solving the Burgers’ equation. Axioms 2023, 12, 982. [Google Scholar] [CrossRef]
  16. Savović, S.; Ivanović, M.; Drljača, B.; Simović, A. Numerical solution of the Sine-Gordon equation by physics-informed neural networks and two different finite difference methods. Axioms 2024, 13, 872. [Google Scholar] [CrossRef]
  17. Fu, E. Dynamics of the FitzHugh-Nagumo equation with numerical methods. Theor. Nat. Sci. 2023, 10, 179–185. [Google Scholar] [CrossRef]
  18. Raissi, M.; Perdikaris, P.; Karniadakis, G.E. Physics informed deep learning (part I): Data-driven solutions of nonlinear partial differential equations. arXiv 2017, arXiv:1711.10561. [Google Scholar] [CrossRef]
  19. Bono, F.M.; Radicioni, L.; Cinquemani, S. A comparison between regular and physics-informed neural networks based on a numerical multibody model: A test case for the synthesis of mechanisms. In Proceedings of the SPIE Smart Structures + Nondestructive Evaluation, Long Beach, CA, USA, 12–17 March 2023; Volume 12489, p. SP-124890L. [Google Scholar] [CrossRef]
  20. Lu, L.; Meng, X.; Mao, Z.; Karniadakis, G.E. Deepxde: A deep learning library for solving differential equations. arXiv 2019, arXiv:1907.04502. [Google Scholar] [CrossRef]
  21. Markidis, S. The old and the new: Can physics-informed deep-learning replace traditional linear solvers? Front. Big Data 2021, 4, 669097. [Google Scholar] [CrossRef]
  22. Mushref, O.M.; Kurnaz, S.; Hussain, A.S.; Sadek, L.; Hashim, A.M.; Tashtoush, M.A. A hybrid firefly-Bayesian Neural Network approach for survival and reliability estimation in non-homogeneous Poisson processes. Sci. Afr. 2025, 30, e03011. [Google Scholar] [CrossRef]
  23. HHussein, R.; Hussein, S.R.; Hussain, A.S.; Tashtoush, M.A. Estimating parameters of Software Reliability Growth Models using Artificial Neural Networks optimized by the Artificial Bee Colony algorithm based on a novel NHPP. Math. Model. Eng. Probl. 2025, 12, 25–36. [Google Scholar] [CrossRef]
Figure 1. Schematic of a PINN and its training loop for solving a simple PDE. “PDE” and “Cond” represent the governing equations, while “R” and “I” denote the residuals. The residual network, a non-trainable component, computes derivatives of the approximator network’s outputs and produces the composite MSE loss function.
Figure 1. Schematic of a PINN and its training loop for solving a simple PDE. “PDE” and “Cond” represent the governing equations, while “R” and “I” denote the residuals. The residual network, a non-trainable component, computes derivatives of the approximator network’s outputs and produces the composite MSE loss function.
Computation 13 00275 g001
Figure 2. (a) EFD and (b) PINN solutions of Test Problem 1 in 3-dim at different times.
Figure 2. (a) EFD and (b) PINN solutions of Test Problem 1 in 3-dim at different times.
Computation 13 00275 g002
Figure 3. Heatmap of the solution u(x, t) obtained using (a) EFDM and (b) PINN for Test Problem 1 over the domain x ∈ [−10, 10], t ∈ [0, 5].
Figure 3. Heatmap of the solution u(x, t) obtained using (a) EFDM and (b) PINN for Test Problem 1 over the domain x ∈ [−10, 10], t ∈ [0, 5].
Computation 13 00275 g003aComputation 13 00275 g003b
Figure 4. (a) EFD and (b) PINN solutions of Test Problem 2 in 3-dim at different times.
Figure 4. (a) EFD and (b) PINN solutions of Test Problem 2 in 3-dim at different times.
Computation 13 00275 g004
Figure 5. Heatmap of the solution u(x, t) obtained using (a) EFDM and (b) PINN for Test Problem 2 over the domain x ∈ [−10, 10], t ∈ [0, 0.05].
Figure 5. Heatmap of the solution u(x, t) obtained using (a) EFDM and (b) PINN for Test Problem 2 over the domain x ∈ [−10, 10], t ∈ [0, 0.05].
Computation 13 00275 g005
Figure 6. The integrated space–time L2 error plot for Test Problems 1 and 2 obtained using EFDM and PINN.
Figure 6. The integrated space–time L2 error plot for Test Problems 1 and 2 obtained using EFDM and PINN.
Computation 13 00275 g006
Figure 7. Average phase error for the wavefront position for Test Problem 1 (0.001984 for EFDM and 0.000205 for PINN). Analytical solution for the wavefront position is x a n a l y t i c a l = ( ( 2 μ 1 ) / 2 )t.
Figure 7. Average phase error for the wavefront position for Test Problem 1 (0.001984 for EFDM and 0.000205 for PINN). Analytical solution for the wavefront position is x a n a l y t i c a l = ( ( 2 μ 1 ) / 2 )t.
Computation 13 00275 g007aComputation 13 00275 g007b
Figure 8. Average phase error for the wavefront position for Test Problem 2 (0.000109 for EFDM and 0.000035 for PINN). Analytical solution for the wavefront position is x a n a l y t i c a l = ( 3 μ ) s i n ( t ) .
Figure 8. Average phase error for the wavefront position for Test Problem 2 (0.000109 for EFDM and 0.000035 for PINN). Analytical solution for the wavefront position is x a n a l y t i c a l = ( 3 μ ) s i n ( t ) .
Computation 13 00275 g008
Figure 9. Illustration of the PINN flowchart.
Figure 9. Illustration of the PINN flowchart.
Computation 13 00275 g009
Table 1. Comparison of numerical and analytical solutions of Test Problem 1 for T = 0.1.
Table 1. Comparison of numerical and analytical solutions of Test Problem 1 for T = 0.1.
xEFDM SolutionPINN SolutionAnalytical Solution
−100.0008280.0008380.000828
−80.0033970.0033990.003396
−60.0138270.0138170.013821
−40.0545130.0545110.054504
−20.1916260.1916560.191667
00.4937460.4937550.493750
20.8005110.8004880.800467
40.9428570.9428390.942861
60.9854760.9854970.985481
80.9964380.9964150.996431
100.9991300.9991450.999130
Table 2. Comparison of numerical and analytical solutions of Test Problem 1 for T = 3.
Table 2. Comparison of numerical and analytical solutions of Test Problem 1 for T = 3.
xEFDM SolutionPINN SolutionAnalytical Solution
−100.0004010.0004170.000401
−80.0016650.0016490.001648
−60.0067850.0067380.006743
−40.0271840.0271600.027167
−20.1027290.1029860.103029
00.3204700.3208000.320865
20.6609920.6601710.660252
40.8890340.8887620.888809
60.9703070.9704740.970483
80.9925150.9926620.992660
100.9982060.9982120.998206
Table 3. Comparison of numerical and analytical solutions of Test Problem 1 for T = 5.
Table 3. Comparison of numerical and analytical solutions of Test Problem 1 for T = 5.
xEFDM SolutionPINN SolutionAnalytical Solution
−100.0002430.0002150.000243
−80.0010130.0010200.001000
−60.0041310.0040950.004101
−40.0166840.0166550.016654
−20.0649790.0651100.065126
00.2222970.2226920.222721
20.5417190.5409590.540991
40.8297140.8289830.828999
60.9521570.9522660.952246
80.9877840.9879580.987955
100.9970450.9970380.997045
Table 4. The accuracy of EFDM and PINN of Test Problem 1 at different times T.
Table 4. The accuracy of EFDM and PINN of Test Problem 1 at different times T.
TError (EFDM)Error (PINN)
0.12.44 × 10−51.35 × 10−5
11.66 × 10−43.13 × 10−5
22.50 × 10−41.34 × 10−5
32.93 × 10−41.74 × 10−5
43.20 × 10−42.24 × 10−5
53.65 × 10−41.37 × 10−5
Table 5. Comparison of numerical and analytical solutions of Test Problem 2 for T = 0.001.
Table 5. Comparison of numerical and analytical solutions of Test Problem 2 for T = 0.001.
xEFDM SolutionPINN SolutionAnalytical Solution
−100.0004140.0004170.000414
−80.0018510.0018430.001851
−60.0082260.0082290.008226
−40.0355120.0355230.035512
−20.1366300.1366340.136630
00.3746850.3746050.374684
20.6129920.6130800.612992
40.7143730.7142950.714373
60.7417450.7418060.741746
80.7481420.7481140.748142
100.7495850.7495900.749585
Table 6. Comparison of numerical and analytical solutions of Test Problem 2 for T = 0.01.
Table 6. Comparison of numerical and analytical solutions of Test Problem 2 for T = 0.01.
xEFDM SolutionPINN SolutionAnalytical Solution
−100.0004080.0004090.000408
−80.0018230.0018150.001824
−60.0081030.0081050.008104
−40.0349990.0350130.035002
−20.1349360.1349450.134942
00.3718520.3717600.371836
20.6112840.6113690.611283
40.7138480.7137770.713854
60.7416180.7416810.741621
80.7481100.7480880.748114
100.7495780.7495840.749578
Table 7. Comparison of numerical and analytical solutions of Test Problem 2 for T = 0.05.
Table 7. Comparison of numerical and analytical solutions of Test Problem 2 for T = 0.05.
xEFDM SolutionPINN SolutionAnalytical Solution
−100.0003810.0003780.000381
−80.0017040.0017010.001705
−60.0075760.0075810.007580
−40.0328020.0328280.032818
−20.1276080.1276360.127636
00.3592720.3591360.359196
20.6035070.6035710.603493
40.7114340.7113870.711461
60.7410330.7410970.741043
80.7479750.7479590.747983
100.7495490.7495510.749549
Table 8. The accuracy of EFDM and PINN of Test Problem 2 at different times T.
Table 8. The accuracy of EFDM and PINN of Test Problem 2 at different times T.
TError (EFDM)Error (PINN)
0.0014.2640 × 10−74.7383 × 10−5
0.015.7604 × 10−64.6345 × 10−5
0.052.6836 × 10−54.1321 × 10−5
Table 9. Convergence analysis for Test Problem 1.
Table 9. Convergence analysis for Test Problem 1.
GridΔxL2 ErrorRate
Δx, Δt1.0005.04 × 10−3-
Δx/2, Δt/20.5001.03 × 10−32.28
Δx/4, Δt/40.2503.10 × 10−41.74
Table 10. Convergence analysis for Test Problem 2.
Table 10. Convergence analysis for Test Problem 2.
GridΔxL2 ErrorRate
Δx, Δt1.000 2.17 × 10−4-
Δx/2, Δt/20.5006.18 × 10−51.81
Δx/4, Δt/40.2501.61 × 10−51.94
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ivanović, M.; Savović, M.; Savović, S. An Improved Physics-Informed Neural Network Approach for Solving the FitzHugh–Nagumo Equation. Computation 2025, 13, 275. https://doi.org/10.3390/computation13120275

AMA Style

Ivanović M, Savović M, Savović S. An Improved Physics-Informed Neural Network Approach for Solving the FitzHugh–Nagumo Equation. Computation. 2025; 13(12):275. https://doi.org/10.3390/computation13120275

Chicago/Turabian Style

Ivanović, Miloš, Matija Savović, and Svetislav Savović. 2025. "An Improved Physics-Informed Neural Network Approach for Solving the FitzHugh–Nagumo Equation" Computation 13, no. 12: 275. https://doi.org/10.3390/computation13120275

APA Style

Ivanović, M., Savović, M., & Savović, S. (2025). An Improved Physics-Informed Neural Network Approach for Solving the FitzHugh–Nagumo Equation. Computation, 13(12), 275. https://doi.org/10.3390/computation13120275

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop