ex-1: improve QDF accuracy and print error

This commit is contained in:
Michele Guerini Rocco 2020-04-01 01:34:57 +02:00
parent 9cc7cd9903
commit e4fc0098dd
2 changed files with 6 additions and 4 deletions

View File

@ -88,8 +88,10 @@ double landau_qdf(double p0) {
stat = gsl_root_fsolver_iterate(s);
low = gsl_root_fsolver_x_lower(s);
upp = gsl_root_fsolver_x_upper(s);
stat = gsl_root_test_interval(low, upp, 0, 0.01);
stat = gsl_root_test_interval(low, upp, 0, 0.001);
}
fprintf(stderr, "QDF error: %.3g\n", upp - low);
return gsl_root_fsolver_root(s);
}

View File

@ -97,7 +97,7 @@ int main(int argc, char** argv) {
}
}
fprintf(stderr, "\n\n# Mode comparison\n");
fprintf(stderr, "\nstep: %.2f\n ", (max - min)/bins);
fprintf(stderr, "step: %.2f\n ", (max - min)/bins);
f_mode_o = f_mode_o/samples;
mode_o = min + (maxbin + 0.5)*(max - min)/bins;
@ -142,7 +142,7 @@ int main(int argc, char** argv) {
fprintf(stderr, "\n\n# FWHM comparison\n");
double fwhm_e = numeric_fwhm(min, max, mode_e);
fprintf(stderr, "\n# Results\n");
fprintf(stderr, "\n## Results\n");
fprintf(stderr, "expected FWHM: %.7f\n", fwhm_e);
fprintf(stderr, "observed FWHM: %.3f\n", fwhm_o);
@ -160,7 +160,7 @@ int main(int argc, char** argv) {
samples); // number of elements
// print the results
fprintf(stderr, "\n# Results\n");
fprintf(stderr, "\n## Results\n");
fprintf(stderr, "expected median: %.7f\n", med_e);
fprintf(stderr, "observed median: %.7f\n", med_o);