def derivative2_centered_h1(target, y):
    """
    Implements the taylor centered approach to calculate the second derivative.

    :param target: the position to be derived,  must be len(y)-1 > target > 0
    :param y: an array with the values
    :return: the centered second derivative of target
    """
    if len(y) - 1 <= target <= 0:
        raise(ValueError("Invalid target, array size {}, given {}".format(len(y), target)))
    return (y[target + 1] - 2*y[target] + y[target - 1])/4