Abstract
This paper presents a novel approach to the controllability of nonlinear dynamic systems using recurrent neural networks (RNNs). We develop a comprehensive theoretical framework that integrates controllability analysis, stability verification via Lyapunov functions, and the derivation of optimal control laws based on Pontryagin’s Maximum Principle. Our methodology not only ensures theoretical soundness but also offers practical effectiveness. To demonstrate its applicability, we conduct simulations using real-world data from the AAPL stock database. The proposed RNN-based control framework significantly reduces the deviation between predicted system outputs and actual observations. We further enhance performance through two complementary strategies, a direct control method and a parameter optimization approach, both of which contribute to the accuracy and adaptability of the control system. These results confirm the potential of neural network-based control in managing complex nonlinear dynamics
Keywords:
dynamical systems; controllability; stability; recurrent neural networks; Lyapunov function; Pontryagin’s Maximum Principle; optimization; price prediction MSC:
35B35; 35Q93; 37N35; 93B18; 93B52; 93B70; 93C10; 68T07
1. Introduction
Let us consider the following model of dynamical neural networks:
where n corresponds to the number of units in the neural network; represents the state of the unit at time t; is the activation function of the neuron at time t; denotes the self-inhibition rate; indicates the strength of the connection from the neuron to the ith neuron; and the external bias on the neuron. This model assumes that the connection matrix is symmetric such that
To simplify the notation, system (1) can be written using the vector–matrix form as follows:
where
In the present work, our objective is to control the nonlinear dynamic system (1) via recurrent neural networks (RNNs); we use the term RNNs to refer to all recurrent architectures. Specifically, we employed a Long Short-Term Memory (LSTM) model in our simulations, as it effectively captures long-term temporal dependencies. The dynamics of the system defined by (1) are affected by nonlinear activation functions and parameters such that the positive values of reflect aggregates j whose net average effect on aggregate i is excitatory and negative values correspond to inhibition. Due to the complexity of the dynamics, our system encounters both theoretical challenges, particularly in analyzing stability and controllability, and practical challenges, as financial systems often exhibit nonlinear and intricate behaviors that limit the effectiveness of traditional control methods.
This kind of problem was first introduced by McCulloch and Pitts [1], who proposed a theoretical basis founded on a logical model of formal neurons. In 1982, Hopfield introduced a continuous recurrent network, possessing dynamic properties, with symmetric connections and nonlinear activation functions [2,3]. These networks constitute a particular class of neural networks, known today as Hopfield networks, which are capable of converging to equilibrium states. Three years later, Hopfield’s contribution [4], which focuses on stability and equilibrium properties, paved the way for a rich and diverse literature. In the same vein, Yang and Chua examined the stability of continuous nonlinear neural networks with asymmetric connection weights [5,6], offering a natural extension of these dynamic architectures. Following these works, several studies have been dedicated to the theoretical analysis of these networks. The study of the existence and uniqueness of solutions, as well as convergence and stability, has been the subject of numerous research studies [7,8,9,10]. These studies have demonstrated that under precise conditions on the connection weights and activation functions, particularly bounded functions, Hopfield networks converge towards stable equilibria. Results on local stability in more complex contexts, like systems with time delays or asymmetric connections, have also been presented by a number of studies [11,12].
In parallel, Kaslik and Balint [13] investigated the controllability of Hopfield networks, demonstrating that classical control theory can be applied by deriving explicit conditions under which traditional control strategies successfully guide the system toward desired states. Following this line of work, several studies have established rigorous stability results for continuous Hopfield networks using Lyapunov theory [14,15]. Recent developments in machine learning have made it possible to include optimization methods in Hopfield network analysis and control. Specifically, backpropagation algorithms [16,17] and their expansions to multi-agent systems [18], which deal with decentralized learning and nonlinear filtering, have aided in bridging the gap between artificial intelligence and mathematical analysis. Other studies have focused on parameter estimation, with Zhenning and Balakrishnan [19] making a significant contribution by suggesting estimation techniques that enable Hopfield networks to adjust to real-world scenarios. Their approach is based on linearization and a cost function that is comparable to Hopfield neural networks’ energy function.
Furthermore, Hopfield networks have demonstrated immense potential in many kinds of application areas, with finance being one of the most prevalent. Price forecasting and dynamic market modeling were the main topics of early research in this discipline [20,21]. Works addressing portfolio optimization using Hopfield-based techniques quickly followed these [22,23]. In order to capture richer dynamics and improve memory capacity and convergence qualities, the framework has more recently been expanded to fractional models [24].
In this paper, based on the previous research we combine these theoretical and practical approaches, and we examine this type of system by integrating a control function based on RNNs. Our main contributions are listed below:
- 1.
- The global asymptotic stability of system (1) using the Lyapunov function is proved.
- 2.
- The Pontryagin Maximum Principle (PMP) is applied to determine the optimal control function, which is the cost function used to minimize the variation between the real and the desired outputs.
- 3.
- An illustrative example is given to validate our findings.
- 4.
- An application part is dedicated to simulating our system using financial data; two approaches are used to estimate our parameters:
- (a)
- Direct approximation based on traditional regression methods.
- (b)
- Optimization using a gradient descent method to refine parameter estimates.
To enhance the control of our system, we integrate recurrent neural networks, enabling adaptation to time-varying behaviors and nonlinear dynamics commonly observed in financial systems.
Our research demonstrates the effectiveness of RNNs in controlling and stabilizing system (1), specifically in the context of financial simulation, by combining theoretical analysis with practical simulations. Although we primarily focused on developing the theoretical framework and using simulation to validate it, we admit that a comparative quantitative analysis with current state-of-the-art methods, including Deep Reinforcement Learning (DRL) and Model Predictive Control (MPC), would offer a more transparent benchmarking of performance. The conclusion addresses this constraint and sets the stage for further research that compares these approaches in the same experimental setup.
The remainder of this paper follows this organization: Section 2 presents the preliminaries, including a detailed description of the system and an analysis of equilibrium points, stability, controllability, and the Pontryagin Maximum Principle. Section 3 focuses on the study of controllability and stability for both linear and nonlinear systems. Section 4 is dedicated to applying our findings to a financial dataset and is divided into three parts. First, we derive the explicit expression of the optimal control function using the Pontryagin Maximum Principle. Second, we present a concrete example in which the optimal control formula is applied and its results are compared with those obtained through neural network-based controllability. Finally, we explore the use of neural networks for financial simulations using data from AAPL, the stock symbol for Apple Inc., which includes historical share prices traded on the NASDAQ exchange. This paper concludes with a discussion of the results and a summary of this study’s main contributions.
2. Preliminaries
Let be an n-dimensional Euclidean space with norm . We then consider the following dynamic neural network model:
Throughout this paper, we make the following assumptions about the system parameters and activation functions to ensure that the model is well defined and stable.
(H1):
The coefficients and are strictly positive.
(H2):
is a continuous function, such as ,
(H3):
The activation functions verify the following:
- 1.
- There exists a positive constant such that for any u and v in , with u different from v;
- 2.
- There exists a positive constant such that for any u in .
- 3.
- for .
- 4.
- The derivative of f at u is positive and .
Remark 1.
- The assumptions – ensure the stability of the model and guarantee that the system exhibits well-defined behavior; that is to say, it does not display unbounded growth, non-monotonicity, or irregular derivative patterns. For more details, see [9].
- According to [7], the initial condition associated with system (1) is of the form for all in which are continuous for , which is essential for the stability analysis based on the system initial conditions.
We will use the following definitions in our paper:
Definition 1
(see [25]). The equilibrium point is said to be as follows:
- 1.
- Stable if, given any real number , there exists a real number such that all solutions satisfy
- 2.
- Asymptotically stable (a.s) if it is stable and there is a real number such that whenever .
- 3.
- Globally asymptotically stable (g.a.s) if it is asymptotically stable and if every solution of (1) tends to as t approaches infinity for any initial condition.
Proposition 1
(see [25]). System (2) is stable if and only if the real part of every eigenvalue of the matrix A is less than or equal to zero and for any eigenvalue with algebraic multiplicity k, the dimension of the associated eigenspace is equal to k; that is, .
Let us consider states with values in and a value control in a closed non-empty subset U included in . The set of admissible controls is the subset .
Let the following problem be defined by
An example is
The goal is to identify the best control that minimizes the criterion
Prior to defining Pontryagin’s Maximum Principle (PMP), we need to define the Hamiltonian function.
Definition 2
(see [26]). The Hamiltonian associated with the optimal control system is the application
To prove the existence of , we need the assumptions stated in the following lemma, which guarantee that the problem (3) admits a unique global solution. Moreover, the assumptions on and v ensure that the cost is well defined for any control and that the minimum of J over U is finite.
Lemma 1
(see [26]). Assume the following:
- 1.
- g is a function that belongs to the class and g is of class relative to x;
- 2.
- There exists a positive constant L such that, at any time , for any vector x in and for any admissible control u in , the norm of is bounded by ;
- 3.
- For any positive radius r, there is a positive constant such that, at any time , any vector x within the closed ball of radius r centered at 0, and any admissible control u in , the norm of the partial derivative of g with respect to x is bounded by ;
- 4.
- For any positive radius R, there is a positive constant such that, at any time t in , any vector x within the closed ball of radius R centered at 0, and any admissible control , the norm of v is bounded by ;
- 5.
- The functions ψ and v are, respectively, lower-bounded on and ;
- 6.
- The function v belongs to the class and it is of class relative to x;
- 7.
- For any positive radius a, there is a positive constant such that, at any time , any vector x within the closed ball of radius a centered at 0, and any admissible control , the norm of the partial derivative of v with respect to x is bounded by .
Then, problem (3) has a unique global solution, and for all u in , the cost is well defined.
Theorem 1
(Pontryagin’s Maximum Principle, see [26]). Let us consider the optimal control problem given by
and assume that the hypotheses of Lemma 1 are satisfied, assuming is an optimum control and is the corresponding optimal trajectory. The adjoint vector is an application of
that is perfectly continuous such that
Additionally, if the final time is free, we have .
3. Stability of Linear and Nonlinear Systems
In this section, we will recall some stability results of the considered system in both the linear and nonlinear cases.
3.1. Linear System
Building on the second part of [27], together with the results in [15,25] the main findings for the linear case of our system can be summarized as follows. Throughout this subsection, we focus on . We consider the dynamics of the state variable , which evolves according to the following differential system:
where and . Using the method of variation of constants, the solution of (5) is
where denotes the resolvent matrix of the homogeneous system.
Definition 3
(see [27]). The resolvent of the homogeneous linear continuous system is defined as the solution of the following Cauchy problem:
where is the system matrix (also called the coefficient matrix) that defines the dynamics of the linear system.
We examine a particular case of the model described in (1), where for every unit j. Under this assumption, Equation (2) is simplified to
where .
From the standard theory of linear systems, we can deduce that, given initial conditions , and assuming that no eigenvalue of B equals 1, the solution of (6) is given by
The system admits a unique equilibrium point, which is
Moreover, this equilibrium is globally asymptotically stable [10], meaning that for any initial state , the solution converges to as , provided that the real parts of all eigenvalues of B are less than 1.
3.2. Nonlinear System
The local asymptotic stability of system (1) is studied using a Lyapunov function specifically constructed for this model. This function satisfies the classical stability conditions: it is positive definite, and its derivative along the system trajectories is strictly negative in the vicinity of the equilibrium state. This analysis allows us to conclude that, when the initial condition is located within a certain region of attraction, the trajectories of the system converge asymptotically towards the equilibrium state, thus indicating local stability.
We first determine the equilibrium point, and then we analyze the local stability around this point. The following proposition establishes the existence and uniqueness of this equilibrium point for system (1).
Proposition 2.
Let be positive numbers such that
Then the system of nonlinear equations
has a unique equilibrium solution for each .
Proof.
Consider the mapping
such that and .
We shall prove that C is a contraction mapping; then it will follow by the contraction mapping that the map C has a unique fixed point. Let ; we then have
Then the mapping C is a contraction and thus has a unique fixed point.
Let . It is not difficult to proove that , where is a solution of system (7). The uniqueness of is a consequence of the contraction mapping principle.
Simplifying (1) and (7), we obtain
for which the trivial solution is an equilibrium solution; thus the stability of the equilibrium corresponds to that of the trivial solution of (7). □
We consider an energy function , inspired by the formalism proposed in [19], which will be used as a Lyapunov function. This function is given by
The positive definiteness of this Lyapunov function is ensured by the established results of Hopfield [2,3,4] for networks with symmetric connections.
We show in the following theorem that this function is bounded and its derivative with respect to time is strictly negative in the vicinity of the equilibrium state in order to consider it as a Lyapunov function, which allows us to ensure the global asymptotic stability of the system.
Theorem 2.
Let be the energy function of system (1). Then is a Lyapunov function if it satisfies the following conditions:
- 1.
- is bounded;
- 2.
- The derivative of the energy with respect to time is less than zero.
Proof.
- 1.
- The energy function given is bounded because the sigmoid function is used in the system as the output function, which limits the state variable to take a value within . Furthermore, the integral of the inverse is bounded.
- 2.
- The differential equation of with respect to time isSince we assumed that , we haveLet ; then we haveHence for all , the time derivative of the energy function is strictly negative , satisfying the condition for a Lyapunov function.
For , the model is locally asymptotically stable in accordance with Lyapunov. □
The theory of linearization of nonlinear functions states that a linear system around an equilibrium point can be used to simulate a nonlinear system. We choose, throughout this paper, the activation function as
Remark 2.
Using Sylvester relations, we determine the coefficients of the characteristic polynomial of the matrix. According to the works of [15,27], the stability of the system is guaranteed under certain conditions:
- 1.
- The coefficients are strictly positive for all i from 1 to n.
- 2.
- The coefficients are strictly superior to for all .
These conditions require that the terms be strictly positive, which is necessary to preserve the stability of the system.
4. Controllability and Stability via RNN Applied to Finance
This section is dedicated to studying the controllability and stability of the considered system using recurrent neural networks (RNNs), followed by an application to a financial example. We begin by presenting two fundamental lemmas in the study of the controllability of dynamical systems. Next we proceed to derive the expression of the optimal control under specific conditions as stated in Theorem 3. Subsequently, we analyze stability and controllability through a concrete example, illustrating state trajectories under various scenarios: without control, with optimal control, and with control estimated via an RNN. These scenarios are examined both with and without system linearization. Performance results, including mean absolute error (MAE) and loss function values, are presented in tabular form to facilitate comparison. Finally, to highlight the practical relevance of our approach, we conduct a financial simulation using the AAPL dataset, providing forecasts of future closing prices.
4.1. Controllability Conditions
These lemmas are fundamental for establishing a necessary and sufficient condition for the controllability of the system based on the invertibility of the Gramian matrix.
Lemma 2
(see [13]). The system is controllable on an interval if and only if the Gramian matrix is invertible, and the control that brings the system from the initial state to the desired state is
where .
Lemma 3
(see [27]). The following statements are equivalent:
- 1.
- The n-dimensional pair is controllable.
- 2.
- The matrixis non-singular for any .
- 3.
- The controllability matrix has a full row rank n.
- 4.
- The matrix has a full row rank at every eigenvalue λ of C.
- 5.
- If, in addition, all eigenvalues of C have negative real parts, then the unique solution ofis positive definite. The solution is called the controllability Gramian and can be expressed as follows: .
4.2. Optimal Control
We are interested in the following optimal control system:
which is equivalent to
where . Let and .
The following state equations where the control u is integrated can be used to characterize the dynamic behavior of the neuronal networks:
We are going to check that our system verifies the hypotheses of Lemma 1.
- 1.
- We take the sigmoid function as the activation function; according to Lemma 1, the first hypothesis is verified.
- 2.
- , , and ,Then , and we just take and .
- 3.
- Let us differentiate with respect to to obtain the following:
- ; then
- is bounded by .
Thus, for , . Then, there exists such that . - 4.
- , , , and
- 5.
- The functions and v are, respectively, lower-bounded on and .
- 6.
- This is clear since v is a quadratic function.
- 7.
- , , , and ,
Theorem 3.
Assume the following:
- 1.
- The conditions of Lemma 1 are fulfilled.
- 2.
- There exists a positive number M such that for any the integral of function is , satisfying
- 3.
- There exists a solution of (13) such that , where and .
- 4.
- The optimal time is defined bywhere K is a constant defined by and M depending on the problem.
Then there exists an optimal control written in the form .
Proof.
Using Pontryagin’s Maximum principle, we will determine the optimal control . On one hand, the Hamiltonian is given by
which is equivalent to
According to the PMP, the optimal control associated with the problem is
where
Since there are no constraints on the control, we have
which implies that
Then,
On the other hand,
which implies that
where is the optimal trajectory. So
According to Equation (3) of the system, we have
Then
Using the first and second equation of the system (15) and the last expression of , we have
which gives, after calculation,
where is the primitive of . Now let us determine the optimal time; the expression of (16) implies that
which is equivalent to
Then
By using the expression of , we deduce exactly . □
4.3. Illustrative Example
In the following, we present numerical simulations for a representative network example [9], where we take to be the sigmoid function throughout the applied part.
where , , , and =
The control of this nonlinear dynamic system is examined in this part using two distinct methodologies:
- A linear approach that incorporates the integration of the optimum control function formulation from the preceding section.
- A neural network-based approach to approximate system control.
The primary objectives of this study are to determine the stability of the system and the efficiency of the two approaches for bringing the system back to equilibrium. All the following numerical solutions were implemented using Python 3.13.0.
For this example, we followed these steps:
- Data collection: The data is generated digitally by integrating the dynamic system established by (17).
- Define a neural network to represent the control function: To approximate the control function u(t), a recurrent neural network (RNN) is used in order to ensure the stability of the system.
- Define the dynamic system and create a neural network for the system itself: A recurrent neural network is used to model the system (17), considering the temporal dynamics and the properties of the function.
- Train the neural networks: The networks are trained using 80% of the data in order to optimize the control function.
- Implement the feedback loop: This is conducted in order to correct deviations and guarantee convergence.
- Validation: To examine the robustness and stability of the control, we use 10% of the data.
Figure 1 represents the trajectories of the states and in the interval of time with and without control function. Meanwhile Figure 2 and Figure 3 represent both trajectories of the states and using recurrent neural networks, respectively, in the case of a linearized system and nonlinearized one. Based on these figures, we observe that using RNNs at some point stabilizes the system. Additionally, this method converges to the equilibrium state more rapidly than the other cases studied and performs more effectively than the linearized method.
Figure 1.
Trajectories of the states and , respectively, in the interval of time [0, 10] with and without control function.
Figure 2.
Trajectories of the states and , respectively, over the time interval [0, 10] with and without control using an RNN (linearized system).
Figure 3.
Trajectories of the states and , respectively, over the time interval [0, 5] with and without control using an RNN.
We will now examine how a system based on a neural network behaves differently in terms of controllability when linearization is used or not, and we will describe it in terms of loss and mean absolute error (MAE) (see Table 1 and Table 2). Next, we will examine the weights and biases of the neural network.
Table 1.
The performance results of the linearized system, which is controlled via an RNN.
Table 2.
The performance results of the system controlled via an RNN.
We find that using the neural network, the loss starts at a relatively low level and tends to decrease significantly over the epochs, and at the end of the training, the mean absolute error (MAE) decreases, indicating that the system has successfully converged to the equilibrium. Conversely, the values of the loss and the mean absolute error (MAE) for the neural networks with linearization start higher but decrease over the epochs. It can be said that the use of neural networks allows us to do without linearization, with initial loss and MAE values being quite significant. This approach manages to capture the relationships found in the data compared to the nonlinearized approach.
Now, we will discuss the adjusted values during weight and bias training.
The weights and biases across the layers, in both the linearized and nonlinearized models, exhibit relatively small magnitudes, indicating a moderate influence of each neuron on the next layer. For example, in the first layer, the weights approximately range between −0.27 and 0.21 for the nonlinearized model and between −0.3 and 0.3 for the linearized model. The biases in all layers range between −0.02 and 0.02, generally remaining close to zero.
This diversity suggests that the neurons learn relationships from the data and during training, demonstrating that the model captures complex relationships between inputs and outputs. On the other hand, because the weights are more concentrated, linearization simplifies the relationships learned by the model, which limits performance.
We can conclude that the observed losses ensure that both approaches will converge. Although the overall weight of the model without linearization seems more suitable to model relatively complex relationships for large amounts of data, the linearized model presents certain restrictions in terms of adaptability. This observation emphasizes the importance of carefully choosing which approach to use based on the advantages and disadvantages of each, depending on the type of data and the learning objectives.
4.4. Simulation
In this subsection, we conduct a simulation using the AAPL database, which records the historical prices of Apple’s stocks on financial markets and is available on Yahoo Finance [28]. This dataset includes several essential attributes for each trading day, such as the following:
- Date: The day on which each trading session’s data was recorded.
- Open: The price of AAPL at the start of the trading day.
- High: The AAPL stock’s highest price during the trading day.
- Low: The lowest price AAPL stock fell to during the trading day.
- Close: The price of AAPL stock at the end of the trading day.
- Volume: The total number of shares traded during the day.
- Adjusted Close: The closing price adjusted for dividends, stock splits, and other corporate actions.
This data is perfectly suited for modeling our dynamic system, as the nonlinear fluctuations in closing prices over time reflect the complex dynamics of our system [20,21,29]. Our objective is to integrate neural network-based control into this dynamic system in order to predict future closing prices of Apple stocks (). Using two distinct techniques to estimate the parameters, “direct approximation and optimization”, we then compare their ability to achieve the desired objective.
- Modeling of the dynamic system:
- 1.
- We model the dynamics of the system by considering the closing prices of stocks to represent the state of the system such that time t represents the number of days. The evolution of closing prices will be simulated through the interactions between these variables, which play a crucial role in the movement of stocks.
- 2.
- In this model, the parameters , , and will be estimated using two distinct approaches:
- Direct Approximation: In this approach, traditional regression techniques are applied to estimate the parameters from historical data. The interaction terms are obtained via linear regression. The external bias is estimated as the average of the training data, while the parameter represents the standard deviation of daily returns, reflecting the rate at which the stock price reverts to a stable state when external factors are absent.
- Optimization: In this method, we used optimization to adjust the parameters by minimizing the error between the actual closing prices and the model’s predictions. Gradient descent Algorithm 1 was employed to fine-tune , , and to achieve more accurate predictions.
- 3.
- After estimating the system parameters , , and , we then integrated a control function based on neural networks to obtain fairly accurate predictions. The model used in our experiment employed an RNN architecture, which is ideal for learning temporal dependencies among time series data. To train the network, we used a dataset consisting of 502 historical prices of stock. These data were distributed as follows:
- (401 samples) for training, allowing the model to learn the complex dynamics of the market.
- (50 samples) for validation, in order to evaluate the performance of the model during training and adjust its parameters.
- (51 samples) for testing, in order to measure the model ability to generalize and make predictions on data it has never seen before.
The neural network was trained on the historical prices of stocks to understand the complex market dynamics and make better predictions in the future.
| Algorithm 1 Gradient descent algorithm |
| Input: |
| The system parameters |
| Cost function: The difference between the actual and simulated output |
| learning rate |
| N number of iterations |
| Initialize: |
| for to N do |
| Calculate the gradient: |
| Update parameters: |
| end for |
| Output: Optimized parameters |
Finally, we compared the forecast results obtained using neural networks based on the two previously described approaches. Figure 4 represents the trajectory of the closing price of stocks.
Figure 4.
Trajectory of the closing price of stocks.
We will present the performances as well as the corresponding graphs for each approach separately in the following subsections.
4.4.1. Direct Approximation
Table 3 below summarizes the results of system controllability with direct approximation; the first two columns represents the value of the loss function and the mean absolute error during the first epoch, while the last two show the value of the same functions during the last epoch.
Table 3.
The results of system controllability with direct approximation.
We observe that the value of the mean absolute error (MAE) decreases over time, which shows that the control strategy significantly improves the accuracy of the forecasts. At the last iteration, it reaches 23.87 as the final value. This value may seem a bit high, but given that the prices of the studied stocks range between USD 100 and 250, and considering the high volatility and the nonlinear nature of the market, this average deviation remains quite reasonable.
Figure 5 shows that the closing price trajectory (x-data) expands in a nonlinear and rapid manner over time, while the trajectory controlled by the RNN (x-rnn-control) converges toward the equilibrium state. Based on the difference between the two trajectories, it can be concluded that the RNN guides the trajectory through stabilization and prevents divergent behavior from occurring in the system.
Figure 5.
Trajectory of the closing price with direct approximation and controllability via an RNN.
Figure 6 displays the predicted values for the validation and test data (red, purple) as well as the actual closing price values (blue, green, and red) that were used to train the model, validate its performance, and test its predictive ability. The closing prices were correctly predicted by the model, with an average error margin between the data and the predicted values.
Figure 6.
Comparison between the actual closing prices and the predictions made on different datasets (training, validation, and test) (direct approximation).
By using direct approximation for the parameters and RNNs for control, we observe that the weights and biases remain reasonable across the layers. While the latter play a significant role in shifting the activation function, the former are adjusted by the model during learning. For example, in the first layer, the weights vary approximately between −0.27 and 0.27, while the biases vary between −0.02 and 0.02. At the end, the weights approximately range between −0.14 and 0.27, and the biases remain around 0.015. According to these values, it is evident that the model has well learned the relationships between the inputs and the outputs. The weight values indicate that the model captures both direct and inverse relationships between the inputs and outputs. Moreover, the biases are close to zero, which reflects stable convergence.
Table 4 presents the predicted closing prices over the days and the actual prices using the direct approach.
Table 4.
The prediction of closing prices over the days (the actual prices compared to the predicted prices using the direct approach).
4.4.2. Optimization
In this subsection we will use an optimization method to estimate the system’s parameters by applying the gradient descent algorithm. Table 5 summarizes the results; the first two columns represents the value of the loss function and the mean absolute error during the first epoch, while the last two show the value of the same functions during the last epoch.
Table 5.
Theresults of system controllability.
We observe that the value of the mean absolute error (MAE) decreases significantly over time, which indicates that the control strategy considerably improves the accuracy of the forecasts. At the last iteration, the MAE reaches 2.32 as the final value. Although this value must still be interpreted in relation to the price scale of the studied stocks, it represents a very low average deviation, which confirms the effectiveness of the control strategy in guiding the system towards the desired trajectories despite the volatility and nonlinear nature of the market.
Figure 7 illustrates how the prediction trajectory typically follows the real price trend, even when there are some deviations. This shows how well the model captures the dynamics of the system and permits us to stabilize and control the system.
Figure 7.
Comparison between the closing prices and the predicted prices between January 2023–September 2024.
In Figure 8, we can notice that in the beginning, the loss of both trajectories is high, which is normal because the model starts with unoptimized parameters. However, between epochs 0 and 5, the loss decreases rapidly, which suggests that the model has learned the characteristics of the data well. After epoch 10, both curves converge towards low and stable values, demonstrating the absence of overfitting on the training data. Moreover, the small fluctuations that appear in the validation loss may reflect the updates of the parameters during training. We conclude that the model trains and converges effectively towards optimal performance, and moreover, it generalizes the system well, which is important for reliable predictions.
Figure 8.
The evolution of the loss function during the training and validation over the epochs (optimization).
By using optimization for parameter estimation and RNNs for control, we observe that the weights and biases remain reasonable across the layers. The values of the negative and positive weights in the matrices of each layer testify to the direct and inverse relationships between the inputs and the neurons of each layer up to the output. Biases close to 0 are an indicator of a well-structured architecture.
These data demonstrate that the model improves the interactions between inputs and outputs and effectively captures the system dynamics.
Table 6 presents a comparison between the real closing prices and the predicted ones using an optimization approach.
Table 6.
The prediction of closing prices over the days (the actual prices compared to the predicted prices using the optimization approach).
Remark 3.
- Optimization changed the weight and bias values and the way the loss function behaved, which improved the prediction. This is because optimization based on the gradient descent algorithm is used, which enables improved parameter adjustment to the nonlinear dynamics of investment data. However, the results are inaccurate because the direct approximation is less exact and shows overfitting.
- RNNs can reduce temporal dependence, learn the fundamental dynamics of the system, and control complex and unstable financial data with ease.
5. Discussion
This paper presents results showing that the approach based on integrating neural networks into the control of this dynamic system is highly effective. This approach helps reduce the gap between the actual output and the desired output in the context of financial forecasting. Therefore, it demonstrates the ability of recurrent networks to capture the nonlinear nature of the system, as well as to learn the temporal dependencies of financial markets. These markets are characterized by their dependence and sensitivity to various economic and geopolitical variables, as well as their volatility. Such characteristics make modeling difficult using classical approaches. Our neural control approach provides an adaptive framework capable of guiding the system’s trajectory to achieve stability and performance objectives.
The increasing complexity of financial and digital ecosystems is considered one of the main challenges in both the economic literature and data science. For example, Li et al. [30] describe in detail the multi-actor strategic choices in digital data markets, integrating evolutionary game theory with system dynamics. This study shows that the economic value of data primarily depends on their integration rather than their quantity or availability. In our study, we draw a parallel between the adaptive behavior of RNNs and the self-regulating mechanisms observed in digital markets, where the connections between agents evolve toward dynamic equilibrium states. This reinforces the idea of combining control theory with neural networks to better understand the dynamics of such environments.
Another perspective is presented in the contribution by He et al. [31]. They showed that the key metric in assessing a system’s stability in response to external shocks is resilience, based on dynamic causality using a recursive evolutionary method. The results presented in their work are limited to a descriptive analysis of temporal dynamics. However, our neural approach goes further by ensuring the stability of trajectories around a desired equilibrium. Our results also indicate that neural networks can preserve prediction accuracy even when the market structure evolves, which directly responds to the issues raised by He et al. [31].
Wang and Luo [32] explored how small enterprises benefit from credit guarantee mechanisms while facing several operational challenges. Their observations resonate with our approach, which extends this perspective by using control theory and neural networks to support decision-making in financial risk management and credit allocation.
The paper by Xiong et al. [33] presents an economic predictive control scheme based on machine learning, using clustering and Lipschitz regression techniques to model the control law. Unlike Xiong’s work, which is based on a purely empirical method, our study relies on a theoretically grounded methodology in which we derive the optimal control from the Pontryagin Maximum Principle and then integrate RNNs into the control of our system, comparing and analyzing both the linearized and nonlinear behaviors of the dynamic system.
This work paves the way for further applications of our approach in economic analysis and offers promising prospects for integrating a neural controller into financial risk management, taking into account various economic factors.
Remark 4.
While the proposed Lyapunov-based control guarantees global asymptotic stability, the convergence occurs as . In contrast, recent works on finite-time and fixed-time control introduce Lyapunov functions with non-Lipschitz terms that ensure convergence within a finite or fixed duration, independent of the initial state [34,35,36]. Incorporating such techniques into the RNN-based control framework represents an interesting extension that could further improve the speed and robustness of convergence.
6. Conclusions
This study shows that, although linearization makes mathematical processing simpler and the use of classical analytical tools effortless, the fully nonlinear representation of the system proves to be more relevant and effective for managing real-world dynamics. Neural networks, thanks to their flexibility, are able to capture the nonlinear behavior of the system and to adapt to complex and changing data patterns, which is not always possible with linear models. In particular, parameter estimation through optimization enables the system to adapt to changing and intricate patterns. Furthermore, the predicted precision is significantly improved via our neural approach.
An application on AAPL financial data supported the conclusions. The results showed that the neural network control model managed to follow the desired trajectories with high precision, while noticeably reducing the difference between the predicted and actual values. This demonstrates how well the suggested control strategy works for financial forecasting and confirms the efficiency of our proposed method within financial forecasting contexts.
Possible extensions could further reinforce and generalize these results. On one hand, exploring alternative activation functions may open new research directions. By exploiting the mathematical characteristics of different functions presented in the literature or creating adaptive activation mechanisms, it would be feasible to enhance convergence rates, reduce risks of saturation, and model more intricate nonlinear dynamics. On the other hand, the generalization of the presented methodology to other types of nonlinear systems is an interesting path for future investigation. Future studies could also attempt to adopt various neural network architectures, such as GRU, PINN, and convolutional networks, to test and determine if they yield additional improvement in terms of stability and control precision.
Author Contributions
Conceptualization, L.S. and T.K.; methodology, L.S., T.K. and A.A.; software, L.S.; validation, L.S., T.K. and A.A.; formal analysis, L.S., T.K., A.A. and N.R.O.B.; investigation, L.S., T.K., A.A. and N.R.O.B.; resources, L.S., T.K., A.A. and N.R.O.B.; writing—original draft preparation, L.S., T.K. and A.A.; writing—review and editing, L.S., T.K., A.A. and N.R.O.B.; visualization, L.S., T.K., A.A. and N.R.O.B.; supervision, T.K. and A.A.; project administration, L.S., T.K. and A.A.; funding acquisition, N.R.O.B. All authors have read and agreed to the published version of the manuscript.
Funding
This work is supported by CIDMA under the Portuguese Foundation for Science and Technology (FCT, https://ror.org/00snfqn58) Multi-Annual Financing Program for R&D Units, grants UID/4106/2025 and UID/PRR/4106/2025.
Data Availability Statement
The historical closing prices of Apple Inc. (AAPL), used as the dataset in this research, were obtained from Yahoo Finance in CSV format. This data is publicly available and freely accessible at the following URL: https://finance.yahoo.com/quote/AAPL/history accessed on 15 July 2024.
Acknowledgments
The authors would like to express their sincere appreciation to the anonymous reviewers for their valuable feedback, insightful comments, and constructive suggestions, which have significantly contributed to improving the clarity, depth, and overall quality of this paper.
Conflicts of Interest
The authors have no conflict of interests related to this publication.
References
- McCulloch, W.S.; Pitts, W. A logical calculus of the ideas immanent in nervous activity. Bull. Math. Biol. 1990, 52, 99–115. [Google Scholar] [CrossRef] [Scilit]
- Hopfield, J.J. Neural networks and physical systems with emergent collective computational abilities. Proc. Natl. Acad. Sci. USA 1982, 79, 2557–2558. [Google Scholar] [CrossRef] [Scilit]
- Hopfield, J.J. Neurons with graded response have collective computational properties like those of two-state neurons. Proc. Natl. Acad. Sci. USA 1984, 81, 3088–3092. [Google Scholar] [CrossRef] [Scilit]
- Hopfield, J.; Tank, D. Neural Computation of Decisions in Optimization Problems. Biol. Cybern. 1985, 52, 141–152. [Google Scholar] [CrossRef] [Scilit]
- Yang, L.; Chua, L.O. Cellular neural networks: Theory. IEEE Trans. Circuits Syst. 1988, 35, 1257–1272. [Google Scholar] [CrossRef] [Scilit]
- Yang, L.; Chua, L.O. Cellular neural networks: Applications. IEEE Trans. Circuits Syst. 1988, 35, 1273–1290. [Google Scholar] [CrossRef] [Scilit]
- Zhang, Q.; Wei, X.; Xu, J. On Global Exponential Stability of Nonautonomous Delayed Neural Networks. Chaos Solitons Fractals 2005, 26, 965–970. [Google Scholar] [CrossRef] [Scilit]
- Yang, X.; Cao, J. Stability analysis of recurrent neural networks with bounded activation functions. Phys. Lett. A 2004, 332, 364–374. [Google Scholar]
- Chen, S.; Zhang, Q.; Wang, C. Existence and Stability of Equilibrium of the Continuous-Time Hopfield Neural Networks. J. Comput. Appl. Math. 2004, 169, 117–125. [Google Scholar] [CrossRef] [Scilit]
- Hirsch, M.W. Convergent activation dynamics in continuous time networks. Neural Netw. 1989, 2, 331–349. [Google Scholar] [CrossRef] [Scilit]
- Gopalsamy, K.; He, X.Z. Stability in Asymmetric Hopfield Nets with Transmission Delays. Phys. D Nonlinear Phenom. 1994, 76, 344–358. [Google Scholar] [CrossRef] [Scilit]
- Maluoka, K. Stability Conditions for Nonlinear Continuous Neural Networks with Asymmetric Connection Weights. Neural Netw. 1992, 5, 495–500. [Google Scholar]
- Kaslik, E.; Braescu, L.; Balint, S. On the Controllability of the Continuous-Time Hopfield-Type Neural Networks. In Proceedings of the Seventh International Symposium on Symbolic and Numeric Algorithms for Scientific Computing (SYNASC’05), Timisoara, Romania, 25–29 September 2005; p. 8. [Google Scholar]
- Slotine, J.J.E.; Li, W. Applied Nonlinear Control; Prentice-Hall: Upper Saddle River, NJ, USA, 1991. [Google Scholar]
- Khalil, H.K. Nonlinear Systems; Prentice-Hall: Upper Saddle River, NJ, USA, 2002. [Google Scholar]
- Almeida, L.B. Backpropagation in non-feedforward networks. In Neural Computing Architectures; North Oxford Academic: London, UK, 1989; pp. 74–91. [Google Scholar]
- Rumelhart, D.; Hinton, G.; Williams, R. Learning representations by back-propagating errors. Nature 1986, 323, 533–536. [Google Scholar] [CrossRef] [Scilit]
- Talebi, S.P.; Mandic, D.P. On the Dynamics of Multi-agent Nonlinear Filtering and Learning. In Proceedings of the 2024 IEEE 34th International Workshop on Machine Learning for Signal Processing (MLSP), London, UK, 22–25 September 2024. [Google Scholar] [CrossRef] [Scilit]
- Hu, Z.; Balakrishnan, S.N. Parameter Estimation in Nonlinear Systems Using Hopfield Neural Networks. J. Aircr. 2005, 42, 41–53. [Google Scholar] [CrossRef] [Scilit]
- Sun, T. A Study on Asset Pricing in Stock Market Based on Hopfield Neural Network. Int. J. Comput. Exp. Sci. Eng. (IJCESEN) 2025, 11, 1096–1107. [Google Scholar] [CrossRef] [Scilit]
- Paluch, M.; Jackowska-Strumillo, L. Decision System for Stock Data Forecasting Based on Hopfield Artificial Neural Network. Inform. Autom. Pomiary W Gospod. I Ochr. Środowiska 2016, 6, 28–33. [Google Scholar] [CrossRef] [Scilit]
- Nicolini, C.; Gopalan, M.; Staiano, J.; Lepri, B. Hopfield Networks for Asset Allocation. arXiv 2024, arXiv:2407.17645. [Google Scholar] [CrossRef] [Scilit]
- Cummins, J.S.; Berloff, N.G. A Fully Analog Pipeline for Portfolio Optimization. arXiv 2024, arXiv:2411.06566. [Google Scholar] [CrossRef] [Scilit]
- El Moutaouakil, K.; Bouhanch, Z.; Ahourag, A.; Aberqi, A.; Karite, T. OPT-FRAC-CHN: Optimal Fractional Continuous Hopfield Network. Symmetry 2024, 16, 921. [Google Scholar] [CrossRef] [Scilit]
- Jai, A.E.; Zerrik, E.; Ztot, K. Systèmes Dynamiques: Analyse et Contrôle des Systèmes Localisés; Presses Universitaires de Perpignan: Perpignan, France, 2008. [Google Scholar]
- Trélat, E. Contrôle Optimal: Théorie et Applications; Vuibert: Paris, France, 2008. [Google Scholar]
- Chen, T. Linear Systems Theory and Design; Oxford University Press: Oxford, UK, 1995. [Google Scholar]
- Battiston, M.; Rea, R.; Cerri, G.; Paolillo, M.; Alessandro, S. yfinance: Yahoo! Finance Market Data Downloader. 2019. Available online: https://pypi.org/project/yfinance/ (accessed on 21 October 2024).
- Dell’Era, M. Local Volatility and Hopfield Neural Network. China-USA Bus. Rev. 2022, 21, 106–120. [Google Scholar] [CrossRef] [Scilit]
- Li, Y.; Li, G.; Xu, A.; Yao, F. Research on the collaborative mechanism of a data trading market based on a four-party evolutionary game in the context of digital intelligence. Socio-Econ. Plan. Sci. 2025, 100, 102238. [Google Scholar] [CrossRef] [Scilit]
- He, Q.; Rahman, M.U.; Hu, J.; Cui, J. Dynamic relationship between carbon trading system resilience and low-carbon stock market returns using time-varying Granger causality. Fractals 2025, 2540181. [Google Scholar] [CrossRef] [Scilit]
- Wang, Y.; Luo, J. Effect and Challenge of Credit Guarantee Plan in Financing of Small Enterprises. Singap. Econ. Rev. 2025. [Google Scholar] [CrossRef] [Scilit]
- Xiong, W.; He, D.; Du, H. Learning economic model predictive control via clustering and kernel-based Lipschitz regression. J. Frankl. Inst. 2025, 362, 107787. [Google Scholar] [CrossRef] [Scilit]
- Bhat, S.P.; Bernstein, D.S. Finite-time stability of continuous autonomous systems. SIAM J. Control Optim. 2000, 38, 751–766. [Google Scholar] [CrossRef] [Scilit]
- Hong, Y.; Xu, Y.; Huang, J. Finite-time control for robot manipulators. Syst. Control Lett. 2001, 46, 243–253. [Google Scholar] [CrossRef] [Scilit]
- Polyakov, A. Nonlinear feedback design for fixed-time stabilization of linear control systems. IEEE Trans. Autom. Control 2012, 57, 2106–2110. [Google Scholar] [CrossRef] [Scilit]
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. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).







