egttools.plotting.simplified.lattice_gradient_interpolator¶
- lattice_gradient_interpolator(gradient_fn, population_size)[source]¶
Continuous extension of a gradient defined on the states of a finite population of 3 strategies.
The gradient of selection of a finite population is defined only at the integer states \((n_0, n_1, n_2)\) with \(n_0 + n_1 + n_2 = Z\). This function evaluates
gradient_fnonce at every such state and interpolates linearly inside each triangle of the lattice, which gives a continuous, piecewise-linear field that equals the exact gradient at every population state. Root finding, stability analysis and trajectory integration need such a continuous field.- Parameters:
- Returns:
The interpolating function, which takes a state in counts (3 floats; it is projected onto the plane \(\sum_i n_i = Z\) and clipped to the simplex), and the array of lattice gradients of shape
(Z + 1, Z + 1, 3), where entry[i, j]holds the gradient at state(i, j, Z - i - j)and entries withi + j > Zare NaN.- Return type:
Tuple[Callable[[NDArray[double]],NDArray[double]],NDArray[double]]