Lesson 7 of 15

Van der Pol Oscillator

Van der Pol Oscillator

The Van der Pol oscillator is a nonlinear oscillator with self-sustaining oscillations. It was originally developed to model vacuum tube circuits but appears throughout biology, physics, and engineering.

The Equations

dx/dt = y
dy/dt = μ·(1 - x²)·y - x

The parameter μ controls the nonlinearity:

  • μ = 0: Simple harmonic oscillator (no damping/driving)
  • μ > 0: System has a limit cycle — all trajectories spiral toward a stable periodic orbit
  • Large μ: Relaxation oscillations with sharp transitions

Limit Cycles

Unlike fixed-point attractors, the Van der Pol oscillator has a limit cycle attractor. Regardless of initial conditions, trajectories converge to the same closed orbit in phase space. This is a hallmark of many biological oscillators (heartbeat, circadian rhythms).

Euler Integration

We use simple Euler integration with timestep dt:

x_{n+1} = x_n + dt·(dx/dt)
y_{n+1} = y_n + dt·(dy/dt)

Your Task

Implement:

  1. vdp_deriv(x, y, mu) — compute derivatives (dx/dt, dy/dt)
  2. vdp_euler(x0, y0, mu, dt, steps) — integrate using Euler method
  3. vdp_amplitude(x0, y0, mu, dt, steps, n_keep) — find max amplitude after transients
Python runtime loading...
Loading...
Click "Run" to execute your code.