def asr(f, a, b, eps=1e-8):
    """自适应 Simpson 求积的递归实现
    
    Args:
        f: 要求积的函数
        a, b: 求积区间
        eps: 目标精度，达到则停止，返回积分值

    Returns: 
        I: 计算结果：积分的近似值
    """
    def simpson(f, a, b):
        return (b - a) * (f(a) + 4 * f((a + b) / 2) + f(b)) / 6
    
    def asrp(f, a, b, eps, sim):
        mid = (a + b) / 2
        L = simpson(f, a, mid)
        R = simpson(f, mid, b)

        if (abs(L + R - sim) <= eps):
            return L + R + (L + R - sim) / 15
        
        return asrp(f, a, mid, eps/2, L) + asrp(f, mid, b, eps/2, R)
    
    return asrp(f, a, b, eps, simpson(f, a, b))