Skip to content

Solow

An economy whose capital per worker approaches its steady state.

  • Class: SolowSystem
  • Import: from skcomplex.systems.economics.macroeconomics import SolowSystem
  • Field: economics/macroeconomics
  • Topics: growth, ode
  • References:
    • Solow 1956

Use this system

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

from skcomplex.systems.economics.macroeconomics import SolowSystem

trajectory = SolowSystem().prepare().simulate()

Parameters

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

Parameter Default
k 1.0
s 0.2
alpha 0.3
delta 0.05
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 rate
Randomness deterministic
Domains real
Structure fixed

Class

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

class SolowSystem(BaseSystem):
    """An economy whose capital per worker approaches its steady state.

    It approaches through saving and depreciation. The system has the economy `economy`.

    Args:
        k:
            The initial capital per worker.

        s:
            The saving rate.

        alpha:
            The capital share of output.

        delta:
            The depreciation rate.

        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.economics.macroeconomics import SolowSystem
        >>> SolowSystem(s=0.3).prepare().system_.interactions[0].s
        0.3
    """

    field = 'economics/macroeconomics'
    topics = ('growth', 'ode')
    references = ('Solow 1956',)
    until = 200.0
    dt = 1.0

    def __init__(
        self,
        k: float = 1.0,
        *,
        s: float = 0.2,
        alpha: float = 0.3,
        delta: float = 0.05,
        label: str = 'system',
        solver: BaseSolver | str = 'auto',
        backend: BaseBackend | str = 'auto',
    ) -> None:
        super().__init__(label, solver=solver, backend=backend)
        self.k = k
        self.s = s
        self.alpha = alpha
        self.delta = delta

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of the components built from the model parameters."""
        super()._prepare(context)
        self.system_ = System(
            self.label,
            elements=[EconomyElement('economy', k=self.k)],
            interactions=[
                SolowGrowthInteraction('growth', target='economy', s=self.s, alpha=self.alpha, delta=self.delta),
            ],
        )

Components

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

Elements:

Interactions:

  • SolowGrowthInteraction, from Interaction
class EconomyElement(Element):
    """Economy described by its capital per worker.

    Args:
        label:
            The label of the economy.

        k:
            The initial capital per worker.

    Examples:
        >>> from skcomplex.systems.economics.macroeconomics import EconomyElement
        >>> EconomyElement('country', k=1.0).k
        1.0
    """

    def __init__(
        self,
        label: str,
        *,
        k: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    ) -> None:
        super().__init__(label)
        self.k = k

class SolowGrowthInteraction(Interaction):
    """Solow growth of the capital per worker `k` of a target.

    It follows `dk/dt = s * k**alpha - delta * k`, the saving of a Cobb-Douglas output minus depreciation.

    Args:
        label:
            The label of the interaction.

        target:
            The path of the economy.

        s:
            The saving rate.

        alpha:
            The output elasticity of capital.

        delta:
            The depreciation rate.

    Examples:
        >>> from skcomplex.systems.economics.macroeconomics import SolowGrowthInteraction
        >>> SolowGrowthInteraction('solow', target='country', s=0.3).s
        0.3
    """

    law_classes = (RateLaw,)

    def __init__(
        self,
        label: str,
        *,
        target: Role,
        s: Annotated[float, RealSet.closed_open(0, oo)] = 0.2,
        alpha: Annotated[float, RealSet.open(0, oo)] = 0.3,
        delta: Annotated[float, RealSet.open(0, oo)] = 0.05,
    ) -> None:
        super().__init__(label)
        self.target = target
        self.s = s
        self.alpha = alpha
        self.delta = delta

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the rate `s * k**alpha - delta * k` of the capital per worker as the law.

        Args:
            context:
                The namespace of the elements a binding of the roles names.
        """
        super()._prepare(context)
        k = context.target.k
        self.laws_: list[BaseLaw] = [RateLaw(k, context.s * k**context.alpha - context.delta * k)]

Equations

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

economy.k: diff(k_economy(t), t) == s_growth*k_economy(t)^alpha_growth - delta_growth*k_economy(t)