This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · posts/chuas-circuit-double-scroll

The double scroll of Chua's circuit

Two capacitors, an inductor, a resistor and one diode whose current is a three-piece straight line. The voltages never settle and never repeat: they wind around two centers, hopping between them at irregular times. Nearby starts separate like with , which is what a separate scipy calculation gives within the scatter expected of a run this long.

The exponent is measured here by following two copies of the circuit started apart and pulling them back to that distance after every step (Benettin's method). The reference, in posts/refs/chuas-circuit-double-scroll.py, uses a different method and a different integrator: scipy's DOP853 at a tolerance of , carrying the linearized equations along the orbit, over 24000 time units. It gives . Split into 40 windows of 600 time units (the length of this post's run), the estimates scatter with a standard deviation of 0.0165, so the test allows three of those: 0.05.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

The circuit

Chua's circuit is an electronic circuit designed by Leon Chua to be chaotic: its voltages follow a definite rule, with no randomness in it, yet never settle into a repeating pattern. It has two capacitors, an inductor, a resistor, and one nonlinear part, a Chua diode: a small circuit whose current is a function of the voltage across it made of three straight pieces. In the middle the slope is and outside it is , and both slopes are negative, so the part feeds energy into the circuit instead of absorbing it.

In scaled units, with and the two capacitor voltages and the inductor current, the equations are the three above. The program uses the standard double-scroll values , , and .

[1]lines 39–68

Inside the current is , so , and outside it is for , so . The negative slopes make the origin unstable: a small voltage grows instead of dying away. Far out, the circuit's other parts win and push it back. With nowhere stable to rest, the state keeps moving.

Stepping the equations

The program advances the state with the classical fourth-order Runge-Kutta method at a step of , then runs 20000 steps (100 time units) so the state reaches the set it keeps returning to, the attractor, before anything is measured.

[2]lines 85–124

The double scroll

Now follow the state for 210 time units (42000 steps). Record , and count how often it changes sign: the attractor has two lobes, one around and one around , and a sign change is a hop from one to the other. Before looking: if the motion were periodic, the hops would come at a fixed rhythm. Do they?

[3]lines 136–200

In 210 time units the state changed lobes 41 times (jumps): a few turns around one center, then a few around the other, with the number of turns changing from visit to visit. That irregular count is the visible sign of chaos. A scipy run a hundred times longer (posts/refs/chuas-circuit-double-scroll.py) averages 40.9 hops per 210 time units, and single stretches of that length range from 34 to 50, with a standard deviation of 3.1; the test allows three of those.

How fast nearby starts separate

Chaos has a measurable rate. Start two copies of the circuit a distance apart. On average the distance grows like ; is the largest Lyapunov exponent, and a positive is what chaos means in numbers. The two copies cannot be left alone for long, since once their distance is as large as the attractor it stops growing. So after every step the program measures the new distance , adds to a running sum, and moves the second copy back along the same direction to distance . The exponent is the sum divided by the elapsed time.

The run is 120000 steps, 600 time units. The reference value from scipy is , and a run of this length scatters about the true value with a standard deviation of .

[4]lines 227–281

The estimate wanders early, while one or two passes near the center of a lobe can move it, and settles as the time grows. This run gives (lyap), against scipy's . At that rate a difference of in the starting voltage grows to order one, the size of the attractor, in time units (horizon). Past that time the equations are still exact, but a measurement of the starting voltage to eight digits no longer predicts which lobe the circuit is on.

[5]lines 294–295