11.5. Exercises for Lecture 11#

11.5.1. Exercise 11.1#

After defining, in a dedicated library, a linear function \(\phi(x, \theta)\) with two parameters \(\theta\):

  • Write a program that generates a set of 10 pairs \((x_i, y_i)\) such that the points \(x_i\) are randomly distributed along the horizontal axis between 0 and 10, and the points \(y_i\) are constructed using the formula \(y_i = \phi(x_i, \theta) + \epsilon_i\).

  • Plot the obtained sample, including the expected error bars.

11.5.2. Exercise 11.2#

Use the iMinuit library to perform a fit on the simulated sample.

  • Check if the fit was successful.

  • Print the values of the determined parameters and their sigmas on the screen.

11.5.3. Exercise 11.3#

  • Calculate the value of \(Q^2\) using the points and the fitted function obtained in the previous exercise.

  • Compare the value obtained with iminuit with the calculated one.

  • Print the value of the degrees of freedom of the fit.

11.5.4. Exercise 11.4#

Using the toy experiments technique, generate 10,000 fit experiments with the model studied in the previous exercises and fill a histogram with the obtained values of \(Q^2\).

  • Compare the expected value of \(Q^2\) obtained from the toy experiments with the degrees of freedom of the problem.

11.5.5. Exercise 11.5#

Modify the previous program by deliberately changing the experimental uncertainty associated with the points \(y_i\) in the sample and verify that it’s possible to recover the uncertainty used in generating the points through the expected value of the variable \(Q^2\).

11.5.6. Exercise 11.6#

Add to Exercise 11.3 the screen printout of the entire covariance matrix of the fit parameters.

11.5.7. Exercise 11.7#

Repeat the fitting exercise for a parabolic trend.