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' \)
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
Deriving an exact numerical solution; ideas
Deriving an exact numerical solution; calculations (1)
Deriving an exact numerical; calculations (2)
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
Equivalence with the scheme for the second-order ODE
Comparison of the treatment of initial conditions
A method utilizing a staggered mesh
Centered differences on a staggered mesh
Comparison with the scheme for the 2nd-order ODE
Implementation of a staggered mesh; integer indices
Implementation of a staggered mesh; half-integer indices (1)
Implementation of a staggered mesh; half-integer indices (2)
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