# Physics Informed by Deep Learning: Numerical Solutions of Modified Korteweg-de Vries Equation

Authors: Yuexing Bai; Temuer Chaolu; Sudao Bilige
Journal: Advances in Mathematical Physics
 (2021)

---

## Abstract

In this paper, with the aid of symbolic computation system Python and based on the deep neural network (DNN), automatic differentiation (AD), and limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) optimization algorithms, we discussed the modified Korteweg-de Vries (mkdv) equation to obtain numerical solutions. From the predicted solution and the expected solution, the resulting prediction error reaches10−6. The method that we used in this paper had demonstrated the powerful mathematical and physical ability of deep learning to flexibly simulate the physical dynamic state represented by differential equations and also opens the way for us to understand more physical phenomena later.


---

## Body

## 1. Introduction

In recent years, nonlinear phenomena have been widely used in fields such as mathematics, physics, chemistry, biology, finance, and engineering technology. Because a large number of mathematical models of scientific and engineering problems are reduced to the problem for determining solutions of ordinary differential equations (ODEs) and partial differential equations (PDEs) and the problems are complex and the amount of calculation is huge, except for a few special types of differential equations that can be solved by analytical methods, the analytical expressions to be obtained are extremely difficult in most cases. Therefore, the research on the numerical methods for PDE has become a popular mainstream direction. Numerical solutions have attracted the attention of scientific researchers, and it is also a large-scale scientific and engineering calculation.The numerical method of PDE is based on whether the regular grid method and the gridless method are used when discretizing. Due to the difficulties in the structure of the numerical format and meshing, it is subject to many restrictions in practice. In obtaining high-precision and high-resolution solutions, not experienced computational mathematicians will have difficulty for the reason that the structure of the numerical format is very complicated.Artificial neural networks (ANN) which are simplified models of the biological nervous system represent a technology that has various applications in the area of mathematical modeling, text recognition, voice recognition, learning and memory, pattern recognition, signal processing, automatic control, signal processing, decision-making assistance and time-series analysis, etc. [1]. ANN has been applied to solve ordinary differential equations and partial differential equations as early as more than 20 years ago. As we all know, solving differential equations by neural networks can be regarded as a mesh-free numerical method. Due to the importance of differential equations, many methods have been developed in the literature for solving them [2]. Rosenblatt introduced the first model of supervised learning based on a single-layer neural network with a single neuron [3]. Mcfall studied boundary value problems with arbitrary irregular boundaries by an artificial neural network method in 2006 [4]. Mall and Chakraverty solved ordinary differential equations with the application of the Legendre neural network in 2016 [5].However, due to the limitation of computing methods and computing resources at that time, this technology has not received enough attention. With the development of deep learning in recent years, Professor Karniadakis from the Department of Applied Mathematics at Brown University and his collaborators reexamined the technology and developed a set of deep learning algorithm frameworks based on the original. It was named “physics-informed neural networks (PINN)” and was first used to solve forward and inverse problems of partial differential equations. This has also triggered a lot of follow-up research work and has gradually become a research hotspot in the emerging interdisciplinary field of Scientific Machine Learning (SCIML). From the point of view of function approximation theory in mathematics, the neural network can be regarded as a general nonlinear function approximator, and the modeling process of partial differential equations is also looking for nonlinear functions satisfying constraint conditions, which have something in common. Thanks to the AD technology widely used in the deep learning neural network, the differential form constraint conditions in the differential equation are integrated into the loss function design of the neural network, so as to obtain the neural network constrained by the physical model—this is the most basic design idea of PINN.Both PINN’s network structure and loss function need to be tailored to the form of differential equations, which is different from current work in computational physics that directly utilizes machine learning algorithms. Different from the classical supervised learning task, PINN has the regularization factor of differential equation and initial boundary value condition in addition to the supervised data part in the design of loss function. These regularization factors are different and need to be tailored to achieve the optimal design according to the problem. The traditional computational differential equation numerical solution is obtained by finite difference, finite element, and other numerical methods, but the disadvantage is that it needs to give clear initial value conditions, and the numerical solution algorithm is sensitive to the boundary region; the condition slightly changed must be recalculated, which is difficult to be used in real-time calculation and prediction. PINN overcomes the problem that the traditional numerical simulation method is sensitive to the region and the initial and boundary conditions. Raissi et al. introduced physics-informed neural network data-driven solution, and they presented their developments in the context of solving two main classes of problems: data-driven solution and data-driven discovery of partial differential equations in 2017 [6]. Raissi et al. used multistep neural networks to study the dynamical systems of nonlinear dynamical systems in 2018 [7]. Raissi and Karniadakis study the Navier-Stokes, Schrödinger, Kuramoto-Sivashinsky, and time-dependent linear fractional equations by machine learning [8]. Liu et al. solved differential equations with neural networks in 2019 [9]. Han et al. solved high-dimensional partial differential equations by using deep learning in 2018 [10].In the present study, we take advantage of the fast developing machine learning and use the method of PINN that was proposed by Raissi et al. [11] to study the mkdv equation. AD and L-BFGS [12] optimization algorithms had been used to train loss function. First, we introduced the main ideas of the algorithm. Second, we use the method to study two kinds of initial solutions of the mkdv equation, and the predicted solitary wave is first shown in this paper. We also show the relative L2-norm error between the predicted and the exact solution ut,x for the different number of initial and boundary training data Nu and different number of collocation points Nf. The three-dimensional diagram and projected image of the exact solutions and predicted solutions of the mkdv equation with different initial solutions are shown in Figures 1–4. Finally, we conclude the paper. From the results obtained in the experiment, some novel and important developments for searching for analytical solitary wave solutions for PDE were investigated. The results of this manuscript may well complement the existing literature as the following: extended and modified direct algebraic method, extended mapping method, and Seadawy techniques to find solutions for some nonlinear partial differential equations such as dispersive solitary wave solutions of Kadomtsev-Petviashvili-Burgers dynamical equations [13]; the elliptic function, bright and dark solitons, and solitary wave solutions of higher-order NLSE [14]; abundant lump solution and interaction phenomenon of (3+1)-dimensional generalized Kadomtsev-Petviashvili equation [15]; describing the bidirectional propagation of small amplitude long capillary gravity waves on the surface of shallow water [16]; dispersive traveling wave solutions of the equal-width and modified equal-width equations [17]; periodic solitary wave solutions of the (2+1)-dimensional variable-coefficient Caudrey-Dodd-Gibbon-Kotera-Sawada equation [18]; rational solutions and lump solutions to the generalized (3+1)-dimensional shallow water-like equation [19]; new solitary wave solutions to coupled Maccari’s system [20]; and lump solutions to a (2+1)-dimensional fourth-order nonlinear PDE possessing a Hirota bilinear form [21]. Therefore, this study is of significance for the later study of soliton solutions.Figure 1
The three-dimensional diagram of the exact solutions (a) and predicted solutions (b) of the mkdv equation with initial stateux,0=2exp−x/exp−2x+1.
(a)(b)Figure 2
The projection of the exact solution (a) in thex−t, x−u, t−u direction and the projection of the predicted solution (b) in the x−t, x−u, t−u direction of the mkdv equation with initial state ux,0=2exp−x/exp−2x+1.
(a)(b)Figure 3
The three-dimensional diagram of the exact solutions (a) and predicted solutions (b) of the mkdv equation with initial stateux,0=2sech2x.
(a)(b)Figure 4
The projection of the exact solution (a) in thex−t, x−u, t−u direction and the projection of the predicted solution (b) in the x−t, x−u, t−u direction of the mkdv equation with initial state ux,0=2sech2x.
(a)(b)


## 2. Main Ideas of the Algorithm

### 2.1. Illustration of the Algorithm

Deep learning is a new field in machine learning research. Its motivation lies in establishing and simulating a neural network for analysis and learning of the human brain. It mimics the mechanism of the human brain to interpret data. The concept of deep learning comes from the research of artificial neural networks. The multilayer perceptron with multiple hidden layers is a kind of deep learning structure. We give the structure of a simple neural network and deep neural network in Figure5. In this paper, the network was used as a supervised network that means multilayer perceptron needs a teacher to tell the neural network what the desired output should be. Deep learning forms a more abstract high-level representation attribute category or feature by combining low-level features to discover distributed feature representations of data. Deep learning uses a hierarchical structure similar to neural networks. The system consists of a multilayer network consisting of an input layer, a hidden layer (multilayer), and an output layer. Only nodes in adjacent layers are connected. There is no connection between each other, and each layer can be regarded as a logistic regression model. Deep learning allows computers to construct complex concepts through simpler concepts with powerful capabilities and flexibility. DNN have shown great potential in approximating high-dimensional functions compared with traditional approximations based on Lagrangian interpolation or spectral methods [22].Figure 5
Basic structure of the simple neural network and deep neural network (perceptron).Typical examples of deep learning models are feedforward deep networks or multilayer perceptrons. Multilayer perceptron is a mathematical function that maps input to output value. This function is composed of many simpler functions. Each layer of a fully connected DNN can be expressed as follows:(1)zl=fWlzl−1+bl,l=1,⋯,L−1,(2)zL=Nz0;ϑ=fWLf⋯fW2fW1z0+b1+b2+bL,(3)ϑ=W1,b1,W2,b2,⋯,WL,bL,where z0 means input vector and f is activation function (we choose hyperbolic tangent function as the activation function where tanh=ex−e−x/ex+e−x:
(4)Wk=w11k⋯w1nk−1k⋮⋱⋮wnk1k⋯wnknk−1k,bk=b1kb2k⋮bnkk,k=1,2,⋯,L, Wk is the weights from layer k−1 to layer k, and wij means the weight between the j-input and i-neuron of the hidden layer. bk is bias vector. Nz0;ϑ can be considered an approximate solution for ux,t of a PDE. The final approximate solution is solved by adjusting the parameters ϑ to minimize the error of the approximate solution and the exact solution.A fully connected neural network was previously proven [23, 24] by Jones and Carroll and Dickinson that any continuous function defined in a finite domain can be approximated. In this paper, we introduced the form and construction of the solution of PDE using the physics-informed neural network method. The schematic of the physics-informed neural network for the mkdv equation is shown in Figure 6. Consider the general form of the PDE as follows:
(5)ut+Nx,u,ux,uxx,⋯=0,x∈Ω,t∈0,T,where N is a nonlinear function of time t, space x, solution u, and its derivatives and the subscripts denote partial differentiation in either time t or space x. For example, uxx is the second derivative of u with respect to x.Figure 6
Schematic of physics-informed neural network for the mkdv equation.


### 2.2. Details of the Algorithm

According to Equation (1), let us define ft,x as follows:
(6)ft,x≔ut+Nx,u,ux,uxx,⋯.Objective function of the trial function can be defined as [25]
(7)MSE=MSEu+MSEf,where mean square errors are defined, respectively, as MSEu and MSEf:
(8)MSEu=1Nu∑i=1Nuutui,xui−ui2,MSEf=1Nf∑i=1Nfftfi,xfi2.The objective function of DNN training is performed by the mean squared error on the network outputs.The weight and bias between the neural networksut,x and ft,x can be learned by minimizing the mean squared error loss, tfi,xfi were domain data, Nu is the number of sampling points on the boundary, Nf is the number of sampling points on the region, tui,xui, ui were initial and boundary training data on ut,x, and utui,xui is predicted solution.


## 2.1. Illustration of the Algorithm

Deep learning is a new field in machine learning research. Its motivation lies in establishing and simulating a neural network for analysis and learning of the human brain. It mimics the mechanism of the human brain to interpret data. The concept of deep learning comes from the research of artificial neural networks. The multilayer perceptron with multiple hidden layers is a kind of deep learning structure. We give the structure of a simple neural network and deep neural network in Figure5. In this paper, the network was used as a supervised network that means multilayer perceptron needs a teacher to tell the neural network what the desired output should be. Deep learning forms a more abstract high-level representation attribute category or feature by combining low-level features to discover distributed feature representations of data. Deep learning uses a hierarchical structure similar to neural networks. The system consists of a multilayer network consisting of an input layer, a hidden layer (multilayer), and an output layer. Only nodes in adjacent layers are connected. There is no connection between each other, and each layer can be regarded as a logistic regression model. Deep learning allows computers to construct complex concepts through simpler concepts with powerful capabilities and flexibility. DNN have shown great potential in approximating high-dimensional functions compared with traditional approximations based on Lagrangian interpolation or spectral methods [22].Figure 5
Basic structure of the simple neural network and deep neural network (perceptron).Typical examples of deep learning models are feedforward deep networks or multilayer perceptrons. Multilayer perceptron is a mathematical function that maps input to output value. This function is composed of many simpler functions. Each layer of a fully connected DNN can be expressed as follows:(1)zl=fWlzl−1+bl,l=1,⋯,L−1,(2)zL=Nz0;ϑ=fWLf⋯fW2fW1z0+b1+b2+bL,(3)ϑ=W1,b1,W2,b2,⋯,WL,bL,where z0 means input vector and f is activation function (we choose hyperbolic tangent function as the activation function where tanh=ex−e−x/ex+e−x:
(4)Wk=w11k⋯w1nk−1k⋮⋱⋮wnk1k⋯wnknk−1k,bk=b1kb2k⋮bnkk,k=1,2,⋯,L, Wk is the weights from layer k−1 to layer k, and wij means the weight between the j-input and i-neuron of the hidden layer. bk is bias vector. Nz0;ϑ can be considered an approximate solution for ux,t of a PDE. The final approximate solution is solved by adjusting the parameters ϑ to minimize the error of the approximate solution and the exact solution.A fully connected neural network was previously proven [23, 24] by Jones and Carroll and Dickinson that any continuous function defined in a finite domain can be approximated. In this paper, we introduced the form and construction of the solution of PDE using the physics-informed neural network method. The schematic of the physics-informed neural network for the mkdv equation is shown in Figure 6. Consider the general form of the PDE as follows:
(5)ut+Nx,u,ux,uxx,⋯=0,x∈Ω,t∈0,T,where N is a nonlinear function of time t, space x, solution u, and its derivatives and the subscripts denote partial differentiation in either time t or space x. For example, uxx is the second derivative of u with respect to x.Figure 6
Schematic of physics-informed neural network for the mkdv equation.


## 2.2. Details of the Algorithm

According to Equation (1), let us define ft,x as follows:
(6)ft,x≔ut+Nx,u,ux,uxx,⋯.Objective function of the trial function can be defined as [25]
(7)MSE=MSEu+MSEf,where mean square errors are defined, respectively, as MSEu and MSEf:
(8)MSEu=1Nu∑i=1Nuutui,xui−ui2,MSEf=1Nf∑i=1Nfftfi,xfi2.The objective function of DNN training is performed by the mean squared error on the network outputs.The weight and bias between the neural networksut,x and ft,x can be learned by minimizing the mean squared error loss, tfi,xfi were domain data, Nu is the number of sampling points on the boundary, Nf is the number of sampling points on the region, tui,xui, ui were initial and boundary training data on ut,x, and utui,xui is predicted solution.


## 3. Example for Modified Korteweg-de Vries Equation

The modified Korteweg-de Vries (mkdv) equation may be written as [26]
(9)ut+6u2ux+uxxx=0,ux,0=2exp−xexp−2x+1.If−4≤x≤4, 0≤t≤2. We got the training and test data by using conventional spectral methods and using the Chebfun package [27] with a spectral Fourier discretization with 256 modes and a fourth-order explicit Runge-Kutta temporal integrator with time-step size 10−4.There are two parts of data points to form the collocation points of trainingfx,t: one part used the Latin hypercube sampling strategy to generate 10000 data points and the other part uses random sampling to generate 456 data points. Randomly extract Nu=100 data from the initial and boundary data as training points, and we learn the latent solution ut,x by using the L-BFGS algorithm to optimize the parameters to minimize the error function Equation (7). We had shown the predicted solution ux,t in Figure 7 by an 11-layer deep neural network in which each hidden layer contained 30 neurons. The relative L2-norm error for this case is 9.402109·10−6. The code runs on a personal laptop with Intel® Core™ i5, 2.50 GHz, and the running time is 930.9392 seconds. Judging from the physical propagation diagram of the exact solution which is a soliton solution obtained by the Chebfun package and the predicted solution at the bottom of Figure 7, the waveform of the single soliton has not changed over time. The exact dynamics and learned dynamics of ux,t are shown in Figure 8. We choose the number of training points as Nu=100 and collocation points as Nf=20000; under this condition, we study the influence of different layers and different neurons on the relative L2-norm error. The relative L2-norm error tends to decrease with the increase of layers and neurons, and it is shown in Table 1. We also studied the effect of the DNN architecture which is constructed by 9 layers with 20 neurons per hidden layer with different training points Nu and collocation points Nf on relative L2-norm error which is shown in Table 2. The three-dimensional diagram and projected image of the exact solutions and predicted solutions of the mkdv equation with initial state ux,0=2exp−x/exp−2x+1 are shown in Figures 1 and 2.Figure 7
mkdv equation. (a) Predicted solutionut,x. (b) Predicted solution and exact solution at t=0.35,0.60,0.85 were depicted by the white vertical lines in (a). The red dashed line is predicted solution, and the blue line is exact solution of ux,t.
(a)(b)Figure 8
Exact dynamics and learned dynamics ofux,t.Table 1
mkdv equation:L2-norm error between the predicted and exact solutions of ut,x for different numbers of hidden layers and different numbers of neurons per layer. The number of training points is Nu=100, and collocation points is Nf=20000.
Neurons10152530L2-norm errorLayers22.14e−051.29e−051.22e−051.75e−0551.85e−052.01e−052.00e−051.28e−0572.01e−052.32e−051.20e−051.08e−0591.40e−051.45e−051.28e−051.17e−05Table 2
mkdv equation:L2-norm error between the predicted and exact solutions of ut,x for DNN architecture which is constructed by 9 hidden layers with 20 neurons per hidden layer with different training points Nu and collocation points Nf.
Nf10005000900010000L2-norm errorNu308.56e−051.15e−057.22e−061.56e−06507.97e−061.54e−051.76e−051.67e−06801.23e−051.42e−051.10e−051.58e−06901.17e−051.35e−051.95e−051.62e−061001.05e−051.34e−052.14e−061.67e−06In order to further study the effectiveness of the performance of the algorithm to approximate the exact solutions of mkdv equations, we change the initial condition as follows [28]:
(10)ut+6u2ux+uxxx=0,ux,0=2sech2x.We got the training and test data by using conventional spectral methods and using the Chebfun package with a spectral Fourier discretization with 256 modes and a fourth-order explicit Runge-Kutta temporal integrator with time-step size10−4. The data points used to obtain fx,t are divided into two parts, one part used the Latin hypercube sampling strategy to generate 10000 data points and the other part uses random sampling to generate 456 data points. Randomly extract Nu=100 data from the initial and boundary data as training points, and we learn the latent solution ut,x by using the L-BFGS algorithm to optimize the parameters to minimize the error function Equation (7). We had shown the predicted solution ux,t in Figure 9 by an 11-layer deep neural network in which each hidden layer contained 15 neurons. Running time of the code is 439.9942 seconds. The relative L2-norm error for this case is 1.0333972·10−5. Judging from the physical propagation diagram of the exact solution which is a soliton solution obtained by the Chebfun package and the predicted solution in Figure 9, the waveform of the single soliton has not changed over time. The exact dynamics and learned dynamics of ux,t are shown in Figure 10. We choose the number of training points as Nu=100 and collocation points as Nf=10000; under this condition, we study the influence of different layers and different neurons on the relative L2-norm error. The relative L2-norm error tends to decrease with the increase of layers and neurons, and it is shown in Table 3. We also studied the effect of the DNN architecture constructed by 9 layers with 15 neurons per hidden layer with different training points Nu and collocation points Nf on relative L2-norm error which is shown in Table 4. The three-dimensional diagram and projected image of the exact solutions and predicted solutions of the mkdv equation with initial state ux,0=2sech2x are shown in Figures 3 and 4.Figure 9
mkdv equation. (a) Predicted solutionut,x. (b) Predicted solution and exact solution at t=0.35,0.60,0.85 were depicted by the white vertical lines in (a). The red dashed line is predicted solution, and the blue line is exact solution of ux,t.
(a)(b)Figure 10
Exact dynamics and learned dynamics ofux,t.Table 3
mkdv equation:L2-norm error between the predicted and exact solutions of ut,x for different numbers of hidden layers and different numbers of neurons per layer. The number of training points is Nu=100 and collocation points is Nf=10000.
Neurons15202530L2-norm errorLayers21.13e−051.08e−057.95e−068.78e−0651.25e−058.55e−068.10e−068.64e−0679.18e−069.07e−068.46e−068.62e−0691.02e−051.21e−051.59e−059.40e−06Table 4
mkdv equation:L2-norm error between the predicted and exact solutions of ut,x for DNN architecture which is constructed by 9 hidden layers with 15 neurons per hidden layer with different training points Nu and collocation points Nf.
Nf30005000800010000L2-norm errorNu501.25e−052.75e−051.37e−051.29e−05801.64e−051.71e−051.76e−051.39e−05901.19e−051.08e−051.57e−059.07e−061001.77e−051.21e−051.01e−051.02e−06


## 4. Conclusions

With the increase of data volume, the improvement of computing power, and the emergence of new machine learning algorithms (deep learning), artificial intelligence has become a field with many practical applications and active research topics. Deep learning is one of the ways to artificial intelligence. It is a type of machine learning, a technology that enables computer systems to be improved from experience and data.In this paper, we briefly describe details of the algorithm of DNN. Figures5–10 show the basic structure of the simple neural network and deep neural network, schematic of the physics-informed neural network, and comparison diagram of the precise dynamical system and the predicted dynamical system of the mkdv equation. Tables 1 and 3 show L2-norm error between the predicted and exact solutions of ut,x for different numbers of hidden layers and different numbers of neurons per layer. Tables 2 and 4 show the relative L2 error between the predicted and exact solutions ut,x for different numbers of training points Nu and collocation points Nf. Tables 1–4 illustrate the relative L2 error that tends to decrease with the increase in layers and neurons. This method demonstrates the strong mathematical and physical ability of deep learning to simulate the physical dynamic state represented by differential equations and also opens the way for us to understand more physical phenomena later.



---

*Source: 5569645-2021-05-29.xml*