def simpson_index(species_num_array):
    """Calculate the Simpson's Diversity Index: 1 - ∑pi**2

    The Simpson index is a dominance index because it gives more weight to
    common or dominant species. In this case, a few rare species with only
    a few representatives will not affect the diversity.  p is the proportion
    (n/N) of individuals of one particular species found (n) divided by the
    total number of individuals found (N). The value of this index ranges
    between 0 and 1, the greater the value, the greater the sample
    diversity.

    Args:
        species_num_array: An array that store the number of different kind
            of species.

    Returns:
        Simpson's diversity index of this population.
    """
    ratio_ = species_num_array / species_num_array.sum()
    simpson_index_diversity = 1 - sum(ratio_**2)
    return float('%0.4f' % simpson_index_diversity)