def accel_ES(q: np.ndarray):
    """
    Compute the gravitational accelerations in the earth-sun system.
    q in row vector of 6 elements: sun (x, y, z), earth (x, y, z)
    """

    # Number of celestial bodies
    num_bodies: int = 2
    # Number of dimensions in arrays; 3 spatial dimensions times the number of bodies
    dims = 3 * num_bodies

    # Body 0 is the sun; Body 1 is the earth
    m0 = mass[0]
    m1 = mass[1]

    # Extract position of the sun and earth as 3-vectors
    pos_0 = q[slices[0]]
    pos_1 = q[slices[1]]

    # Displacement vector from sun to earth
    dv_01: np.ndarray = pos_1 - pos_0

    # Distance from sun to earth
    r_01: float = np.linalg.norm(dv_01)
    
    # Unit vector pointing from sun to earth
    udv_01 = dv_01 / r_01

    # The force between these has magnitude G*m0*m1 / r^2
    f_01: float = (G * m0 * m1) / (r_01 ** 2)
    
    # Initialize acceleration as 6x1 array
    a: np.ndarray = np.zeros(dims)
    
    # The force vectors are attractive
    a[slices[0]] += f_01 * udv_01 / m0
    a[slices[1]] -= f_01 * udv_01 / m1

    # Return the acceleration vector
    return a