Experimenting delay differential equations with jitCDDE

This post introduces jitCDDE (just-in-time compilation for delay differential equations), a Python library that takes a symbolic description of a delay differential equation (DDE), translates it into C code, compiles it on the fly and lets you integrate it from Python. It is designed in analogy to jitCODE (for ordinary differential equations) and implements the adaptive Bogacki–Shampine Runge–Kutta method of Thompson and Shampine.

Teaser imageTeaser image

Experimenting delay differential equations with jitCDDE

The goal of this post is to give you a hands-on introduction to jitCDDE. We start with a simple one-dimensional delay differential equation (the Mackey–Glass equation) and progressively move to more involved examples: a two-dimensional (coupled) system, a neutral DDE, a state-dependent delay, a large network of oscillators, and the computation of Lyapunov exponents. Each section shows the equations, the code, and a figure with the resulting curves.

All examples are based on the jitCDDE documentation and example scripts. The full documentation is at https://jitcdde.readthedocs.io.

1. Mackey–Glass: a one-dimensional DDE

The canonical example of a DDE is the Mackey–Glass equation:

$$\dot{y} = f(y) = \beta \frac{y(t-\tau)}{1 + y(t-\tau)^n} - \gamma \, y(t)$$

with $\beta = 0.25$, $\gamma = 0.1$, $n = 10$ and $\tau = 15$. This equation is famous for producing chaotic dynamics, and it is the standard showcase for DDE solvers.

We want the initial condition and past to be $y(t<0) = 1$.

In [1]:
import numpy as np
import matplotlib.pyplot as plt
from jitcdde import jitcdde, t, y

τ = 15
n = 10
β = 0.25
γ = 0.1

f = [ β * y(0,t-τ) / (1 + y(0,t-τ)**n) - γ*y(0) ]
DDE = jitcdde(f)
DDE.constant_past([1.0])
DDE.step_on_discontinuities()

times = np.arange(DDE.t + 1, DDE.t + 10000, 1)
data = np.vstack([DDE.integrate(time) for time in times])

# Full time series + narrow column with a short segment (order of the delay)
fig = plt.figure(figsize=(14, 4))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0])
ax.plot(times, data[:, 0], lw=0.4)
ax.set_xlabel('t'); ax.set_ylabel('y(t)')
ax.set_title('Mackey–Glass: full time series')
ax2 = fig.add_subplot(gs[1])
seg = slice(-9*τ, None)
ax2.plot(times[seg], data[:, 0][seg], lw=1.2)
ax2.set_xlabel('t'); ax2.set_title('Short segment (~τ)')
plt.savefig('../files/2026-12-02-jitcdde-mackey-glass.svg', bbox_inches='tight')
plt.show()
print('final state:', data[-1])
Generating, compiling, and loading C code.
Using default integration parameters.
/var/folders/qt/n82pbkv93fjb7bpt0pj1992w0000gn/T/ipykernel_5646/2335193629.py:16: UserWarning: The target time is smaller than the current time. No integration step will happen. The returned state will be extrapolated from the interpolating Hermite polynomial for the last integration step. You may see this because you try to integrate backwards in time, in which case you did something wrong. You may see this just because your sampling step is small, in which case there is no need to worry (though you should think about increasing your sampling time).
  data = np.vstack([DDE.integrate(time) for time in times])
No description has been provided for this image
final state: [0.68633687]

A few things to note:

  • t and y are symbols imported from jitcdde. y(0,t-τ) denotes the state of component 0 at the delayed time t-τ. The right-hand side of the DDE is written as a list of symbolic expressions (one per state component).
  • constant_past initialises the past and automatically starts integration at t=0.
  • The derivative evaluated from the initial conditions ($f(0) = 0.025$) does not match $\dot{y}(0) = 0$, which would cause a problem. step_on_discontinuities() takes tailored integration steps to smooth out the discontinuity.
  • integrate(time) returns the state at the requested time; we collect the states into data and plot the result.

The Mackey–Glass attractor

For a known chaotic parameter set ($\beta = 0.25$, $\gamma = 0.1$, $n = 10$, $\tau = 15$), the attractor is most naturally shown as a time-delay embedding — the plot of $y(t)$ versus $y(t-\tau)$. This is the classic representation of a DDE attractor (it is infinite-dimensional in general, but this 2D projection captures the essential structure).

In [2]:
fig = plt.figure(figsize=(14, 4))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0])
ax.plot(data[τ:, 0], data[:-τ, 0], lw=0.4)
ax.set_xlabel('y(t)'); ax.set_ylabel('y(t-τ)')
ax.set_title('Attractor: time-delay embedding')
ax2 = fig.add_subplot(gs[1])
seg = slice(-3*τ, None)
ax2.plot(data[τ:, 0][seg], data[:-τ, 0][seg], lw=1.2)
ax2.set_xlabel('y(t)'); ax2.set_ylabel('y(t-τ)')
ax2.set_title('Short segment')
plt.savefig('../files/2026-12-02-jitcdde-mackey-glass-attractor.svg', bbox_inches='tight')
plt.show()
No description has been provided for this image

The time-delay embedding reveals the chaotic attractor: the curve is densely filled with fine structure, and the narrow column shows the fine-scale structure of the attractor over a short segment.

Three other meta parameters with different attractors

The classic chaotic Mackey–Glass parameters ($\beta = 0.2$, $\gamma = 0.1$, $n = 10$) transition from regular motion to chaos as the delay $\tau$ increases past $\tau \approx 16.45$. Here we show the attractor (time-delay embedding) for three delays: $\tau = 10$ (regular, limit cycle), $\tau = 17.2$ (chaotic), and $\tau = 30$ (hyperchaotic).

In [3]:
fig, axes = plt.subplots(1, 3, figsize=(18, 5))
for ax, τ in zip(axes, [10.0, 17.2, 30.0]):
    β = 0.2; γ = 0.1; n = 10
    f = [ β * y(0,t-τ) / (1 + y(0,t-τ)**n) - γ*y(0) ]
    DDE = jitcdde(f)
    DDE.constant_past([0.5])
    DDE.step_on_discontinuities()
    times = np.arange(DDE.t + 1, DDE.t + 2000, 1)
    data = np.vstack([DDE.integrate(time) for time in times])
    ax.plot(data[int(τ):, 0], data[:-int(τ), 0], lw=0.4)
    ax.set_xlabel('y(t)'); ax.set_ylabel('y(t-τ)')
    ax.set_title(f'τ={τ}')
plt.savefig('../files/2026-12-02-jitcdde-mackey-glass-attractors.svg', bbox_inches='tight')
plt.show()
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
/var/folders/qt/n82pbkv93fjb7bpt0pj1992w0000gn/T/ipykernel_5646/611216404.py:9: UserWarning: The target time is smaller than the current time. No integration step will happen. The returned state will be extrapolated from the interpolating Hermite polynomial for the last integration step. You may see this because you try to integrate backwards in time, in which case you did something wrong. You may see this just because your sampling step is small, in which case there is no need to worry (though you should think about increasing your sampling time).
  data = np.vstack([DDE.integrate(time) for time in times])
Using default integration parameters.
/var/folders/qt/n82pbkv93fjb7bpt0pj1992w0000gn/T/ipykernel_5646/611216404.py:9: UserWarning: The target time is smaller than the current time. No integration step will happen. The returned state will be extrapolated from the interpolating Hermite polynomial for the last integration step. You may see this because you try to integrate backwards in time, in which case you did something wrong. You may see this just because your sampling step is small, in which case there is no need to worry (though you should think about increasing your sampling time).
  data = np.vstack([DDE.integrate(time) for time in times])
No description has been provided for this image

2. Two Roesslers: a coupled multi-dimensional system

Next, we move to a six-dimensional system: two Roessler oscillators (each three-dimensional) coupled through a delay. The equations are:

$$\dot{y}_1 = \omega_1 (-y_2 - y_3), \quad \dot{y}_2 = \omega_1 (y_1 + 0.165\, y_2), \quad \dot{y}_3 = \omega_1 (0.2 + y_3 (y_1 - 10))$$ $$\dot{y}_4 = \omega_2 (-y_5 - y_6) + k (y_1(t-\tau) - y_4), \quad \dot{y}_5 = \omega_2 (y_4 + 0.165\, y_5), \quad \dot{y}_6 = \omega_2 (0.2 + y_6 (y_4 - 10))$$

with $\omega_1, \omega_2 \approx 0.89$, $k = 0.25$ and $\tau = 4.5$.

The Roessler oscillator is a Lorenz-type system — its attractor is a chaotic, torus-like structure in three dimensions. The coupled system inherits this chaotic behaviour. We plot the attractor of the first Roessler subsystem in 3D.

In [4]:
import numpy as np
import matplotlib.pyplot as plt
from jitcdde import jitcdde, t, y

rng = np.random.default_rng(seed=42)
ω = rng.normal(0.89, 0.0089, 2)
k = 0.25
delay = 4.5

f = [
 ω[0] * (-y(1) - y(2)),
 ω[0] * (y(0) + 0.165 * y(1)),
 ω[0] * (0.2 + y(2) * (y(0) - 10.0)),
 ω[1] * (-y(4) - y(5)) + k * (y(0,t-delay) - y(3)),
 ω[1] * (y(3) + 0.165 * y(4)),
 ω[1] * (0.2 + y(5) * (y(3) - 10.0))
]

DDE = jitcdde(f)

start_state = rng.uniform(-0.5, 0.5, 6)
DDE.add_past_point(-delay, start_state, np.zeros(6))
DDE.add_past_point(0.0, start_state, np.zeros(6))
DDE.step_on_discontinuities()

times = np.arange(DDE.t + 1, DDE.t + 1000, 0.1)
data = np.vstack([DDE.integrate(T) for T in times])

# 3D attractor of the first Roessler subsystem (y0, y1, y2)
fig = plt.figure(figsize=(14, 5))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0], projection='3d')
ax.plot(data[:, 0], data[:, 1], data[:, 2], lw=0.4, alpha=.7)
ax.set_xlabel('y0'); ax.set_ylabel('y1'); ax.set_zlabel('y2')
ax.set_title('Two Roesslers: first subsystem (3D attractor)')
ax2 = fig.add_subplot(gs[1])
seg = slice(-200, None)
ax2.plot(times[seg], data[:, 0][seg], lw=1.2)
ax2.set_xlabel('t'); ax2.set_ylabel('y0(t)')
ax2.set_title('Short segment')
plt.savefig('../files/2026-12-02-jitcdde-two-roesslers.svg', bbox_inches='tight')
plt.show()
Generating, compiling, and loading C code.
Using default integration parameters.
No description has been provided for this image

This example shows:

  • A multi-dimensional state: the right-hand side is a list of six expressions, one per state component.
  • add_past_point(time, state, derivative) to define the past explicitly — here we give two anchor points (at $-\tau$ and at $0$) with a zero derivative.
  • The coupling term k * (y(0,t-delay) - y(3)): the second Roessler oscillator depends on the delayed state of the first one.
  • The first Roessler subsystem has a Lorenz-type chaotic attractor, shown in 3D. The narrow column shows a short segment of the time series (~one delay).

3. A neutral DDE

In a neutral DDE, the derivative depends on the past derivative (not just the past state). This is the case for the example in the jitCDDE documentation, which describes a three-component oscillator system with a neutral delay term. The right-hand side is given as a dictionary mapping state symbols to expressions, and the past derivative is accessed with dy(i, time).

In [5]:
import numpy as np
import matplotlib.pyplot as plt
from symengine import exp, sqrt, tanh
from jitcdde import dy, jitcdde, t, y

rng = np.random.default_rng(seed=23)

sech = lambda x: 2/(exp(x)+exp(-x))
eps = 1e-5
abs_ = lambda x: sqrt(x**2+eps**2)

ε = [ 0.03966, 0.03184, 0.02847 ]
ν = [ 1, 2.033, 3.066 ]
μ = [ 0.16115668456085775, 0.14093420256851111, 0.11465065353644151 ]
ybar_0 = 0
τ = 1.7735
ζ = [ 0.017940997406325931, 0.015689701773967984, 0.012763648066925721 ]

ydot = [ y(i) for i in range(3,6) ]
y_tot     = lambda time: sum(  y(i,time) for i in range(  3) )
ydot_tot  = lambda time: sum(  y(i,time) for i in range(3,6) )
yddot_tot = lambda time: sum( dy(i,time) for i in range(3,6) )

f = { y(i): ydot[i] for i in range(3) }
f.update( { ydot[i]:
    μ[i] * sech(ybar_0 - y_tot(t-τ))**2 *
    (yddot_tot(t-τ) + 2*ydot_tot(t-τ)**2*tanh(ybar_0 - y_tot(t-τ)))
    - 2*ζ[i] * abs_(y_tot(t)) * ydot_tot(t)
    - ε[i] * ν[i] * ydot[i]
    - ν[i]**2 * y(i)
    for i in range(3)
} )

DDE = jitcdde(f, verbose=False)
DDE.constant_past(rng.normal(0, 1, 6))
DDE.adjust_diff()

times = DDE.t + np.arange(0.1, 100, 0.1)
data = np.vstack([DDE.integrate(time) for time in times])

# 3D attractor of the position components (y0, y1, y2)
fig = plt.figure(figsize=(14, 5))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0], projection='3d')
ax.plot(data[:, 0], data[:, 1], data[:, 2], lw=0.4)
ax.set_xlabel('y0'); ax.set_ylabel('y1'); ax.set_zlabel('y2')
ax.set_title('Neutral DDE: position attractor (3D)')
ax2 = fig.add_subplot(gs[1])
seg = slice(-120, None)
ax2.plot(times[seg], data[:, 0][seg], lw=1.2)
ax2.set_xlabel('t'); ax2.set_ylabel('y0(t)')
ax2.set_title('Short segment')
plt.savefig('../files/2026-12-02-jitcdde-neutral.svg', bbox_inches='tight')
plt.show()
No description has been provided for this image

Key points:

  • The right-hand side is a dictionary { y(i): ... } — jitCDDE accepts a list or a dictionary.
  • dy(i, time) gives the past derivative of component i (note: dy is not the same as the state).
  • adjust_diff() smoothens the derivative on a small time interval — here the past is defined by constant_past, and the derivative is adjusted to avoid a large initial discontinuity.
  • This is an experimental implementation (see the jitCDDE issue tracker); the neutral.py example shows a more efficient version with several delay terms.
  • The position components (y0, y1, y2) form a 3D attractor. The narrow column shows a short segment of the time series.

4. A state-dependent delay

Delays can depend on the state. Here we integrate

$$\dot{y} = -y(t - 2 - y(t)^2) + 5$$

so the delay is $\tau(t) = 2 + y(t)^2$. Because the delay changes, the error estimate is no longer exact, and max_delay must be provided manually.

In [6]:
import numpy as np
import matplotlib.pyplot as plt
from jitcdde import jitcdde, t, y

f = [ -y(0,t-2-y(0)**2) + 5 ]
DDE = jitcdde(f, max_delay=1e10)

eps = 0.1
DDE.add_past_point(-2.0,     [4.5],  [0.0])
DDE.add_past_point(-1.0-eps, [4.5],  [0.0])
DDE.add_past_point(-1.0+eps, [-0.5], [0.0])
DDE.add_past_point( 0.0,     [-0.5], [0.0])

DDE.integrate_blindly(0.01)

steps = np.linspace(0.9, 2, 30)
data = np.empty((steps.size + 1, 2))
for n_, time in enumerate([DDE.t, *steps]):
    data[n_] = [time, DDE.integrate(time)[0]]

fig = plt.figure(figsize=(14, 4))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0])
ax.plot(data[:, 0], data[:, 1], 'o-')
ax.set_xlabel('t'); ax.set_ylabel('y(t)')
ax.set_title('State-dependent delay: full trajectory')
ax2 = fig.add_subplot(gs[1])
seg = slice(-20, None)
ax2.plot(data[:, 0][seg], data[:, 1][seg], 'o-')
ax2.set_xlabel('t'); ax2.set_ylabel('y(t)')
ax2.set_title('Short segment')
plt.savefig('../files/2026-12-02-jitcdde-state-dependent.svg', bbox_inches='tight')
plt.show()
Generating, compiling, and loading C code.
Using default integration parameters.
/var/folders/qt/n82pbkv93fjb7bpt0pj1992w0000gn/T/ipykernel_5646/2669262247.py:19: UserWarning: The target time is smaller than the current time. No integration step will happen. The returned state will be extrapolated from the interpolating Hermite polynomial for the last integration step. You may see this because you try to integrate backwards in time, in which case you did something wrong. You may see this just because your sampling step is small, in which case there is no need to worry (though you should think about increasing your sampling time).
  data[n_] = [time, DDE.integrate(time)[0]]
No description has been provided for this image

Key points:

  • The delay t - 2 - y(0)**2 depends on the state — jitCDDE handles this, but the error estimate does not take the changing delay into account.
  • max_delay must be given manually (here a very large value, since the delay grows as y grows).
  • integrate_blindly(0.01) integrates with a fixed step size, ignoring the error estimate — useful for the initial transient.

5. A Kuramoto network with distributed delays

Now we scale up: a network of $n = 100$ delay-coupled Kuramoto oscillators,

$$\dot{y}_i = \omega + \frac{c}{n-1} \sum_{j=0}^{n-1} A_{ji} \sin(y_j(t-\tau_{ij}) - y_i(t))$$

with $\omega = 1$, $c = 42$, $\tau_{ij} \sim U([\pi/5, 2\pi])$, and $A$ the adjacency matrix of a random unweighted directed network with self-connections, where each node exists with probability $q = 0.05$.

This is a much larger system — 100 state components. Instead of plotting 100 overlapping phase curves (which is not legible), we plot the order parameter $r(t) = \left|\frac{1}{N} \sum_i e^{i\,y_i(t)}\right|$, which measures the synchrony of the network. This is the classic Kuramoto quantity, and it shows how the network transitions from disordered to synchronised.

For a more detailed look at the Kuramoto model, see also my post on the Kuramoto model.

In [7]:
import numpy as np
import matplotlib.pyplot as plt
from symengine import sin
from jitcdde import jitcdde, t, y

rng = np.random.default_rng(seed=42)
n = 100
ω = 1
c = 42
q = 0.05
A = rng.choice([1, 0], size=(n, n), p=[q, 1-q])
τ = rng.uniform(np.pi/5, 2*np.pi, size=(n, n))

def kuramotos():
    for i in range(n):
        yield ω + c/(n-1)*sum(
            sin(y(j,t-τ[i,j]) - y(i))
            for j in range(n)
            if A[j,i]
        )

solver = jitcdde(kuramotos, n=n, verbose=False, delays=τ.flatten())
solver.set_integration_parameters(rtol=0, atol=1e-5)
solver.constant_past(rng.uniform(0, 2*np.pi, n), time=0.0)
solver.integrate_blindly(np.max(τ), 0.1)

times = solver.t + np.arange(0, 400, 0.2)
data = np.array([solver.integrate(time) for time in times])

# Order parameter r(t)
phases = data % (2*np.pi)
r = np.abs(np.mean(np.exp(1j * phases), axis=1))

fig = plt.figure(figsize=(14, 4))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0])
ax.plot(times, r, lw=1.2)
ax.set_xlabel('t'); ax.set_ylabel('r(t)')
ax.set_title('Kuramoto network: order parameter')
ax2 = fig.add_subplot(gs[1])
seg = slice(-200, None)
ax2.plot(times[seg], r[seg], lw=1.5)
ax2.set_xlabel('t'); ax2.set_ylabel('r(t)')
ax2.set_title('Short segment')
plt.savefig('../files/2026-12-02-jitcdde-kuramoto.svg', bbox_inches='tight')
plt.show()
No description has been provided for this image

Key points:

  • The right-hand side is a generator function — the derivative is defined lazily, one component at a time.
  • τ is initialised globally (not inside the generator) — important when computing Jacobians or Lyapunov exponents, as the generator is called multiple times.
  • sin is symengine.sin, not math.sin or numpy.sin.
  • delays=τ.flatten() is given explicitly to speed things up.
  • set_integration_parameters(rtol=0, atol=1e-5) uses absolute instead of relative error — relative errors make no sense for Kuramoto phases.
  • integrate_blindly(np.max(τ), 0.1) integrates blindly up to the maximal delay to let the initial discontinuities smooth out.
  • The order parameter $r(t)$ is a much more informative quantity than 100 overlapping phase curves — it measures the synchrony of the network.

6. Lyapunov exponents with jitcdde_lyap

jitCDDE can also compute Lyapunov exponents, the rate of exponential divergence of nearby trajectories, by evolving separation functions (tangent vectors). This is done with jitcdde_lyap, which is almost identical to jitcdde but additionally generates and integrates the tangent dynamics.

The classic Mackey–Glass equation ($\beta = 0.2$, $\gamma = 0.1$, $n = 10$) transitions from regular motion to chaos as the delay $\tau$ increases past $\tau \approx 16.45$. The largest Lyapunov exponent $\lambda_1$ is a useful diagnostic: it is zero for regular motion (limit cycles) and positive for chaotic motion. We sweep $\tau$ and plot $\lambda_1$ versus $\tau$ — this shows how the Lyapunov coefficient changes as the system transitions from regular to chaotic.

In [8]:
import numpy as np
import matplotlib.pyplot as plt
from jitcdde import jitcdde_lyap, t, y

β = 0.2
γ = 0.1
n = 10

taus = np.linspace(10, 25, 30)
lam1 = np.zeros(len(taus))

for i, τ in enumerate(taus):
    f = [ β * y(0,t-τ) / (1 + y(0,t-τ)**n) - γ*y(0) ]
    DDE = jitcdde_lyap(f, n_lyap=1)
    DDE.constant_past([0.5])
    DDE.step_on_discontinuities()
    times = np.arange(DDE.t + 1, DDE.t + 10000, 10)
    lyaps, weights = [], []
    for time in times:
        state, lyap, weight = DDE.integrate(time)
        lyaps.append(lyap); weights.append(weight)
    lyaps = np.array(lyaps); weights = np.array(weights)
    lam1[i] = np.average(lyaps[400:, 0], weights=weights[400:])

fig = plt.figure(figsize=(14, 4))
gs = fig.add_gridspec(1, 2, width_ratios=[3, 1])
ax = fig.add_subplot(gs[0])
ax.plot(taus, lam1, 'o-', lw=1.2)
ax.axhline(0, color='gray', lw=0.5, ls='--')
ax.set_xlabel('τ (delay)'); ax.set_ylabel('λ₁')
ax.set_title('Largest Lyapunov exponent vs delay')
ax2 = fig.add_subplot(gs[1])

τ = 17.2
f = [ β * y(0,t-τ) / (1 + y(0,t-τ)**n) - γ*y(0) ]
DDE = jitcdde_lyap(f, n_lyap=1)
DDE.constant_past([0.5])
DDE.step_on_discontinuities()
times = np.arange(DDE.t + 1, DDE.t + 100, 1)
data = np.array([DDE.integrate(time)[0] for time in times])
seg = slice(40, 40 + int(3*τ))
ax2.plot(times[seg], data[:, 0][seg], lw=1.2)
ax2.set_xlabel('t'); ax2.set_ylabel('y(t)')
ax2.set_title('Short segment (τ=17.2)')
plt.savefig('../files/2026-12-02-jitcdde-lyap.svg', bbox_inches='tight')
plt.show()

print('Largest Lyapunov exponents vs τ:')
for τ, lam in zip(taus, lam1):
    print(f'  τ={τ:5.2f}  λ₁={lam:+.5f}')
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
Generating, compiling, and loading C code.
Using default integration parameters.
No description has been provided for this image
Largest Lyapunov exponents vs τ:
  τ=10.00  λ₁=-0.00007
  τ=10.52  λ₁=+0.00000
  τ=11.03  λ₁=+0.00001
  τ=11.55  λ₁=+0.00006
  τ=12.07  λ₁=+0.00001
  τ=12.59  λ₁=+0.00001
  τ=13.10  λ₁=+0.00008
  τ=13.62  λ₁=+0.00003
  τ=14.14  λ₁=-0.00000
  τ=14.66  λ₁=-0.00007
  τ=15.17  λ₁=-0.00005
  τ=15.69  λ₁=-0.00007
  τ=16.21  λ₁=+0.00000
  τ=16.72  λ₁=+0.00387
  τ=17.24  λ₁=+0.00493
  τ=17.76  λ₁=+0.00544
  τ=18.28  λ₁=+0.00911
  τ=18.79  λ₁=-0.00003
  τ=19.31  λ₁=+0.00657
  τ=19.83  λ₁=+0.00869
  τ=20.34  λ₁=+0.00142
  τ=20.86  λ₁=-0.00008
  τ=21.38  λ₁=+0.00646
  τ=21.90  λ₁=+0.00931
  τ=22.41  λ₁=+0.01071
  τ=22.93  λ₁=+0.00948
  τ=23.45  λ₁=+0.01067
  τ=23.97  λ₁=+0.00962
  τ=24.48  λ₁=+0.01068
  τ=25.00  λ₁=+0.00831

Key points:

  • integrate returns (state, local_lyap, weight) — the local Lyapunov exponents for that integration step, and the length of the interval they apply to.
  • Local exponents are averaged with the weights (the interval length), as done in the np.average call.
  • Lyapunov estimation can be numerically sensitive: run with plain jitcdde first, then with n_lyap=1, and only then increase the number of exponents.
  • The separation functions are initialised with random data and require preiterations to align.
  • The classic Mackey–Glass equation transitions from regular motion to chaos as the delay $\tau$ increases past $\tau \approx 16.45$ — the largest Lyapunov exponent is zero for regular motion and positive for chaotic motion.

Conclusion

We have seen a progressive tour of jitCDDE: from a simple one-dimensional Mackey–Glass equation to a six-dimensional coupled system, a neutral DDE, a state-dependent delay, a large network of Kuramoto oscillators, and Lyapunov exponents. The same symbolic interface and compiled-integrator approach scales from these textbook examples to large network dynamics.

For further details, see the jitCDDE documentation and the example scripts.