def K(u, kap, eps):
    """Compute diffusion function 

    .. math::
        K(u) = \kappa \, (1 + \varepsilon u)^3 + 1

    Parameters
    ----------
    u : array_like
        Temperature variable.
    kap : float
        Diffusion parameter.
    eps : float
        Inverse of activation energy.

    Returns
    -------
    array_like
        Evaluation of K function.
    """
    return kap * (1 + eps * u) ** 3 + 1