Practical Aspects on Solving Differential Equations Using Deep Learning: A Primer
Georgios Is. Detorakis
TL;DR
This work presents a practical primer on solving differential equations with the Deep Galerkin (DG) method, a neural-network–based extension of Galerkin approaches that minimizes a loss combining the differential operator residual, boundary conditions, and initial data. By leveraging automatic differentiation and sampling from domain-specific distributions, the DG framework yields PDE, ODE, and Fredholm integral equation solutions without GPUs, demonstrated on the 1D heat equation, exponential decay, FitzHugh–Nagumo dynamics, and a Fredholm second-kind problem, with explicit performance metrics (e.g., MAEs of approximately 0.0017, 0.0088, and 0.0134, respectively). The paper provides concrete PyTorch implementations, explores architectural variants (MLP, DGM, and ResNet-like blocks), analyzes the effects of batch size and batch normalization on convergence, and demonstrates hyperparameter optimization using Ray Tune and Optuna. Overall, the work offers a practical, end-to-end workflow and guidance for deploying DG-based differential equation solvers on CPU-equipped machines, with a public GitHub repository for reproducibility. This positions the DG method as an accessible option for researchers needing flexible, implementation-friendly PDE/ODE/integral equation solvers in scientific computing.
Abstract
Deep learning has become a popular tool across many scientific fields, including the study of differential equations, particularly partial differential equations. This work introduces the basic principles of deep learning and the Deep Galerkin method, which uses deep neural networks to solve differential equations. This primer aims to provide technical and practical insights into the Deep Galerkin method and its implementation. We demonstrate how to solve the one-dimensional heat equation step-by-step. We also show how to apply the Deep Galerkin method to solve systems of ordinary differential equations and integral equations, such as the Fredholm of the second kind. Additionally, we provide code snippets within the text and the complete source code on Github. The examples are designed so that one can run them on a simple computer without needing a GPU.
