def compute_with_uncertainty(fct, x, dx):
    """Compute the value of fct(x), with x +/- dx.
    Return f = fct(x) and df, the uncertainty on f.
    """
    f = fct(x)
    f_plus = fct(x + dx)
    f_minus = fct(x - dx)

    df_plus = abs(f - f_plus)
    df_minus = abs(f - f_minus)
    df = (df_plus + df_minus) / 2

    return f, df