y1=trap(pexp,0.0,1.0)/
sqrt
(2.0*3.1416);
y2=trap(
sin
,0.0,3.1416/2.0)/2.0;
y3=trap(polyt,0.0,4.0);
double
trap(__1___,
double
a,
double
b)
{
double
t,h;
int
i,n=1000;
t=((*fun)(a)+(*fun)(b))/2.0;
h=
fabs
(a-b)/(
double
)(n);
for
(i=1;i<=n-1;i++)
t+=__2__;
t*=h;
return
t;
}