Skip to content

Multiplicative noise conventions

Free particles in a box with position-dependent noise.

  • Class: MultiplicativeNoiseSystem
  • Import: from skcomplex.systems.physics.soft_matter import MultiplicativeNoiseSystem
  • Field: physics/soft_matter
  • Topics: noise, sde, multiplicative noise, spurious drift
  • References:
    • Argun et al. 2021
    • Volpe and Wehr 2016

Use this system

The block imports the class and simulates the system with its default parameters and its tuned run settings.

from skcomplex.systems.physics.soft_matter import MultiplicativeNoiseSystem

trajectory = MultiplicativeNoiseSystem().prepare().simulate()

Parameters

The model parameters take these defaults, and set_params changes them.

Parameter Default
n_particles 500
s0 1.0
ds 1.8
L 100.0
convention 'anti-ito'
solver 'auto'
backend 'auto'

Tags

The system with its default parameters has these capability tags, which solvers and analyses check.

Tag Values
Time any
Space none
Laws noise, update
Randomness stochastic
Domains real
Structure fixed

Class

The source of the class shows how it builds its components from its model parameters.

class MultiplicativeNoiseSystem(BaseSystem):
    """Free particles in a box with position-dependent noise.

    The noise is read in the Itô, Stratonovich, or anti-Itô sense.

    Only the anti-Itô convention gives the flat stationary density of particles at thermal equilibrium without forces.
    The particles start at the middle of the box. The system has the positions `particles.x`.

    Args:
        n_particles:
            The number of independent particles.

        s0:
            The noise amplitude at the middle of the box.

        ds:
            The change of the noise amplitude across the box.

        L:
            The length of the box.

        convention:
            The convention of the noise, `'ito'`, `'stratonovich'`, or `'anti-ito'`.

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

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

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

    Examples:
        >>> from skcomplex.systems.physics.soft_matter import MultiplicativeNoiseSystem
        >>> MultiplicativeNoiseSystem(10, convention='ito').prepare().system_.interactions[0].convention
        'ito'
    """

    field = 'physics/soft_matter'
    topics = ('noise', 'sde', 'multiplicative noise', 'spurious drift')
    references = ('Argun et al. 2021', 'Volpe and Wehr 2016')
    until = 100.0
    dt = 0.05

    def __init__(
        self,
        n_particles: int = 500,
        *,
        s0: float = 1.0,
        ds: float = 1.8,
        L: float = 100.0,
        convention: str = 'anti-ito',
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.n_particles = n_particles
        self.s0 = s0
        self.ds = ds
        self.L = L
        self.convention = convention

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of free particles in a box with position-dependent noise.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        noise = ModulatedNoiseInteraction(
            'noise',
            target='particles',
            s0=self.s0,
            ds=self.ds,
            L=self.L,
            convention=self.convention,
        )
        self.system_ = System(
            self.label,
            elements=[ModulatedParticleElement('particles', x=self.L / 2, size=self.n_particles)],
            interactions=[noise],
            solver=EulerMaruyamaSolver(dt=0.01),
        )

Components

The system uses these element and interaction classes, each with its nearest class of the core.

Elements:

  • ModulatedParticleElement, from Element

Interactions:

  • ModulatedNoiseInteraction, from Interaction
class ModulatedParticleElement(Element):
    """Particles at the positions `x` in a box.

    Args:
        label:
            The label of the particles.

        x:
            The initial position, one per particle or shared.

        size:
            The number of particles, or `None` for one.

    Examples:
        >>> from skcomplex.systems.physics.soft_matter import ModulatedParticleElement
        >>> ModulatedParticleElement('beads', x=5.0, size=10).x
        5.0
    """

    def __init__(self, label: str, *, x: object = 50.0, size: int | None = None) -> None:
        super().__init__(label, size=size)
        self.x = x

class ModulatedNoiseInteraction(Interaction):
    """Noise whose amplitude grows across a box `[0, L]` whose walls reflect the particles.

    The noise amplitude is `sigma = s0 + ds (x / L - 1/2)`, read in the Itô, Stratonovich, or anti-Itô sense. The walls
    reflect the particles at every frame, so frames must be short against the time to cross the box. It is a colloid
    in a temperature gradient, or a particle whose mobility changes with its place.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the particles.

        s0:
            The noise amplitude at the middle of the box.

        ds:
            The change of the noise amplitude across the box.

        L:
            The length of the box.

        convention:
            The convention of the noise, `'ito'`, `'stratonovich'`, or `'anti-ito'`.

    Examples:
        >>> from skcomplex.systems.physics.soft_matter import ModulatedNoiseInteraction
        >>> ModulatedNoiseInteraction('noise', target='beads').ds
        1.8
    """

    law_classes = (NoiseLaw, UpdateLaw)

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        s0: Annotated[float, RealSet.open(0, oo)] = 1.0,
        ds: float = 1.8,
        L: Annotated[float, RealSet.open(0, oo)] = 100.0,
        convention: str = 'anti-ito',
    ) -> None:
        super().__init__(label)
        self.target = target
        self.s0 = s0
        self.ds = ds
        self.L = L
        self.convention = convention

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the noise of the position of the target and its reflection at the walls.

        Args:
            context:
                The namespace of the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        s = context
        x = s.target.x
        self.laws_ = [
            NoiseLaw(x, s.s0 + s.ds * (x / s.L - 0.5), convention=self.convention),
            UpdateLaw(x, where(x < 0, -x, where(x > s.L, 2 * s.L - x, x))),
        ]

Equations

The equations are those that symbolic returns for the system with its default parameters.

particles.x[i]: diff(x_particles(t), t) == (1.0*ds_noise*(x_particles(t)/L_noise - 0.5) + 1.0*s0_noise)*ds_noise/L_noise