A simple vibration problem
A centered finite difference scheme; step 1 and 2
A centered finite difference scheme; step 3
A centered finite difference scheme; step 4
Computing the first step
The computational algorithm
Operator notation; ODE
Operator notation; initial condition
Computing \( u^{\prime} \)
Implementation
Core algorithm
Plotting
Main program
User interface: command line
Running the program
Verification
First steps for testing and debugging
Checking convergence rates
Implementational details
Nose test
Long time simulations
Effect of the time step on long simulations
Using a moving plot window
Analysis of the numerical scheme
Movie of the phase error
We can derive an exact solution of the discrete equations
Calculations of an exact solution of the discrete equations
Solving for the numerical frequency
Polynomial approximation of the phase error
Plot of the phase error
Exact discrete solution
Convergence of the numerical scheme
Stability
The stability criterion
Summary of the analysis
Alternative schemes based on 1st-order equations
Rewriting 2nd-order ODE as system of two 1st-order ODEs
The Forward Euler scheme
The Backward Euler scheme
The Crank-Nicolson scheme
Comparison of schemes via Odespy
Forward and Backward Euler and Crank-Nicolson
Phase plane plot of the numerical solutions
Plain solution curves
Observations from the figures
Runge-Kutta methods of order 2 and 4; short time series
Runge-Kutta methods of order 2 and 4; longer time series
Crank-Nicolson; longer time series
Observations of RK and CN methods
Energy conservation property
Derivation of the energy conservation property
Remark about \( E(t) \)
The Euler-Cromer method; idea
The Euler-Cromer method; complete formulas
Euler-Cromer is equivalent to the scheme for \( u^{\prime\prime}+\omega^2u=0 \)
The schemes are not equivalent wrt the initial conditions
Generalization: damping, nonlinear spring, and external excitation
A centered scheme for linear damping
Initial conditions
Linearization via a geometric mean approximation
A centered scheme for quadratic damping
Initial condition for quadratic damping
Algorithm
Implementation
Verification
Demo program
Euler-Cromer formulation
Staggered grid
Linear damping
Quadratic damping
Initial conditions