egttools.analytical.utils.find_roots_and_stability¶
- find_roots_and_stability(gradient_function, nb_strategies, nb_initial_random_points=3, atol=1e-07, atol_neg=0.0001, atol_pos=0.0001, atol_zero=0.0001, tol_close_points=0.0001, method='hybr')[source]¶
Searches for the roots of the differential equation
gradient_function
and calculates the stability based on an estimate of the Jacobian. This estimate is often imprecise which leads to wrong results.- Parameters
gradient_function (Callable[[np.ndarray], np.ndarray]) – function that returns a numpy.ndarray with the gradient of every strategy/type given a current population state.
nb_strategies (int) – number of strategies/types present in the population.
nb_initial_random_points (int) – number of random points to use as initial states for the root function. These are additional to the vertex of the simplex.
atol (float) – tolerance for considering that a point is in the simplex.
atol_neg (float) – tolerance to consider a value negative.
atol_pos (float) – tolerance to consider a value positive.
atol_zero (float) – tolerance to determine if a value is zero.
tol_close_points (float) – tolerance for considering that two points are equal.
method (str) – one of the options described in
scipy.optimize.root
(see https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root.html)
- Returns
A tuple containing the list of roots and a list with 1 indicating stable points, 0 saddle points and -1 unstable points.
- Return type
Tuple[List[np.array], List[int]]