egttools.numerical.numerical_.replicator_equation¶
- replicator_equation()¶
Computes the replicator dynamics gradient for a 2-player game.
This function implements the standard replicator equation for infinite populations interacting in pairwise games. The result is a vector of growth rates (gradients) for each strategy.
- Parameters:
frequencies (NDArray[np.float64]) – A 1D NumPy array of shape (nb_strategies,) representing the current frequency of each strategy in the population. The entries should sum to 1.
payoff_matrix (NDArray[np.float64]) – A 2D NumPy array of shape (nb_strategies, nb_strategies) containing payoffs. Entry [i, j] is the payoff for strategy i when interacting with j.
- Returns:
A 1D NumPy array of shape (nb_strategies,) representing the replicator gradient for each strategy.
- Return type:
NDArray[np.float64]
See also
egttools.replicator_equation_n_player
,egttools.games.AbstractGame
,egttools.numerical.PairwiseComparison
,egttools.analytical.StochDynamics
Examples
>>> freqs = np.array([0.4, 0.6]) >>> A = np.array([[1, 0], [3, 2]]) >>> grad = replicator_equation(freqs, A) >>> grad array([-0.24, 0.24])