二重积分的表达形式
其中积分区域为:x=1 y=1 y=-4/5*x+29/5
积分函数为: f(x,y)=1
#include <stdio.h>
#include <math.h>
static double simp1(double x,double eps, void (*s)(double x,double y[2]),double (*f)(double x,double y))
{
int n,i;
double y[2],h,d,t1,yy,t2,g,ep,g0;
n=1;
(*s)(x,y);
h=0.5*(y[1]-y[0]);
d=fabs(h*2.0e-06);
t1=h*((*f)(x,y[0])+(*f)(x,y[1]));
ep=1.0+eps;
g0=1.0e+35;
while(((ep>=eps)&&(fabs(h)>d))||(n<16))
{
yy=y[0]-h;
t2=0.5*t1;
for(i=1;i<=n;i++)
{
yy=yy+2.0*h;
t2=t2+h*(*f)(x,yy);
}
g=(4.0*t2-t1)/3.0;
ep=fabs(g-g0)/(1.0+fabs(g));