Table of Contents
Fetching ...

A Pedagogical Framework for Physics-Informed Machine Learning: From Classical Pendulum to Quantum Anharmonic Oscillator Using PyTorch on Modern GPU Hardware

Enis Yazici

Abstract

We present a five-module pedagogical framework for teaching physics-informed machine learning (ML) through two progressively complex physical systems: a driven, damped nonlinear pendulum and a one-dimensional quantum anharmonic oscillator. Five model architectures are implemented and compared: a standard artificial neural network (ANN), a one-dimensional convolutional neural network (CNN), a long short-term memory (LSTM) network, and two physics-informed neural networks (PINNs) -- one per physical system. All models are implemented in PyTorch~2.9 and executed on an NVIDIA RTX~5090 GPU, making the framework directly applicable to modern deep learning laboratory courses. Quantitative benchmarks show that data-driven models achieve mean absolute errors of $1.3\times10^{-2}$~rad (pendulum ANN) and $4.4\times10^{-5}$~a.u.\ (quantum CNN), while the curriculum-trained pendulum PINN reaches an MAE of $3.1\times10^{-2}$~rad using only collocation points. A systematic CPU-vs-GPU benchmark reveals speedups ranging from $1.2\times$ (small ANN) to $24.6\times$ (LSTM), providing a concrete pedagogical demonstration of when GPU acceleration is -- and is not -- warranted. The framework is packaged as self-contained Jupyter notebooks designed for a graduate-level \emph{Deep Neural Networks for Physical Systems} course, with embedded reflection questions that guide students from data-driven thinking toward physics-constrained formulations.

A Pedagogical Framework for Physics-Informed Machine Learning: From Classical Pendulum to Quantum Anharmonic Oscillator Using PyTorch on Modern GPU Hardware

Abstract

We present a five-module pedagogical framework for teaching physics-informed machine learning (ML) through two progressively complex physical systems: a driven, damped nonlinear pendulum and a one-dimensional quantum anharmonic oscillator. Five model architectures are implemented and compared: a standard artificial neural network (ANN), a one-dimensional convolutional neural network (CNN), a long short-term memory (LSTM) network, and two physics-informed neural networks (PINNs) -- one per physical system. All models are implemented in PyTorch~2.9 and executed on an NVIDIA RTX~5090 GPU, making the framework directly applicable to modern deep learning laboratory courses. Quantitative benchmarks show that data-driven models achieve mean absolute errors of ~rad (pendulum ANN) and ~a.u.\ (quantum CNN), while the curriculum-trained pendulum PINN reaches an MAE of ~rad using only collocation points. A systematic CPU-vs-GPU benchmark reveals speedups ranging from (small ANN) to (LSTM), providing a concrete pedagogical demonstration of when GPU acceleration is -- and is not -- warranted. The framework is packaged as self-contained Jupyter notebooks designed for a graduate-level \emph{Deep Neural Networks for Physical Systems} course, with embedded reflection questions that guide students from data-driven thinking toward physics-constrained formulations.

Paper Structure

This paper contains 25 sections, 7 equations, 9 figures, 2 tables.

Figures (9)

  • Figure 1: True vs. predicted angular displacement $\theta(t)$ for the classical pendulum. Left: data-driven ANN with five engineered features. Right: PINN trained on collocation points with curriculum expansion.
  • Figure 2: Direct comparison of ANN and curriculum PINN predictions over the full 30-second window.
  • Figure 3: Quantum anharmonic oscillator dataset: ground-state wavefunctions (left) and $E_0$ vs. $\lambda$ (right) for 500 samples.
  • Figure 4: True vs. predicted ground-state energy $E_0$ for the CNN (left) and LSTM (right) models.
  • Figure 5: Quantum PINN at $\lambda=0.10$: predicted wavefunction $\hat{\psi}(x)$ vs. FDM reference (top) and residual $|\hat{\psi} - \psi_{\text{FDM}}|$ (bottom). The learned energy $\hat{E}=0.5597$ a.u. agrees with FDM ground state $E_0=0.5591$ a.u. to within $5.5\times10^{-4}$ a.u.
  • ...and 4 more figures