def update_mean(new_data, old_mean, num_data):
    """Compute a new mean recursively using the old mean and new measurement

    From the arithmetic mean computed using the n-1 measurements (M_n-1), we
    compute the new mean (M_n) adding a new measurement (X_n) with the formula:
    M_n = M_n-1 + (X_n - M_n-1)/n

    See: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance

    Parameters
    ----------
    new_data: int or decimal
        The new measurement Xn
    old_mean: int or decimal
        The mean Mn-1 computed previously
    num_data:
        The number of data used to compute Mn

    Returns
    -------
    float
        The new mean Mn updated with Xn
    """
    return (old_mean + (new_data - old_mean) / num_data)