<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_R_det2(y_segment, y_avg, y_prime):
 """ takes in an array of y values, the mean of those values, and the array of y prime values. returns R_det2 """

    numerator = sum((numpy.array(y_segment) - numpy.array(y_prime))**2)
    denominator = sum((numpy.array(y_segment) - y_avg)**2)
    if denominator: # prevent divide by zero error
        R_det2 = 1 - (old_div(numerator, denominator))
        return R_det2
    else:
        return float('nan')