GrayScott¶
Systems / ODEs / Spatial fields
A reaction–diffusion system whose spots, stripes, and self-replicating patterns are a landmark of Turing morphogenesis.
Start here¶
import tsdynamics as ts
system = ts.systems.GrayScott()
traj = system.run(final_time=1500.0, dt=3.0, 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.
Illustration: N=96 · F=0.06 · k=0.062 · simulation window: 0–9000 · forward playback
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.
+ per-cell nonlinear terms (over the 2304-cell field)
Method and evidence
+ per-cell nonlinear terms (over the 2304-cell field)
Recorded parameters and software
{
"parameters": {
"N": 48,
"Du": 0.16,
"Dv": 0.08,
"F": 0.06,
"k": 0.062
},
"parameter_expressions": {},
"state_dimension": 4608,
"explicit_time": false,
"library_version": "6.0.3",
"python": "3.14.8",
"numpy": "2.4.4",
"scipy": "1.17.1",
"protocol_version": 1
}Definition¶
@staticmethod
def _equations(Y, t, *, N, Du, Dv, F, k):
# State layout: [u (N*N), v (N*N)]; unit grid spacing (h = 1).
def uidx(r, c):
return (r % N) * N + (c % N)
def vidx(r, c):
return N * N + (r % N) * N + (c % N)
rhs = []
# u-block.
for r in range(N):
for c in range(N):
u0 = Y(uidx(r, c))
v0 = Y(vidx(r, c))
lap_u = (
Y(uidx(r + 1, c))
+ Y(uidx(r - 1, c))
+ Y(uidx(r, c + 1))
+ Y(uidx(r, c - 1))
- 4 * u0
)
rhs.append(Du * lap_u - u0 * v0 * v0 + F * (1 - u0))
# v-block.
for r in range(N):
for c in range(N):
u0 = Y(uidx(r, c))
v0 = Y(vidx(r, c))
lap_v = (
Y(vidx(r + 1, c))
+ Y(vidx(r - 1, c))
+ Y(vidx(r, c + 1))
+ Y(vidx(r, c - 1))
- 4 * v0
)
rhs.append(Dv * lap_v + u0 * v0 * v0 - (F + k) * v0)
return rhs
Parameters¶
| Symbol | Default | Role |
|---|---|---|
N |
48 |
grid points per side (structural — changing it recompiles) |
Du |
0.16 |
u diffusion |
Dv |
0.08 |
v diffusion |
F |
0.06 |
feed rate |
k |
0.062 |
kill rate |
Field blocks: u, v
Explore further¶
- Lyapunov spectra and Kaplan–Yorke dimension — measure separation rates, then check convergence with a longer run.
- Fixed points and stability — find the equilibria or fixed points that organize the dynamics.
- Plotting and export — choose components, style a figure, or save it for a paper.
- Find a compatible analysis with
ts.analysis.find(system)orts.analysis.find(traj).
Reference¶
Pearson (1993), Science 261, 189-192
doi:10.1126/science.261.5118.189