An Interactive Textbook and Software Library for Learning About Mechanical Vibrations
Thursday, November 9th, 2017
Jason K. Moore and Kenneth Lyons
Mechanical and Aerospace Engineering Department
University of California, Davis
● Upper level elective (juniors and seniors)
● 10-30 students
● 4 hours per week, 10 weeks + 1 exam week
● Prereqs: dynamics and programming
○ In class notebook exercises
○ Weekly homeworks
○ Midterm exam
○ Class project
● Course website: https://moorepants.github.io/eng122/
1) Students will be able to analyze vibrational measurement data to draw conclusions
about the measured system's vibrational nature and describe how the system
2) Students will be able to create simple mathematical and computational models of
real vibrating systems that can be used to answer specific questions about the
system by concisely demonstrating the vibrational phenomena.
3) Students will be able to design a mechanical structure that has desirable vibrational
Key aspect is the order of these topics and that we do not have an objective associated
with analytical understanding of the concepts.
● That students can learn about mechanical vibrations engineering through
"computational thinking" and "computational experimentation", i.e. actively
interacting with a computer by writing code to simulate and analyze computational
models and experimental data.
● That the computer allows students to solve vibration engineering problems without
knowing all of the mathematical theory a priori. This means that we can motivate
students to dig deeper into the theory and by presenting it posteriori when the
motivation is high. The students will be introduced to data analysis techniques to
study vibrations before analytical techniques.
● Students learn best by doing. The content is meant to used in class while the
instructors act as a coach through the learning.
● That each lesson should have a motivated real life example that drives the
● Open access materials promote easy reuse, remixing, and dissemination.
Before computers analytical mathematics and experimentation were the two ways to
learn and reason about the world. The computer (especially fast ones) provides a new
method. “Computational Thinking” is a way to think and solve problems using the
constructs and abstractions in a computer instead of the ones in analytic mathematics.
Example: What is the probability of rolling at least two 3’s in 10 dice rolls?
New way: just write some code
from random import choice
count = 0
num_trials = 10000
for trial in range(num_trials):
rolls = 
for roll in range(10):
rolls.append(choice([1, 2, 3, 4, 5, 6]))
if len([r for r in rolls if r == 3]) > 1:
count += 1
print(count / num_trials)
Old way: remember the binomial theorem?
The idea that you can run experiments (simulations) to learn about the world without
having the real physical object and phenomena. This requires that you can create
computational models of the real world that predict the phenomena of interest. Once
you have a sufficient model, you can do thousands, millions of experiments.
● Easy language to learn
● Can hide and abstract away programming details, language should be hidden and
the engineering concepts should be the focus
● Python objects can be designed to map directly to engineering concepts and
● Rich and powerful scientific libraries (NumPy, SciPy, Pandas, matplotlib, SymPy,
● Jupyter Notebooks
● Learning Python provides a very valuable career skill
● It’s the professor’s favorite language :)
Resonance: The Software Library
● Open Source: https://github.com/moorepants/resonance (CC-BY 4.0)
● Docs: http://resonance.readthedocs.io
● Conda: https://anaconda.org/conda-forge/resonance
● Pip: https://pypi.org/project/resonance/
● Students only create functions, no need to understand classes and objects.
● Hide the simulation details (linear/nonlinear ODE solutions).
● Centered around the “System” object. Systems represent real things: a car, a
bridge, a bicycle, an airplane wing.
● Easy visualizations (time history plots and animations of systems)
● Extra informative and lots of error messages (try to predict student mistakes)
● Students can use and construct systems.
● Don’t teach programming for the sake of teaching programming. Show them how to
solve problems and introduce programming along the way to solve those problems.
● Open Access (CC-BY)
● Written in Jupyter Notebooks: mixes
prose, math, videos, graphics, code,
● Writing it as we go along this quarter
● All chapters should have context: a real
problem to solve
Notebook demo: Book Balancing on a Cup
Statically rendered version [Introducing Mechanical Vibrations By Investigating a Book
Oscillating on a Cylindrical Cup]
Notebook demo: Car Driving On a Road
Statically rendered version [Vertical Vibration of a Quarter Car]
Providing a Jupyter Environment
Microsoft Azure Notebooks
CoCalc (formerly SageMathCloud)
Google Colaboratory JupyterHub
JupyterHub allows us the freedom to set things
up the way we want.
Many options for deployment, customization, etc.
Free and open source (BSD).
Friendly and active community, consisting of
people that work on Jupyter itself.
Written to be administered by you, so there is
documentation for running your own JupyterHub.
Our JupyterHub Configuration
● Bare metal server
● Local user accounts
● Google OAuth (students use their UCD accounts)
● Ansible deployment: https://github.com/jupyterhub/jupyterhub-deploy-teaching
This setup achieves our main goals:
● run persistently for several years with low cost
● install/update packages as we see fit (sometimes right before class starts)
● simple to maintain*
● restrict access to specific UCD students
Running the Course
The nbgrader extension lets us release, collect, and grade notebooks
Our Experience So Far
● Students seem motivated to learn
about vibrations (they want to know
how the simulations work)
● Students are able to work at different
levels of abstraction for solving
● Students can approach fairly
complex systems and run the entire
● They like Python.
● The overhead of introducing a
● resonance lib needs to expose the
● Classwork can move too fast
● nbgrader workflow isn’t ideal for our
● Students haven’t quite grokked good
notebook style yet
● Not quite sure yet if the learning
objectives have been met
Course website: https://moorepants.github.io/eng122/
Jason K. Moore
● @moorepants (twitter, Github, G+, etc)
Much of this work has been made possible through the Undergraduate Instructional
Innovation Program funds provided by the Association of American Universities (AAU)
and Google which is administered by UC Davis's Center for Educational Effectiveness.