The Duffing oscillator is one of the standard models of nonlinear vibration. It extends the ordinary driven damped oscillator by adding a cubic restoring-force term. The equation is
\[
x'' + \delta x' + \alpha x + \beta x^3 = \gamma \cos(\omega t).
\]
Here \(\delta\) is the damping strength, \(\alpha\) is the linear stiffness parameter, \(\beta\) controls the nonlinearity, \(\gamma\) is the forcing amplitude, and \(\omega\) is the driving angular frequency.
If \(\beta=0\), the system reduces to the familiar linear forced oscillator. When \(\beta\neq 0\), the restoring force depends nonlinearly on displacement. This changes the response dramatically. For positive \(\beta\), the oscillator is called hardening, because large oscillations behave as if the spring becomes stiffer. For negative \(\beta\), the oscillator is softening.
The Duffing equation is important because it shows how even a simple-looking system can display rich behavior: distorted oscillations, amplitude-dependent frequency shifts, multiple stable responses, hysteresis, and in some parameter regions behavior associated with chaos.
To simulate it numerically, it is rewritten as a first-order system:
\[
x' = v,
\qquad
v' = -\delta v - \alpha x - \beta x^3 + \gamma \cos(\omega t).
\]
This form is suitable for numerical integration methods such as the classical fourth-order Runge–Kutta method (RK4). RK4 advances the state \((x,v)\) in time using several intermediate slope evaluations, producing good accuracy for moderate time steps.
For the sample parameters
\[
\alpha=1,\qquad \beta=0.3,\qquad \gamma=0.5,\qquad \omega=1,\qquad \delta=0.1,
\]
the system is weakly damped, driven periodically, and has a positive cubic nonlinearity. The resulting motion is not exactly sinusoidal. Instead, the trajectory in phase space bends and distorts because the restoring force is no longer purely proportional to \(x\).
A particularly useful visualization is the phase-space plot, where velocity \(v\) is plotted against displacement \(x\). For linear oscillators this often produces ellipses or nearly regular loops. For nonlinear oscillators, the phase portrait can stretch, tilt, and form more complicated shapes. Under stronger forcing or different parameters, the geometry can become much more intricate.
Another useful viewpoint is the driving force
\[
F(t)=\gamma\cos(\omega t).
\]
The competition between damping, restoring forces, and this external drive determines the long-term behavior. Because the forcing keeps injecting energy while damping removes it, the motion often approaches a driven steady response rather than simply decaying away.
At more advanced level, one studies Poincaré sections, bifurcation diagrams, and chaotic regimes. But the preview given here already captures the essential ideas: nonlinear restoring force, numerical time integration, phase-space structure, and the difference between linear and nonlinear response.
This calculator uses RK4 to produce a practical simulation of the Duffing equation and helps visualize the nonlinear trajectory directly.