Just like the heat equation example, we can solve the 1D wave equation using the same Physics Informed Neural Networks (PINNs) approach. The 1D wave equation is given by:
where (c) is the wave speed.
The domain of the problem is
The initial conditions are given by:
and the boundary conditions are given by:
The solution to the wave equation is given by:
The model I used in this experiment employs the same architecture as the heat equation example, employing 4 hidden layers, 25 neurons each.
The model was trained for 1000 iterations over 1000 data points within the specified domain. The loss function is the sum of the mean squared error loss for the initial and boundary conditions, and the PDE loss. The results are shown below:
The model was able to capture the dynamics of the wave equation, as shown in the animation above. The model was able to learn the wave equation and the boundary conditions, and the solution closely resembles the analytical solution.