def Ak(Y2d, H, k):
    """
    Calculate Ak for Sk(x)    

    Parameters
    ----------
        Y2d : list
            list of y values with the second derived
        H : list
            list of h values from spline
        k : int
            index from Y2d and H

    Returns
    -------
        float
            Ak from cubic spline 
    """
    return (Y2d[k] - Y2d[k - 1]) / (6 * H[k - 1])