(n, mode="numpy")
return C1Scheme("Chebyshev-Gauss 1", degree, weights, points)
Chebyshev-Gauss quadrature for \\int_{-1}^1 f(x) / sqrt(1+x^2) dx.
Chebyshev-Gauss quadrature for \\int_{-1}^1 f(x) / sqrt(1+x^2) dx.
Chebyshev - Gauss quadrature for \\ int_ { - 1 } ^1 f ( x ) / sqrt ( 1 + x^2 ) dx .
def chebyshev_gauss_1(n, mode="numpy"):
    """Chebyshev-Gauss quadrature for \\int_{-1}^1 f(x) / sqrt(1+x^2) dx."""
    degree = n if n % 2 == 1 else n + 1

    if mode == "numpy":
        points = np.cos((2 * np.arange(1, n + 1) - 1) / (2 * n) * np.pi)
        weights = np.full(n, np.pi / n)
    elif mode == "sympy":
        points = np.array(
            [
                sympy.cos(sympy.Rational(2 * k - 1, 2 * n) * sympy.pi)
                for k in range(1, n + 1)
            ]
        )
        weights = np.full(n, sympy.pi / n)
    else:
        assert mode == "mpmath"
        points = np.array(
            [mp.cos(mp.mpf(2 * k - 1) / (2 * n) * mp.pi) for k in range(1, n + 1)]
        )
        weights = np.full(n, mp.pi / n)
    return C1Scheme("Chebyshev-Gauss 1", degree, weights, points)
def chebyshev_gauss_1 ( n , mode = "numpy" ) : degree = n if n % 2 == 1 else n + 1 if mode == "numpy" : points = np . cos ( ( 2 * np . arange ( 1 , n + 1 ) - 1 ) / ( 2 * n ) * np . pi ) weights = np . full ( n , np . pi / n ) elif mode == "sympy" : points = np . array ( [ sympy . cos ( sympy . Rational ( 2 * k - 1 , 2 * n ) * sympy . pi ) for k in range ( 1 , n + 1 ) ] ) weights = np . full ( n , sympy . pi / n ) else : assert mode == "mpmath" points = np . array ( [ mp . cos ( mp . mpf ( 2 * k - 1 ) / ( 2 * n ) * mp . pi ) for k in range ( 1 , n + 1 ) ] ) weights = np . full ( n , mp . pi / n ) return C1Scheme ( "Chebyshev-Gauss 1" , degree , weights , points )