(n, a=0, b=0)
return C1Scheme(f"Gauss-Kronrod ({n})", degree, weights, points, source)
Gauss-Kronrod quadrature; see
    <https://en.wikipedia.org/wiki/Gauss%E2%80%93Kronrod_quadrature_formula>.

    Besides points and weights, this class provides the weights of the corresponding
    Gauss-Legendre scheme in self.gauss_weights.

    Code adapted from
    <https://www.cs.purdue.edu/archives/2002/wxg/codes/r_kronrod.m>,
    <https://www.cs.purdue.edu/archives/2002/wxg/codes/kronrod.m>.
Gauss-Kronrod quadrature; see
    <https://en.wikipedia.org/wiki/Gauss%E2%80%93Kronrod_quadrature_formula>.
Gauss - Kronrod quadrature ; see <https : // en . wikipedia . org / wiki / Gauss%E2%80%93Kronrod_quadrature_formula > .
def gauss_kronrod(n, a=0, b=0):
    """
    Gauss-Kronrod quadrature; see
    <https://en.wikipedia.org/wiki/Gauss%E2%80%93Kronrod_quadrature_formula>.

    Besides points and weights, this class provides the weights of the corresponding
    Gauss-Legendre scheme in self.gauss_weights.

    Code adapted from
    <https://www.cs.purdue.edu/archives/2002/wxg/codes/r_kronrod.m>,
    <https://www.cs.purdue.edu/archives/2002/wxg/codes/kronrod.m>.
    """
    # The general scheme is:
    # Get the Jacobi recurrence coefficients, get the Kronrod vectors alpha and beta,
    # and hand those off to scheme_from_rc. There, the eigenproblem for a tridiagonal
    # matrix with alpha and beta is solved to retrieve the points and weights.
    # TODO replace math.ceil by -(-k//n)
    length = int(math.ceil(3 * n / 2.0)) + 1
    degree = 2 * length + 1

    rc = orthopy.c1.jacobi.RecurrenceCoefficients("monic", a, b, symbolic=False)
    _, alpha, beta = np.array([rc[k] for k in range(length)]).T
    beta[0] = rc.int_1

    a, b = _r_kronrod(n, alpha, beta)
    x, w = scheme_from_rc(a, b, rc.int_1, mode="numpy")
    # sort by x
    i = np.argsort(x)
    points = x[i]
    weights = w[i]
    return C1Scheme(f"Gauss-Kronrod ({n})", degree, weights, points, source)
def gauss_kronrod ( n , a = 0 , b = 0 ) : # The general scheme is: # Get the Jacobi recurrence coefficients, get the Kronrod vectors alpha and beta, # and hand those off to scheme_from_rc. There, the eigenproblem for a tridiagonal # matrix with alpha and beta is solved to retrieve the points and weights. # TODO replace math.ceil by -(-k//n) length = int ( math . ceil ( 3 * n / 2.0 ) ) + 1 degree = 2 * length + 1 rc = orthopy . c1 . jacobi . RecurrenceCoefficients ( "monic" , a , b , symbolic = False ) _ , alpha , beta = np . array ( [ rc [ k ] for k in range ( length ) ] ) . T beta [ 0 ] = rc . int_1 a , b = _r_kronrod ( n , alpha , beta ) x , w = scheme_from_rc ( a , b , rc . int_1 , mode = "numpy" ) # sort by x i = np . argsort ( x ) points = x [ i ] weights = w [ i ] return C1Scheme ( f"Gauss-Kronrod ({n})" , degree , weights , points , source )