def approx_derivative(f, x, delta=1e-6):
    """
    Return an approximation to the derivative of f at x.
    :param f: function that is differentiable near x
    :param x: input to f
    :param delta: step size in x
    :return: df/dx
    """
    df = (f(x + delta) - f(x - delta))/2 #order 2 approximation
    return df/delta