def update_velocities(velocities, accelerations_old, accelerations_new,
    timestep_length):
    """Update the particle velocities using the Velocity-Verlet algoritm.
    Parameters
    ----------
    velocities: (2, N) array_like
        Where N is the number of particles, and the first row are the x
        velocities and the second row the y velocities.
    accelerations: (2, N) array_like
        Where N is the number of particles, and the first row are the x
        accelerations and the second row the y
        accelerations.
    timestep_length: float
        Length for each Velocity-Verlet integration step, in seconds.
    Returns
    -------
    (2, N) array_like:
        Updated velocities.
    """
    velocities[0] += 0.5 * (accelerations_old[0] + accelerations_new[0]
        ) * timestep_length
    velocities[1] += 0.5 * (accelerations_old[1] + accelerations_new[1]
        ) * timestep_length
    return [velocities[0], velocities[1]]
