Exercise 16.1.3#
Question 1#
Implement the linear least squares solution for three variables to find the constants in the Cepheid variable functional relation:
using the same data file as before: ./data/cepheid_data.csv.
Answers:
\(a_0 = -2.15\) mag
\(a_1 = -3.12\) mag
\(a_2 = 1.49\)
Question 2#
Package the multivariate least squares solution into a function, taking the file path (and possibly the delimeter used as well as number of lines to skip) and return the \(\boldsymbol{A}\) matrix. Unlike in the case with the Cepheid variable data, you can assume that the first column of the file will contain \(y\) data and the rest \(x_j\) data.
Test your function on the data sets ./exercise-data/data02.csv and ./exercise-data/data03.csv.
Answers:
Question 3#
Solve the problems in Question 1 and 2, but now using \(\chi^2\) minimization. Use the same data sets with a relative uncertainty 10% for y ( \(\sigma = 0.1 y\)). Note that this may not produce better fits, as the data doesn’t necessarily agree with these uncertainties.
Answers for Question 1:
\(a_0 = -2.13\) mag
\(a_1 = -3.20\) mag
\(a_2 = 1.61\)
Answers for Question 2: