def finite_diff_gradient_descent(f, begin, end, x0=None, niters=10, lr=1):
    """Find the local minima using gradient descent

    Parameters:
        f (function): Function to find the local minima
        begin (int): beginning of the interval
        end (int): end of interval
        x0 (int): initial point
        niters (int): number of iterations
        lr: learning rate
    """
    eps = (end-begin)/1000
    if x0 is None:
        x0 = (begin + end) / 2
    x = x0
    for i in range(niters):
        df = (f(x+eps)-f(x-eps))/(2*eps)
        x -= lr*df
    return x