def _quadratic_poly_coef_from_3_values(x1, x2, x3, n1, n2, n3):
    """
    Returns the coeficients a, b and c of a quadratic polynomial of the form
    n = a*x**2 * b*x + c from 3 known points.

    Parameters
    ----------
    x1, x2, x3 : float
        The positions of the values.
    n1, n2, n3 : float
        The values at positions x1, x2 and x3 respectively.

    Returns
    -------
    a, b, c : float
        The coefficients.
    """
    a = ((n2 - n1) * (x1 - x3) + (n3 - n1) * (x2 - x1)) / ((x1 - x3) * (x2 **
        2 - x1 ** 2) + (x2 - x1) * (x3 ** 2 - x1 ** 2))
    b = (n2 - n1 - a * (x2 ** 2 - x1 ** 2)) / (x2 - x1)
    c = n1 - a * x1 ** 2 - b * x1
    return a, b, c
