egttools.plotting.simplex2d.sample_simplex¶
- sample_simplex()¶
Converts a state index into a group composition vector.
This function performs the inverse of calculate_state, returning a vector representing the number of individuals using each strategy from a given index.
- Parameters:
- Returns:
A vector of length nb_strategies where each entry represents the number of individuals using the corresponding strategy.
- Return type:
NDArray[np.int64]
Examples
>>> sample_simplex(0, 3, 3) array([3, 0, 0])
>>> sample_simplex(3, 3, 3) array([1, 1, 1])