Mass Spring System with an External Force

Displacement (y) vs Time (t)

Examples

About This Simulation

System Description

This simulation models the dynamics of a forced harmonic oscillator subject to external forcing, governed by the second-order linear ordinary differential equation:

m \ddot{y} + c \dot{y} + k y = F(t)

where m is the mass, c is the damping coefficient, k is the spring constant, and F(t) is the time-dependent external forcing function.

Observable Phenomena

By adjusting system parameters and forcing functions, one can observe:

  • Transient behavior and approach to steady state
  • Resonance when forcing frequency matches natural frequency
  • Beats from near-resonant forcing
  • Impulse response from Dirac delta functions
  • Delayed activation via Heaviside step functions

Special Functions

Dirac delta: \delta(t-c) represents an instantaneous impulse at t=c. When triggered, velocity increases by \Delta v = A/m where A is the impulse amplitude.

Heaviside step: u(t-c) equals 0 for t < c and 1 for t \geq c, enabling delayed forcing activation.

Numerical Integration

The simulation employs adaptive time-stepping with method selection based on system stiffness:

  • Velocity Verlet: Symplectic integrator for non-stiff systems, providing excellent energy conservation in undamped or lightly damped regimes.
  • Implicit methods: For stiff systems (high damping or frequency), the simulator switches to backward Euler (first step) followed by second-order backward differentiation formula (BDF-2) for stability.
  • Impulse detection: Dirac delta impulses are detected and applied via direct velocity modification when |t - c| < \Delta t / 2.