def rat_fun(x, poles):
    """
    Computes the value of a rational function with poles in poles and roots in
    -poles; see Definition 8.29 from the doctoral thesis "Model Order Reduction
    for Fractional Diffusion Problems" for a precise definition.

    Parameters
    ----------
    x : float
        The argument of the rational function.
    poles : list
        A list of poles.

    Returns
    -------
    val : float
        The value of the rational function at x.
    """
    val = 1
    for pole in poles:
        val *= (x + pole) / (x - pole)
        
    return val