Home > LIBRARY > JOURNALS > CURRENT_JOURNALS > CODEE > Vol. 20 (2026) > Iss. 2 (2026)
Publication Date
7-3-2026
Keywords
Machine learning, Coupled pendulums, Fourier analysis, Gradient descent, Differential equations education, Jupyter Notebook
Disciplines
Mathematics | Physical Sciences and Mathematics | Science and Mathematics Education
Abstract
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.
Recommended Citation
Truong, Huy and Bennett, Andrew
(2026)
"Coupled-Pendulum Modeling in an ODE Class: An Assignment on Fourier-Initialized Gradient Descent in Machine Learning,"
CODEE Journal:
Vol. 20:
Iss.
2, Article 8.
Available at:
https://scholarship.claremont.edu/codee/vol20/iss2/8