banzi 发表于 2019-08-16 更新于 2025-07-13 simpson12345678910double work(double L,double R){ double mid=(L+R)/2; return (f(L)+f(R)+f(mid)*4)*(R-L)/6;}double simpson(double L,double R){ double mid=(L+R)/2; double x1=work(L,mid),x2=work(mid,R),x3=work(L,R); if (std::fabs(x1+x2-x3)<eps) return x1+x2; else return simpson(L,mid)+simpson(mid,R);} 阅读全文 »