Skip to content

Scaled Brownian motion

Scaled Brownian motion, dx = sqrt(2 K alpha (t + t0)^(alpha - 1)) dW.

  • Class: ScaledBrownianMotionSystem
  • Import: from skcomplex.systems.physics.soft_matter import ScaledBrownianMotionSystem
  • Field: physics/soft_matter
  • Topics: anomalous diffusion, sde, non-ergodic
  • References:
    • Argun et al. 2021
    • Lim and Muniandy 2002
    • Jeon et al. 2014

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 ScaledBrownianMotionSystem

trajectory = ScaledBrownianMotionSystem().prepare().simulate()

Parameters

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

Parameter Default
n_particles 500
alpha 0.5
K 1.0
t0 0.01
solver 'auto'
backend 'auto'

Tags

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

Tag Values
Time continuous
Space none
Laws noise
Randomness stochastic
Domains real
Structure fixed

Class

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

class ScaledBrownianMotionSystem(BaseSystem):
    """Scaled Brownian motion, `dx = sqrt(2 K alpha (t + t0)^(alpha - 1)) dW`.

    Its mean squared displacement is `<x^2> ~ 2 K t^alpha`.

    The diffusion coefficient changes deterministically in time, which is the same as running Brownian motion on the
    rescaled clock `t^alpha`. The offset `t0` keeps the coefficient finite at the start. The system has the positions
    `walkers.x`.

    Args:
        n_particles:
            The number of independent walkers.

        alpha:
            The anomalous diffusion exponent, below 1 for subdiffusion and above 1 for superdiffusion.

        K:
            The generalized diffusion coefficient.

        t0:
            The time offset of the diffusion coefficient.

        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 ScaledBrownianMotionSystem
        >>> ScaledBrownianMotionSystem(10, alpha=1.5).prepare().system_.interactions[0].alpha
        1.5
    """

    field = 'physics/soft_matter'
    topics = ('anomalous diffusion', 'sde', 'non-ergodic')
    references = ('Argun et al. 2021', 'Lim and Muniandy 2002', 'Jeon et al. 2014')
    until = 10.0
    dt = 0.1

    def __init__(
        self,
        n_particles: int = 500,
        *,
        alpha: float = 0.5,
        K: float = 1.0,
        t0: float = 0.01,
        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.alpha = alpha
        self.K = K
        self.t0 = t0

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of walkers whose diffusion coefficient changes in time.

        Args:
            context:
                The observables to compile with the problem, or `None` for none.
        """
        super()._prepare(context)
        self.system_ = System(
            self.label,
            elements=[ScaledWalkerElement('walkers', size=self.n_particles)],
            interactions=[ScaledNoiseInteraction('noise', target='walkers', K=self.K, alpha=self.alpha, t0=self.t0)],
            solver=EulerMaruyamaSolver(dt=0.01),
        )

Components

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

Elements:

  • ScaledWalkerElement, from Element

Interactions:

  • ScaledNoiseInteraction, from Interaction
class ScaledWalkerElement(Element):
    """Walkers at the positions `x`.

    Args:
        label:
            The label of the walkers.

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

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

    Examples:
        >>> from skcomplex.systems.physics.soft_matter import ScaledWalkerElement
        >>> ScaledWalkerElement('walkers', x=1.0, size=10).x
        1.0
    """

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

class ScaledNoiseInteraction(Interaction):
    """Noise whose diffusion coefficient `K alpha (t + t0)^(alpha - 1)` changes in time.

    The position follows `dx = sqrt(2 K alpha (t + t0)^(alpha - 1)) dW`, Brownian motion on the rescaled clock
    `t^alpha`. It is a tracer in a cooling or ageing medium, or a walker whose steps shrink or grow in time.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the walkers.

        K:
            The generalized diffusion coefficient.

        alpha:
            The anomalous diffusion exponent.

        t0:
            The time offset of the diffusion coefficient.

    Examples:
        >>> from skcomplex.systems.physics.soft_matter import ScaledNoiseInteraction
        >>> ScaledNoiseInteraction('noise', target='walkers', alpha=1.5).alpha
        1.5
    """

    law_classes = (NoiseLaw,)

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        K: Annotated[float, RealSet.open(0, oo)] = 1.0,
        alpha: Annotated[float, RealSet.open(0, oo)] = 0.5,
        t0: Annotated[float, RealSet.open(0, oo)] = 0.01,
    ) -> None:
        super().__init__(label)
        self.target = target
        self.K = K
        self.alpha = alpha
        self.t0 = t0

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

        Args:
            context:
                The namespace of the target, the time `t`, and the parameters.
        """
        super()._prepare(context)
        s = context
        self.laws_ = [NoiseLaw(s.target.x, sqrt(2 * s.K * s.alpha * (s.t + s.t0) ** (s.alpha - 1)))]

Equations

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

walkers.x[i]: diff(x_walkers(t), t) == 0