def incremental_mean(mu_i, n, x):
    """
    Calculates the mean after adding x to a vector with given mean and size.

    :param mu_i: Mean before adding x.
    :param n: Number of elements before adding x.
    :param x: Element to be added.
    :return: New mean.
    """

    delta = (x - mu_i) / float(n + 1)
    mu_f = mu_i + delta

    return mu_f