ex-1: print the mode error

This commit is contained in:
Michele Guerini Rocco 2020-04-04 20:12:58 +02:00
parent fd6fa78566
commit df7a630094

View File

@ -60,7 +60,7 @@ double neg_landau_pdf(double x, void* params) {
* interval for the optimisation. * interval for the optimisation.
*/ */
double numeric_mode(double min, double max) { double numeric_mode(double min, double max) {
// create funtion // create function
gsl_function pdf; gsl_function pdf;
pdf.function = &neg_landau_pdf; pdf.function = &neg_landau_pdf;
pdf.params = NULL; pdf.params = NULL;
@ -86,6 +86,8 @@ double numeric_mode(double min, double max) {
} while (status == GSL_CONTINUE && iter < max_iter); } while (status == GSL_CONTINUE && iter < max_iter);
fprintf(stderr, "mode error: %.3g\n", max - min);
// Free memory // Free memory
gsl_min_fminimizer_free(s); gsl_min_fminimizer_free(s);
return guess; return guess;
@ -107,7 +109,7 @@ double abs_landau_pdf(double x, void* params_) {
* computer with `numeric_mode(min, max)`. * computer with `numeric_mode(min, max)`.
*/ */
double numeric_fwhm(double min, double max, double mode) { double numeric_fwhm(double min, double max, double mode) {
// create funtion // create function
gsl_function pdf; gsl_function pdf;
pdf.function = &abs_landau_pdf; pdf.function = &abs_landau_pdf;
double params [1]; double params [1];