simpson公式求定积分
double F(double x) { } /// simpson求定积分 double simpson(double a,double b,double tk,double ta,double tb) { double c=a+(b-a)/2; return (F(a)+4*F(c)+F(b))*(b-a)/6; } double asr(double a,double b,double EPS,double A) { double c=a+(b-a)/2; double L=simpson(a,c),R=simpson(c,b); if(fabs(L+R-A)<=15*EPS) return L+R+(L+R-A)/15.0; return asr(a,c,EPS/2,L)+asr(c,b,EPS/2,R); } double asr(double a,double b,double EPS) { return asr(a,b,EPS,simpson(a,b)); }
没有AC不了的题,只有不努力的ACMER!