Exercise 15.3#
Question 1#
exercise-data/data08.csv
contains measurements of variables \(x\) and \(y\), and the uncertainty of \(y\), \(\sigma\). The proposed functional relationship between these variables is:
Part 1#
Ignoring the standard deviation for now, find the values of \(a_0\), \(a_1\) and \(a_2\) that minimize the sum of errors squared using the scipy.optimize.least_squares
function.
Plot the data points and curve of best fit on the same set of axis to make sure you have indeed found the best fit.
Part 2#
Now, taking the uncertainty into account, perform a \(\chi^2\) minimization to find the best fit.
Note that in Part 1 the residual function is:
what is the residual when \(\chi^2\) is the objective function (the function to be minimized)?
Part 3#
Use scipy.optimize.curve_fit
to find the the values of \(a_0\), \(a_1\) and \(a2\) using the data file. Note that the curve_fit
function takes an argument for the uncertainty of \(y\) (sigma
). Compare your results from this part to Part 2.
Question 2#
Repeat Part 2 and Part 3 of the process from Question 1 with exercise-data/data09.tsv
(a tab seperated data file), and the proposed functional relation: