def get_mu(frequencies):
    """
    Calculates the mutation rate for F81 (and JC that is a simplification of it),
    as \\mu = 1 / (1 - sum_i \\pi_i^2). This way the overall rate of mutation -\\mu trace(\\Pi Q) is 1.
    See [Gascuel "Mathematics of Evolution and Phylogeny" 2005] for further details.

    :param frequencies: numpy array of state frequencies \\pi_i
    :return: mutation rate \\mu = 1 / (1 - sum_i \\pi_i^2)
    """
    return 1.0 / (1.0 - frequencies.dot(frequencies))
