# Solving Partial Differential Equations Using Deep Learning and Physical Constraints
## 3 Experiments and Results
### Two-Soliton Solution of the Korteweg-De Vries Equation  
KdV equations are an important class of equations that have soliton solutions, as introduced in Section 3.2. The study of the KdV equation is important for understanding the nature of solitons and  
Figure 5: Solution of the Korteweg-de Vries (KdV)–Burgers equation given by physics-informed neural networks. Figure 6: Comparison of the prediction given by physics-informed neural networks with the exact solution. the interaction of two or more solitons. Many scholars have studied the multi-soliton solutions of KdV equations [66] and, in this section, we employ the proposed physics-informed neural networks to study the following KdV equations:  
\[u_{t}+6 uu_{x}+u_{xxx}=0,\quad-\infty<x<\infty \tag{23}\]  
when given the initial condition \(u(0,x)=6\sec h^{2}x\), Equation (23) has the following two-soliton solution \(u(x,t)\)  
\[u(x,t)=12\frac{3+4\cosh(2x-8t)+\cosh(4x-64t)}{(3\cosh(x-28t)+\cosh(3x-36t))^{2}} \tag{24}\]  
First, because this solution is valid for either positive or negative \(t\), we obtained data based on the true solution for \(x\in[-20,20]\) and \(t\in[-1,1]\). Some initial data and some random data in the space-time domain are selected as training data. Next, we constructed a neural network to approximate the solution of Equation (23), which is denoted as \(\hat{u}(t,x)\). The neural network contains seven hidden layers, each containing 100 neurons, and the hyperbolic tangent tanh is chosen as the activation function. Besides, the physical information neural network \(f(t,x)\) is constructed using the automatic differentiation of the TensorFlow in order to introduce control information of the equation. Specifically, the physics-informed neural network \(f(t,x)\) is defined, as follows:  
\[f(t,x):=u_{t}+6 uu_{x}+u_{xxx} \tag{25}\]  
Next, we obtain the optimal parameters of the neural network \(\hat{u}(t,x)\) and \(f(t,x)\) by minimizing the following mean square error loss. \[J(\mathbf{\theta})=MSE_{u}+MSE_{f} \tag{26}\]  
where  
\[MSE_{u}=\frac{1}{N_{u}}\sum_{i=1}^{N_{u}}\left|u\left(\dot{t}_{u^{\prime}}^{i} x_{u}^{i}\right)-u^{i}\right|^{2} \tag{27}\]  
\[MSE_{f}=\frac{1}{N_{f}}\sum_{i=1}^{N_{f}}\left|f\left(\dot{t}_{f}^{i},x_{f}^{i }\right)\right|^{2} \tag{28}\]  
Similar to the previous experiment, on the one hand, the loss function \(MSE_{u}\) is constructed based on the observation data of the initial condition and boundary condition; on the other hand, the loss function \(MSE_{f}\) is constructed based on the physical information of the partial differential equation. Specifically, \(\left\{t_{u^{\prime}}^{i},x_{u}^{i},u^{i}\right\}_{i=1}^{N_{u}}\) corresponds to the initial and boundary condition data, \(u(t_{f},x_{f})\) and \(\left\{t_{f}^{i},x_{f}^{i}\right\}_{i=1}^{N_{f}}\) corresponds to the data in the space-time domain. In this experiment, we randomly select training data in the data set. The number of training data in the spatio-temporal domain is 60,000, and the number of training data that meets the initial and boundary conditions is 400. We used the Glorot normal initializer for initialization and set the learning rate for the optimization process to 0.001. We ran L-BFGS for 30,000 epochs and then used Adam to continue the optimization until convergence to ensure global convergence and speed up the convergence process. In this experiment, the time to train the model was about eighteen minutes. After training the neural network model, we used the model to make predictions and compared the results with the true solution. Figure 7 shows the predictions of the KdV equation given by physics-informed neural networks. Figure 8 gives the comparison between the prediction and the exact solution at different moments \(t=-0.5,0,0.5\) to test the performance of the model. It can be seen from Figure 8 that the prediction is very close to the exact solution. Also, it can be seen that tall wave propagates faster than short waves, which is consistent with the nature of the solitary wave solutions of the KdV equation.