inline double operator() (double s, double u) { if (abs(s - u) < eps) return cnst * pow(beta(1.5 - H1, H2 - 0.5), 2) * beta(H2 - H1, 1 + 2 * H1 - 2 * H2); double a = 0; I1 i1(s, u); double b1 = pow(edge, 1 / alpha1); double b2 = pow(edge, 1 / alpha2); I2 i2(s, u); return cnst * (alpha1 * qgaus(i1, a, b1) + alpha2 * qgaus(i2, a, b2)); }
float quad3d(float (*func)(float, float, float), float x1, float x2) { float qgaus(float (*func)(float), float a, float b); float f1(float x); nrfunc=func; return qgaus(f1,x1,x2); }
float f2(float y) { float qgaus(float (*func)(float), float a, float b); float f3(float z); float z1(float,float),z2(float,float); ysav=y; return qgaus(f3,z1(xsav,y),z2(xsav,y)); }
float f1(float x) { float qgaus(float (*func)(float), float a, float b); float f2(float y); float yy1(float),yy2(float); xsav=x; return qgaus(f2,yy1(x),yy2(x)); }
int main(void) { float dx,ss,x; int i; dx=(X2-X1)/NVAL; printf("\n%s %10s %13s\n\n","0.0 to","qgaus","expected"); for (i=1;i<=NVAL;i++) { x=X1+i*dx; ss=qgaus(func,X1,x); printf("%5.2f %12.6f %12.6f\n",x,ss, (-(1.0+x)*exp(-x)+(1.0+X1)*exp(-X1))); } return 0; }
double stPbxConvolved(const double* coordpar, const double* bpars, int wedge, int numpoints) { int i; double pbx, reff_value, prob, rPrime, rPrime3; rPrime = coordpar[2]; gPrime = r2mag(rPrime * 1000); rPrime3 = rPrime * rPrime * rPrime; for (i = 0; i < 3; i++) coordparConvolved[i] = coordpar[i]; for (i = 0; i < 4; i++) bparsConvolved[i] = bpars[i]; pbx = qgaus(backgroundConvolve, gPrime, xr, wedge, numpoints); pbx *= 1 / rPrime3; reff_value = reff(coordpar[2]); prob = pbx * reff_value; return prob; }