Skip to content

Pattern formation

Pattern formation: amplitude equations and rolls.

BrusselatorElement(label, *, u=1.0, v=3.0, a=1.0, b=3.0, Du=1.0, Dv=8.0, space=None)

Bases: BrusselatorReactionElement

Site of the Brusselator, its reactor with the diffusion coefficients.

The coefficients are those of its intermediates.

The four reactions of BrusselatorSystem run at every site, and its diffusions read Du and Dv.

Parameters:

Name Type Description Default
label str

The label of the site or the field.

required
u object

The initial concentration of u.

1.0
v object

The initial concentration of v.

3.0
a float

The feed of u.

1.0
b float

The conversion of u into v.

3.0
Du object

The diffusion of u.

1.0
Dv object

The diffusion of v.

8.0
space BaseSpace | None

The lattice of the sites, or None for one site.

None

Examples:

>>> from skcomplex.systems.chemistry.pattern_formation import BrusselatorElement
>>> BrusselatorElement('cell').Dv
8.0
Source code in src/skcomplex/systems/chemistry/pattern_formation/_reaction_diffusion.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def __init__(
    self,
    label: str,
    *,
    u: object = 1.0,
    v: object = 3.0,
    a: float = 1.0,
    b: float = 3.0,
    Du: object = 1.0,
    Dv: object = 8.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, u=u, v=v, a=a, b=b, space=space)
    self.Du = Du
    self.Dv = Dv

BrusselatorSystem(shape=(64, 64), *, a=1.0, b=3.0, Du=1.0, Dv=8.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Brusselator reaction-diffusion system from noise around its steady state.

The noise is small and the steady state is (a, b / a).

Every site of a periodic lattice runs the kinetics of BrusselatorODESystem, and both intermediates diffuse. The concentrations are cells.u and cells.v.

Parameters:

Name Type Description Default
shape Sequence[int]

The number of rows and columns of the periodic lattice.

(64, 64)
a float

The feed of u.

1.0
b float

The conversion of u into v.

3.0
Du float

The diffusion of u.

1.0
Dv float

The diffusion of v.

8.0
random_state int | Generator | None

The seed or generator of the noise.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.pattern_formation import BrusselatorSystem
>>> BrusselatorSystem((8, 8), b=2.5).prepare().system_.elements[0].b
2.5
Source code in src/skcomplex/systems/chemistry/pattern_formation/_reaction_diffusion.py
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
def __init__(
    self,
    shape: Sequence[int] = (64, 64),
    *,
    a: float = 1.0,
    b: float = 3.0,
    Du: float = 1.0,
    Dv: float = 8.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.shape: Sequence[int] = shape
    self.a = a
    self.b = b
    self.Du = Du
    self.Dv = Dv
    self.random_state = random_state

GrayScottSystem(shape=(128, 128), *, Du=0.16, Dv=0.08, F=0.035, k=0.065, random_state=0, label='system', solver='auto', backend='auto')

Bases: ReactionDiffusionSystem

The Gray-Scott reaction-diffusion system, seeded in its middle.

It grows spots that replicate.

Every site of a periodic lattice runs the kinetics of CubicAutocatalysisSystem, the cubic autocatalysis of the activator on the substrate, the feed F of the substrate, and the removal F + k of the activator, and both diffuse. The substrate is cells.u and the activator cells.v.

Parameters:

Name Type Description Default
shape Sequence[int]

The number of rows and columns of the periodic lattice.

(128, 128)
Du float

The diffusion of the substrate u.

0.16
Dv float

The diffusion of the activator v.

0.08
F float

The feed rate.

0.035
k float

The kill rate.

0.065
random_state int | Generator | None

The seed or generator of the noise on the seed.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.pattern_formation import GrayScottSystem
>>> GrayScottSystem((32, 32), F=0.04).prepare().system_.elements[0].values['F']
0.04
Source code in src/skcomplex/systems/chemistry/pattern_formation/_reaction_diffusion.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
def __init__(
    self,
    shape: Sequence[int] = (128, 128),
    *,
    Du: float = 0.16,
    Dv: float = 0.08,
    F: float = 0.035,
    k: float = 0.065,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.shape: Sequence[int] = shape
    self.Du = Du
    self.Dv = Dv
    self.F = F
    self.k = k
    self.random_state = random_state

SchnakenbergSystem(shape=(64, 64), *, a=0.1, b=0.9, Du=1.0, Dv=40.0, spacing=1.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: ReactionDiffusionSystem

The Schnakenberg reaction-diffusion system.

It forms Turing patterns from noise when Dv >> Du.

The steady state u = a + b, v = b / (a + b)^2 is stable without diffusion and unstable to perturbations of a band of wavelengths with it. The concentrations are cells.u and cells.v.

Parameters:

Name Type Description Default
shape Sequence[int]

The number of sites along every dimension of the periodic lattice.

(64, 64)
a float

The production of u.

0.1
b float

The production of v.

0.9
Du float

The diffusion of the activator u.

1.0
Dv float

The diffusion of the inhibitor v.

40.0
spacing float

The distance between sites.

1.0
random_state int | Generator | None

The seed or generator of the noise.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.chemistry.pattern_formation import SchnakenbergSystem
>>> SchnakenbergSystem((8, 8)).prepare().system_.elements[0].values['Dv']
40.0
Source code in src/skcomplex/systems/chemistry/pattern_formation/_reaction_diffusion.py
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
def __init__(
    self,
    shape: Sequence[int] = (64, 64),
    *,
    a: float = 0.1,
    b: float = 0.9,
    Du: float = 1.0,
    Dv: float = 40.0,
    spacing: float = 1.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label=label, solver=solver, backend=backend)
    self.shape: Sequence[int] = shape
    self.a = a
    self.b = b
    self.Du = Du
    self.Dv = Dv
    self.spacing = spacing
    self.random_state = random_state