(points, weights)
return alpha, beta, int_1
Given the points and weights of a Gaussian quadrature rule, this method
    reconstructs the recurrence coefficients alpha, beta as appearing in the tridiagonal
    Jacobi matrix tri(b, a, b). This is using "Method 2--orthogonal reduction" from
    (section 3.2 in [4]).  The complexity is O(n^3); a faster method is suggested in 3.3
    in [4].
Given the points and weights of a Gaussian quadrature rule, this method
    reconstructs the recurrence coefficients alpha, beta as appearing in the tridiagonal
    Jacobi matrix tri(b, a, b). This is using "Method 2--orthogonal reduction" from
    (section 3.2 in [4]).  The complexity is O(n^3); a faster method is suggested in 3.3
    in [4].
Given the points and weights of a Gaussian quadrature rule this method reconstructs the recurrence coefficients alpha beta as appearing in the tridiagonal Jacobi matrix tri ( b a b ) . This is using Method 2 -- orthogonal reduction from ( section 3 . 2 in [ 4 ] ) . The complexity is O ( n^3 ) ; a faster method is suggested in 3 . 3 in [ 4 ] .
def coefficients_from_gauss(points, weights):
    """Given the points and weights of a Gaussian quadrature rule, this method
    reconstructs the recurrence coefficients alpha, beta as appearing in the tridiagonal
    Jacobi matrix tri(b, a, b). This is using "Method 2--orthogonal reduction" from
    (section 3.2 in [4]).  The complexity is O(n^3); a faster method is suggested in 3.3
    in [4].
    """
    n = len(points)
    assert n == len(weights)

    flt = np.vectorize(float)
    points = flt(points)
    weights = flt(weights)

    A = np.zeros((n + 1, n + 1))

    # In sytrd, the _last_ row/column of Q are e, so put the values there.
    a00 = 1.0
    A[n, n] = a00
    k = np.arange(n)
    A[k, k] = points
    A[n, :-1] = np.sqrt(weights)
    A[:-1, n] = np.sqrt(weights)

    # Implemented in
    # <https://github.com/scipy/scipy/issues/7775>
    sytrd, sytrd_lwork = get_lapack_funcs(("sytrd", "sytrd_lwork"))

    # query lwork (optional)
    lwork, info = sytrd_lwork(n + 1)
    assert info == 0

    _, d, e, _, info = sytrd(A, lwork=lwork)
    assert info == 0

    alpha = d[:-1][::-1]
    beta = e[::-1] ** 2
    int_1 = beta[0]
    beta[0] = math.nan

    return alpha, beta, int_1
def coefficients_from_gauss ( points , weights ) : n = len ( points ) assert n == len ( weights ) flt = np . vectorize ( float ) points = flt ( points ) weights = flt ( weights ) A = np . zeros ( ( n + 1 , n + 1 ) ) # In sytrd, the _last_ row/column of Q are e, so put the values there. a00 = 1.0 A [ n , n ] = a00 k = np . arange ( n ) A [ k , k ] = points A [ n , : - 1 ] = np . sqrt ( weights ) A [ : - 1 , n ] = np . sqrt ( weights ) # Implemented in # <https://github.com/scipy/scipy/issues/7775> sytrd , sytrd_lwork = get_lapack_funcs ( ( "sytrd" , "sytrd_lwork" ) ) # query lwork (optional) lwork , info = sytrd_lwork ( n + 1 ) assert info == 0 _ , d , e , _ , info = sytrd ( A , lwork = lwork ) assert info == 0 alpha = d [ : - 1 ] [ : : - 1 ] beta = e [ : : - 1 ] ** 2 int_1 = beta [ 0 ] beta [ 0 ] = math . nan return alpha , beta , int_1