c++ - Chi-square test from gsl while integrating gives 0 -


i'm trying calculate multiple integrant using gsl library seems endless because chisq value equals 0. here integrating method:

double integr::fgg(double x_val, double k_val){      double result, error;     double bound_up[] = {2*m_pi, 2*m_pi, k_max, k_max};     double bound_down[] = {0,0,k_min, k_min};     const gsl_rng_type *t;     gsl_rng *r;      struct f_params params = {x_val, k_val};     gsl_monte_function fgg = {&integr::integrant_prot, 4, &params};     size_t calls = 5000;     gsl_rng_env_setup();     t = gsl_rng_default;     r = gsl_rng_alloc(t);      //warm     gsl_monte_vegas_state *s = gsl_monte_vegas_alloc(4);     gsl_monte_vegas_integrate(&fgg, bound_down, bound_up, 4, 1000, r, s, &result, &error);      //integration     do{         gsl_monte_vegas_integrate(&fgg, bound_down, bound_up, 4, calls/5, r, s, &result, &error);     }while(fabs(s->chisq - 1.0)>0.5);      gsl_monte_vegas_free(s);     return result; } 

can tell why value isn't changing? there sth wrong code or gsl usage? have admit i'm new gsl.

[edit] integrand function:

double integr::integrant_prot(double *args, size_t dim, void *params){      struct f_params *fp = (struct f_params *) params;     return integr::integrantfgg(fp->x_val, fp->k_val, args[0], args[1], args[2], args[3]); } 


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -