def METHOD_NAME(i):
  i_clipped = tf.minimum(i, tf.size(cdf_values) - 1)
  i_previous = tf.maximum(0, i_clipped - 1)
  s = TFLinearEquationSolver(x1=cdf_x_grid[i_clipped],
                             y1=cdf_values[i_clipped],
                             x2=cdf_x_grid[i_previous],
                             y2=cdf_values[i_previous])
  y = cdf_values[i_clipped]
  single_centroid = s.solve_for_x(y)
  return single_centroid