diff --git a/ex-4/main.c b/ex-4/main.c index e0e1019..364bc1c 100644 --- a/ex-4/main.c +++ b/ex-4/main.c @@ -19,12 +19,12 @@ int parser(size_t *N, size_t *n, double *p_max, char argc, char **argv, size_t * else if (!strcmp(argv[i], "-o")) *go = 1; else { - fprintf(stderr, "Usage: %s -[hnbp]\n", argv[0]); + fprintf(stderr, "Usage: %s -[hnbpo]\n", argv[0]); fprintf(stderr, "\t-h\tShow this message.\n"); - fprintf(stderr, "\t-n N\tThe number of events to generate. (default: 50000)\n"); + fprintf(stderr, "\t-n N\tThe number of particles to generate. (default: 50000)\n"); fprintf(stderr, "\t-b N\tThe number of bins of the histogram. (default: 50)\n"); fprintf(stderr, "\t-p PMAX\tThe maximum value of momentum. (default: 10)\n"); - fprintf(stderr, "\t-o \tPrint histogram to stdout.\n"); + fprintf(stderr, "\t-o\tPrint histogram to stdout.\n"); return 0; } } @@ -42,7 +42,7 @@ int main(int argc, char **argv) double p_max = 10; size_t go = 0; int res = parser(&N, &n, &p_max, argc, argv, &go); - if (go == 0) + if (go == 0 && res == 1) { printf("\nGenerating histogram with:\n" "%ld points\n" @@ -145,12 +145,12 @@ int main(int argc, char **argv) func.function = &chi2; func.params = ¶ms; - double min_p = 5; - double max_p = 15; + double min_p = p_max - 5; + double max_p = p_max + 5; // Initialize minimization. // - double x = 10; + double x = p_max; int max_iter = 100; double prec = 1e-7; int status = GSL_CONTINUE; diff --git a/makefile b/makefile index 9df4aea..292f168 100644 --- a/makefile +++ b/makefile @@ -24,7 +24,7 @@ ex-4: ex-4/bin/main ex-4/bin/main: ex-4/main.c ex-4/lib.c $(CCOMPILE) -ex-5: ex-5/bin/casino ex-5/bin/manual ex-5/bin/trifecta +ex-5: ex-5/bin/main ex-5/bin/%: ex-5/%.c $(CCOMPILE)