$$ \newcommand{\half}{\frac{1}{2}} \newcommand{\tp}{\thinspace .} \newcommand{\uex}{{u_{\small\mbox{e}}}} \newcommand{\normalvec}{\boldsymbol{n}} \newcommand{\Oof}[1]{\mathcal{O}(#1)} \renewcommand{\u}{\boldsymbol{u}} \renewcommand{\v}{\boldsymbol{v}} \newcommand{\acc}{\boldsymbol{a}} \newcommand{\rpos}{\boldsymbol{r}} \newcommand{\e}{\boldsymbol{e}} \newcommand{\F}{\boldsymbol{F}} \newcommand{\ii}{\boldsymbol{i}} \newcommand{\jj}{\boldsymbol{j}} \newcommand{\ir}{\boldsymbol{i}_r} \newcommand{\ith}{\boldsymbol{i}_{\theta}} $$

Table of contents

Finite difference discretization
      A basic model for vibrations
      A centered finite difference scheme
Implementation
      Making a solver function
      Verification
      Scaled model
Long time simulations
      Using a moving plot window
      Making animations
      Using Bokeh to compare graphs
      Using a line-by-line ascii plotter
      Empirical analysis of the solution
Analysis of the numerical scheme
      Deriving a solution of the numerical scheme
      Exact discrete solution
      Convergence
      The global error
      Stability
      About the accuracy at the stability limit
Alternative schemes based on 1st-order equations
      The Forward Euler scheme
      The Backward Euler scheme
      The Crank-Nicolson scheme
      Comparison of schemes
      Runge-Kutta methods
      Analysis of the Forward Euler scheme
Energy considerations
      Derivation of the energy expression
      An error measure based on energy
The Euler-Cromer method
      Forward-backward discretization
      Equivalence with the scheme for the second-order ODE
      Implementation
      The velocity Verlet algorithm
Generalization: damping, nonlinear spring, and external excitation
      A centered scheme for linear damping
      A centered scheme for quadratic damping
      A forward-backward discretization of the quadratic damping term
      Implementation
      Verification
      Visualization
      User interface
      The Euler-Cromer scheme for the generalized model
Exercises and Problems
      Problem 1: Use linear/quadratic functions for verification
      Exercise 2: Show linear growth of the phase with time
      Exercise 3: Improve the accuracy by adjusting the frequency
      Exercise 4: See if adaptive methods improve the phase error
      Exercise 5: Use a Taylor polynomial to compute \( u^1 \)
      Exercise 6: Find the minimal resolution of an oscillatory function
      Exercise 7: Visualize the accuracy of finite differences for a cosine function
      Exercise 8: Verify convergence rates of the error in energy
      Exercise 9: Use linear/quadratic functions for verification
      Exercise 10: Use an exact discrete solution for verification
      Exercise 11: Use analytical solution for convergence rate tests
      Exercise 12: Investigate the amplitude errors of many solvers
      Exercise 13: Minimize memory usage of a vibration solver
      Exercise 14: Implement the solver via classes
      Exercise 15: Interpret \( [D_tD_t u]^n \) as a forward-backward difference
      Exercise 16: Use a backward difference for the damping term
      Exercise 17: Analysis of the Euler-Cromer scheme
Applications of vibration models
      Oscillating mass attached to a spring
      General mechanical vibrating system
      A sliding mass attached to a spring
      A jumping washing machine
      Motion of a pendulum
      Motion of an elastic pendulum
      Bouncing ball
      Electric circuits
Exercises
      Exercise 18: Simulate resonance
      Exercise 19: Simulate oscillations of a sliding box
      Exercise 20: Simulate a bouncing ball
      Exercise 21: Simulate an elastic pendulum
      Exercise 22: Simulate an elastic pendulum with air resistance
References