double func_blue_fraction(double x) { double n; HOD.fblue0_cen=pow(10.0,x); n = qtrap(func_galaxy_density,log(HOD.M_low),log(HOD.M_max),1.0E-4); //printf("%f %e %e %e %e\n",HOD.fblue0_cen,n,wp_color.ngal_blue,central_blue_fraction(HOD.M_min),HOD.M_low); return n - wp_color.ngal_blue; }
double Xifuncnorm(double MLsq, double s, int flag){ double result=0.; Xifuncintegrandtransformed Xif(MLsq,s,flag); result=qtrap(Xif, 0.0, 6.); result/=(::std::pow(2.*pimath,(2.*s))*gammfunc(s)); return result; }
//--------------------------------------------------------------------------- // EPMatrixElement // // Computes the matrix element EP_jj' which is the inner product of // eigenfunctions j,j'. For an orthonormal set of eigenfunctions, // EP_jj' = KroneckerDelta_jj' // // Orthogonality of the phi basis functions is used // to compute the phi integral automatically. Numerical integration is // used to compute the radial integral. The matrix element is given by: // // ^ // | // EP_jj' = | zeta_j(r,phi) * zeta_j'(r,phi) r dr dphi // | // ^ // // The integration is carried out over the membrane surface. // // zeta_j, _j' are the eigenfunctions of the membrane. // // called by: ComputeEPMatrix // plk 03/10/2005 //--------------------------------------------------------------------------- double EPMatrixElement(int inJRow, int inJCol) { int theRowVIndex; int theColVIndex; double theRFactor; double thePhiFactor; double theMagn; double thePhase; double theMembraneRadius_MKS; double PI = 3.1415926535; int theTestRow; double (*theFunc)(double); theRFactor = 1.0; thePhiFactor = 1.0; // set variables, function pointer for NR integration // routine (used to evaluate radial integral). theFunc = EPIntegrandRF; gEPMatrixActiveRow = inJRow; gEPMatrixActiveCol = inJCol; // set v indices for use in phi integration. theRowVIndex = BesselVIndex(inJRow); theColVIndex = BesselVIndex(inJCol); // Assuming Weight function is independent of phi, then the // angular integration is computed analytically. Because of // orthogonality of the angular functions, matrix elements // with v_row != v_column are zero. if (theRowVIndex == theColVIndex) thePhiFactor = 2*PI; else { thePhiFactor = 0.0; theMagn = 0.0; return theMagn; } //------------------------------------------------------ //radial integration: //------------------------------------------------------ theMembraneRadius_MKS = gMembraneRadius_mm*1.0e-3; //DEBUG //dump(theFunc,0,theMembraneRadius_MKS,10); // Trapezoidal Rule Integrator. theRFactor = qtrap(theFunc,0,theMembraneRadius_MKS); // In order for this routine to work, you will probably // have to change all double's to doubles, and make sure // that <math.h> is explicitly included in order to avoid // problems with fabs() and maybe other math functions. // // Romberg Integrator. //theRFactor = qromb(theFunc,0,theMembraneRadius_MKS); //------------------------------------------------------ // for the case of azimuthally symmetric weight function, the // matrix element is a real number. theMagn = theRFactor * thePhiFactor; thePhase = 0; return theMagn; }