Skip to content

Duffing

Systems / ODEs / Chaotic attractors

A driven double-well oscillator — the textbook forced-chaos system with a fractal basin boundary.

continuous · ODE3 dimensionsforcedchaotic

Start here

Python
import tsdynamics as ts

system = ts.systems.Duffing()
traj = system.run(final_time=20.0, dt=0.01, seed=0)
ts.plot(traj)

traj.t contains the sample times and traj.y the state array; system.info shows the defaults. In a notebook the last line displays the plot. In a Python script, call .show() on it to open a window, or .save("trajectory.svg") to export it.

With an adaptive ODE solver, dt sets the output spacing; rtol and atol control local integration error. For a fixed-step solver, reduce dt to check numerical convergence.

state projection (x, y); playback follows arc length, not physical speed. Interactive: drag to rotate; use the play/pause control in the viewer.

This finite simulation illustrates one initial condition and view. The diagnostics below report their own inputs and observation windows.

Dynamics at the default parameters

Lyapunov exponents measure separation rates along an orbit. The Kaplan–Yorke dimension is derived from those rates, not a direct geometric measurement. Finite runs depend on the initial condition, transient and observation window; a value near zero needs a convergence check.

Lyapunov spectrum
Finite-time / numerical estimate
$+0.1046,\; +7.813e-05,\; -0.2046$
per time unit
Method and evidence

Benettin QR tangent dynamics

Finite-time estimate, not a convergence certificate. All state-space directions were computed.

Settings

{
  "backend": "jit",
  "k": 3,
  "final_time": 400.0,
  "transient": 100.0,
  "dt": 0.1,
  "ic": [
    -1.1635382,
    -0.5092374,
    0.0
  ],
  "rtol": 1e-09,
  "atol": 1e-12,
  "solver": "rk45"
}

Preparation

{
  "seed": 290880041,
  "ic_policy": "declared/in-basin start, else seeded small ball"
}

Estimator runtime in the recorded environment: 0.0133 s.

Reference target and the library's check configuration, separate from the measurement above. The source identifies the target; kwargs, ic and atol describe the local validation run. They are not published confidence intervals or a claim that the source used those solver settings.

{
  "status": "reference",
  "n_positive": 1,
  "zero_band": 0.0,
  "kwargs": {
    "final_time": 4000.0,
    "dt": 0.02,
    "transient": 400.0
  },
  "source": "chaotic double-well regime (Ueda 1979); the exact value of the leading exponent and the analytic exponent sum -delta are pinned in tests/test_catalogue_literature.py",
  "citation": "Duffing (1918), Erzwungene Schwingungen bei veränderlicher Eigenfrequenz, Vieweg, Braunschweig"
}
Kaplan–Yorke dimension
Finite-time / numerical estimate
$D_{KY} = 2.511$
Method and evidence

Kaplan–Yorke interpolation of the recorded spectrum

Lyapunov dimension estimate; equality with a fractal or information dimension requires additional dynamical assumptions.

Settings

{
  "backend": "jit",
  "k": 3,
  "final_time": 400.0,
  "transient": 100.0,
  "dt": 0.1,
  "ic": [
    -1.1635382,
    -0.5092374,
    0.0
  ],
  "rtol": 1e-09,
  "atol": 1e-12,
  "solver": "rk45"
}
Divergence ∇·f
Symbolic
$\nabla\!\cdot f = - \delta$
constant in the state
Equilibria / fixed points
Finite-time / numerical estimate
none found in this search
Method and evidence

A seeded numerical search, not a completeness proof. Stability means linear asymptotic stability. Marginal/nonhyperbolic roots have no nonlinear stability verdict from this linearisation.

max Re(eigenvalue) for flows; max |multiplier| - 1 for maps. Boundary band: 1e-7 * max(1, max |eigenvalue|).

Settings

{
  "method": "newton",
  "n_seeds": 80,
  "seed": 0
}

Estimator runtime in the recorded environment: 0.0368 s.

Recorded parameters and software
{
  "parameters": {
    "alpha": 1.0,
    "beta": -1.0,
    "delta": 0.1,
    "gamma": 0.35,
    "omega": 1.4
  },
  "parameter_expressions": {},
  "state_dimension": 3,
  "explicit_time": false,
  "library_version": "6.0.3",
  "python": "3.14.8",
  "numpy": "2.4.4",
  "scipy": "1.17.1",
  "protocol_version": 1
}

Definition

\[ \begin{aligned} \dot{x} &= y \\ \dot{y} &= - \alpha x^{3} - \beta x - \delta y + \gamma \cos{\left(z \right)} \\ \dot{z} &= \omega \end{aligned} \]

Parameters

Symbol Default Role
alpha 1 linear stiffness coefficient
beta -1 cubic stiffness coefficient (negative = double well)
delta 0.1 linear damping coefficient
gamma 0.35 amplitude of the periodic forcing
omega 1.4 angular frequency of the periodic forcing

State variables: x, y, z

Explore further

Reference

Duffing (1918), Erzwungene Schwingungen bei veränderlicher Eigenfrequenz, Vieweg, Braunschweig

BibTeX
BibTeX
@misc{duffing,
  title = {Duffing system},
  note = {Duffing (1918), Erzwungene Schwingungen bei veränderlicher Eigenfrequenz, Vieweg, Braunschweig}
}