def cstr_design_eq(x_out, x_in, vol, nuo, k):
    """
    PFR design eq for HW3 problem 1, set up for f(Xi) = 0 for fsolve function
    :param x_in: initial conversion (unitless)
    :param x_out: final conversion (unitless)
    :param vol: PFR volume in L
    :param nuo: volumetric flow in L/min
    :param k: rate coefficient in 1/min
    :return: function residual (want close to zero)
    """
    return vol - nuo / k * (x_out - x_in) * (1 + 3 * x_out) / (1 - x_out)