halotools.empirical_models.solve_for_polynomial_coefficients(abscissa, ordinates)[source]

Solves for coefficients of the unique, minimum-degree polynomial that passes through the input abscissa and attains values equal the input ordinates.


Elements are the abscissa at which the desired values of the polynomial have been tabulated.


Elements are the desired values of the polynomial when evaluated at the abscissa.


Elements are the coefficients determining the polynomial. Element i of polynomial_coefficients gives the degree i polynomial coefficient.


Input arrays abscissa and ordinates can in principle be of any dimension Ndim, and there will be Ndim output coefficients.

The input ordinates specify the desired values of the polynomial when evaluated at the Ndim inputs specified by the input abscissa. There exists a unique, order Ndim polynomial that returns the input ordinates when the polynomial is evaluated at the input abscissa. The coefficients of that unique polynomial are the output of the function.

As an example, suppose that a model in which the quenched fraction is \(F_{q}(logM_{\mathrm{halo}} = 12) = 0.25\) and \(F_{q}(logM_{\mathrm{halo}} = 15) = 0.9\). Then this function takes [12, 15] as the input abscissa, [0.25, 0.9] as the input ordinates, and returns the array \([c_{0}, c_{1}]\). The unique polynomial linear in \(log_{10}M\) that passes through the input ordinates and abscissa is given by \(F(logM) = c_{0} + c_{1}*log_{10}logM\).


>>> abscissa = [0, 2]
>>> ordinates = [0, 2]
>>> coeff = solve_for_polynomial_coefficients(abscissa, ordinates)
>>> assert np.allclose(coeff, (0, 1))