def mass_1_and_chirp_mass_to_mass_ratio(mass_1, chirp_mass):
    """
    Calculate mass ratio from mass_1 and chirp_mass.

    This involves solving mc = m1 * q**(3/5) / (1 + q)**(1/5).

    Parameters
    ----------
    mass_1: float
        Mass of the heavier object
    chirp_mass: float
        Mass of the lighter object

    Return
    ------
    mass_ratio: float
        Mass ratio of the binary
    """
    temp = (chirp_mass / mass_1) ** 5
    mass_ratio = (2 / 3 / (3 ** 0.5 * (27 * temp ** 2 - 4 * temp ** 3) ** 
        0.5 + 9 * temp)) ** (1 / 3) * temp + ((3 ** 0.5 * (27 * temp ** 2 -
        4 * temp ** 3) ** 0.5 + 9 * temp) / (2 * 3 ** 2)) ** (1 / 3)
    return mass_ratio
