This repository contains an implementation of the Deep Collocation Method (DCM) for solving Ordinary Differential Equations (ODEs) and Partial Differential Equations (PDEs) using PyTorch.
Deep Collocation Methods (DCM) are neural network-based approaches for solving differential equations by enforcing the governing equation and boundary/initial conditions as constraints in the loss function. This implementation includes:
- Solving an ODE using deep collocation.
- Solving the 1D Heat Equation (PDE) using a neural network.
Solves the simple first-order ODE:
The exact solution is:
Solves the one-dimensional heat equation:
with boundary conditions (
The exact solution is:
1οΈβ£ Install dependencies:
pip install torch numpy matplotlib- The Deep Collocation Method (DCM) approximates the solution using a neural network.
- The predicted solutions are compared with exact solutions for validation.
- 3D surface plots are generated for the PDE solution over time.
This implementation is inspired by the following paper:
- Deep Collocation Methods: A Framework for Solving Integro-Differential Equations with Neural Networks
arXiv:2502.17203