def incremental_weighted_mean(xbarj,j,xbarm,wbarm,wbarj):
    """ incremental weighted mean assuming constant batch sizes
    Args:
        float:
            xbarj is the cumulative average of all previous batches
        float:
            j is the number of previous batches
        float:
            xbarm is the average of the mth batch (the one being added)
        float:
            wbarm is the average weight of the mth batch (the one being added)
        float:
            wbarj is the average weight of previous batches
    Returns:
        float:
            xbarjp1 is the new weighted mean with the new data added
    """
    xbarjp1 = (j*xbarj*wbarj + xbarm*wbarm)/(j*wbarj + wbarm)
    return xbarjp1