Coupled-Pendulum Modeling in an ODE Class: An Assignment on Fourier-Initialized Gradient Descent in Machine Learning
CODEE Journal · 2026 · 20 (2) · 1-18
DOI: 10.5642/codee.outy6782 ↗At a glance
Journal article in CODEE Journal, 2026. Written by Huy Truong and 1 co-authors.
Abstract (original language)
: As data-driven methods are increasingly used in science and engineering, students benefit from learning to integrate machine learning techniques with traditional mathematical modeling. We present a hands-on extra-credit assignment for an undergraduate ordinary differential equations (ODE) course that enables students to compare classical analytical methods with data-driven approaches on the same physical system. Using a coupled-pendulum system— two pendulums connected by a spring—with real experimental data acquired via video tracking of a real physical setup, students work through three models in a guided Jupyter notebook with all code provided. First, they fit a neural network with Fourier features as a purely data-driven approach and observe its failure to extrapolate beyond the training data. Second, they fit a physics-based two-frequency solution derived from the coupled ODE using gradient descent, beginning from random initial guesses in order to expose a concrete failure mode of gradient-based optimization. Third, they apply a hybrid approach in which two Fourier-peak frequencies extracted from the data serve as initial guesses for gradient descent, demonstrating how importing mathematical structure into the optimization step can overcome that failure. We find that Fourier-based initialization improves the reliability of gradient-based fitting and yields a strong data fit. The assignment concludes with a transfer task in which students apply these ideas to a new engineering scenario and argue for the approach they would choose.
Cite
APA
Truong, H., & Bennett, A. (2026). Coupled-Pendulum Modeling in an ODE Class: An Assignment on Fourier-Initialized Gradient Descent in Machine Learning. CODEE Journal, 20(2), 1-18. https://doi.org/10.5642/codee.outy6782
Vancouver
Truong H, Bennett A. Coupled-Pendulum Modeling in an ODE Class: An Assignment on Fourier-Initialized Gradient Descent in Machine Learning. CODEE Journal. 2026;20(2):1-18. doi:10.5642/codee.outy6782
BibTeX
@article{Truong2026,
author = {Truong, Huy and Bennett, Andrew},
title = {Coupled-Pendulum Modeling in an ODE Class: An Assignment on Fourier-Initialized Gradient Descent in Machine Learning},
journal = {CODEE Journal},
year = {2026},
volume = {20},
number = {2},
pages = {1--18},
doi = {10.5642/codee.outy6782}
}
EUVIMED