Lesson 5 of 15
Duffing Oscillator
Duffing Oscillator
The Duffing oscillator is a driven nonlinear oscillator modelling a mass in a double-well potential with damping and periodic forcing:
With parameters δ = 0.3, α = −1, β = 1, γ = 0.5, ω = 1.2, the system exhibits a rich variety of behaviour: periodic orbits, period-doubling cascades, and fully chaotic attractors depending on the forcing amplitude γ.
The term −αx − βx³ creates a double-well potential (two stable equilibria). The periodic driving can kick the system from one well to the other chaotically — a model for physical phenomena from buckled beams to certain electronic circuits.
Implement the following functions:
duffing_deriv(x, y, t, delta, alpha, beta, gamma, omega)— compute the derivatives (ẋ, ẏ) at time tduffing_euler(x0, y0, delta, alpha, beta, gamma, omega, dt, steps)— integrate using Euler's method, advancing t by dt each step, returning final (x, y)
Python runtime loading...
Loading...
Click "Run" to execute your code.