double dndeeq(double E, double r ){ //total time timer start std::clock_t start; double duration; start = std::clock(); ///////before algorithm double dndeeq = (1 / c.bloss(E,r))*gslInt_diffusion(E, r); ////////after algorithm duration = (std::clock() - start)/(double) CLOCKS_PER_SEC; if ( isnan(dndeeq) == 1) std::cout << "dndeeq(E = "<< E << " , r = " << r/kpc2cm << " ) = "<< dndeeq <<" --> " << duration << std::endl; return dndeeq; }
double dndeeq(double E, double r ){ //total time timer start std::clock_t start; double duration; start = std::clock(); ///////before algorithm double rh = c.rh * mpc2cm ; int imNum = 4; //number of image pairs + 1, total points = 2*imNum + 1 double diffsum = 0 ; for (int i = -imNum; i < imNum + 1; ++i ){ double ri; if (i == 0) ri = r; else ri = (pow(-1 , i)*r + 2*i*rh); diffsum += pow(-1, i) * gslInt_diffusion(E, ri, r); }; double dndeeq = (1 / c.bloss(E,r))* diffsum ; //gslInt_diffusion(E, r); ////////after algorithm duration = (std::clock() - start)/(double) CLOCKS_PER_SEC; if ( isnan(dndeeq) == 1) std::cout << "dndeeq(E = "<< E << " , r = " << r/mpc2cm*1000 << " ) = "<< dndeeq <<" --> " << duration << std::endl; return dndeeq; }
double dv(double E , void * params){ double dv = c.D(E)/c.bloss(E); return dv; }