From 365b2397016f0598fe9206970ed375fb9dcab2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gi=C3=B9=20Marcer?= Date: Mon, 27 Apr 2020 23:53:23 +0200 Subject: [PATCH] =?UTF-8?q?ex-4:=20=CF=87=C2=B2=20minimization=20results?= =?UTF-8?q?=20reported?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ex-4/main.c | 7 +++++-- notes/sections/4.md | 30 ++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/ex-4/main.c b/ex-4/main.c index 8dda0ec..03ecd2b 100644 --- a/ex-4/main.c +++ b/ex-4/main.c @@ -160,7 +160,10 @@ int main(int argc, char **argv) } double result = x; - printf("p_max: %.7f\n", result); + double res_chi = chi2(result, ¶ms); + printf("Results:\n"); + printf("χ² = %.3f\n", res_chi); + printf("p_max = %.3f\n", result); // Compute the second derivative of χ² in its minimum for the result error. // @@ -189,7 +192,7 @@ int main(int argc, char **argv) error = error + A + B; }; error = 1/error; - printf("ΔP_max: %.7f\n\n", error); + printf("ΔP_max = %.3f\n\n", error); // Free memory. diff --git a/notes/sections/4.md b/notes/sections/4.md index 60adde4..55a07db 100644 --- a/notes/sections/4.md +++ b/notes/sections/4.md @@ -151,13 +151,16 @@ $$ Finally, putting all the pieces together, the average value of $|P_v|$ can now be computed: -$$ - \langle |P_v| \rangle = \int +\begin{align*} + \langle |P_v| \rangle &= \int \limits_{- \sqrt{P_{\text{max}}^2 - P_h}}^{\sqrt{P_{\text{max}}^2 - P_h}} - f (P_v | P_h = x) = [ \dots ] = - x \, \frac{\ln \left( \frac{P_{\text{max}}}{x} \right)} - {\text{atan} \left( \sqrt{ \frac{P_{\text{max}}}{x^2} - 1} \right)} -$$ + f (P_v | P_h = x) + \\ + &= [ \dots ] + \\ + &= x \, \frac{\ln \left( \frac{P_{\text{max}}}{x} \right)} + {\text{atan} \left( \sqrt{ \frac{P^2_{\text{max}}}{x^2} - 1} \right)} +\end{align*} Namely: @@ -218,3 +221,18 @@ $$ The following result was obtained: ![Histogram of the obtained distribution.](images/dip.pdf) + +In order to check wheter the expected distribution properly metches the +produced histogram, a chi-squared minimization was applied. Being a simple +one-parameter fit, the $\chi^2$ was computed without a suitable GSL function +and the error of the so obtained estimation of $p_{\text{max}}$ was given as +the inverese of the $\chi^3$ second derivative in its minimum, according to the +Cramér-Rao bound. +The following results were obtained: + +$$ + p_{\text{max}} = 10 \pm 0.016 \with \chi^2 = 0.072 +$$ + +which allows to assert that the sampled points actually follow the predicted +distribution.