Polynomial Fitting
We demonstrate in this tutorial how to use BayesBay to tackle a polynomial fitting problem. In the following, we utilise a third-degree polynomial, \(y(x) = m_0 + m_1 x + m_2 x^2 + m_3 x^3\), to generate data points \(y_1(x_1), y_2(x_2), \ldots, y_n(x_n)\). In matrix notation, these can be expressed as
or \(\mathbf{d}_{pred} = \mathbf{G m}\).
Having generated a synthetic data set using the model coefficients \(m_0\), \(m_1\), \(m_2\), and \(m_3\), we add noise to define the observed data \(\mathbf{d}_{obs} = \mathbf{d}_{pred} + \mathbf{e}\), where the \(i\)th entry of the observational error \(\mathbf{e}\) is randomly sampled from the normal distribution \(\mathcal{N}(0, \sigma)\). Finally, we use BayesBay to retrieve the true coefficients from the observations.
This tutorial comprises two parts: