import math


def specific_psi_function(
    arg, k, l, exp_rates, freq, a
):  # pylint: disable=unused-argument
    """
    The specific version of the Ψ function that is used for the purpose of
    this study. This function is a simplification of the general_psi_function
    when the following are fixed:
        exp_rates = (0, C*mu, mu)
        freq = (1, ??, 1)
        a = 2
    Due to the way the hypoexponential cdf works the function is called only for
    values of k=1 and k=2. For these values the following hold:
                                    - k = 1 -> l = 1, ..., n
                                    - k = 2 -> l = 1

    Parameters
    ----------
    arg : float
        The argument of the cdf
    k : int
        Variable that goes from 0 to the number of distinct parameters
    l : int
        Variable that goes from 0 to the frequencies of each parameter_k
    exp_rates : tuple
        Distinct exponential parameters
    freq : tuple
        Frequencies of each distinct parameter
    a : int
        The length of exp_rates and freq array

    Returns
    -------
    float
        The output of the Ψ function that is needed for the cdf of the
        Hypoexponential distribution.
    """
    if k == 1:
        psi_val = (1 / (arg ** l)) - (1 / (arg + exp_rates[2]) ** l)
        psi_val *= (-1) ** l * math.factorial(l - 1) / exp_rates[2]
        return psi_val
    if k == 2:
        psi_val = -1 / (arg * (arg + exp_rates[1]) ** freq[1])
        return psi_val
    return 0