(a, b, degree)
return scaled_poly
Chebyshev polynomial coefficients for the interval [a,b].

    Parameters
    ----------
    a,b : float
        The left and right endpoints of the interval.
    degree : int
        Degree of desired Chebyshev polynomial

    Returns
    -------
    Coefficients of the Chebyshev polynomial C(t) with minimum
    magnitude on the interval [a,b] such that C(0) = 1.0.
    The coefficients are returned in descending order.

    Notes
    -----
    a,b typically represent the interval of the spectrum for some matrix
    that you wish to damp with a Chebyshev smoother.

    Examples
    --------
    >>> from pyamg.relaxation.chebyshev import chebyshev_polynomial_coefficients
    >>> print(chebyshev_polynomial_coefficients(1.0,2.0, 3))
    [-0.32323232  1.45454545 -2.12121212  1.        ]
Chebyshev polynomial coefficients for the interval [a,b].
Chebyshev polynomial coefficients for the interval [ a b ] .
def chebyshev_polynomial_coefficients(a, b, degree):
    """Chebyshev polynomial coefficients for the interval [a,b].

    Parameters
    ----------
    a,b : float
        The left and right endpoints of the interval.
    degree : int
        Degree of desired Chebyshev polynomial

    Returns
    -------
    Coefficients of the Chebyshev polynomial C(t) with minimum
    magnitude on the interval [a,b] such that C(0) = 1.0.
    The coefficients are returned in descending order.

    Notes
    -----
    a,b typically represent the interval of the spectrum for some matrix
    that you wish to damp with a Chebyshev smoother.

    Examples
    --------
    >>> from pyamg.relaxation.chebyshev import chebyshev_polynomial_coefficients
    >>> print(chebyshev_polynomial_coefficients(1.0,2.0, 3))
    [-0.32323232  1.45454545 -2.12121212  1.        ]

    """
    if a >= b or a <= 0:
        raise ValueError(f'invalid interval [{a},{b}]')

    # Chebyshev roots for the interval [-1,1]
    std_roots = np.cos(np.pi * (np.arange(degree) + 0.5) / degree)

    # Chebyshev roots for the interval [a,b]
    scaled_roots = 0.5 * (b-a) * (1 + std_roots) + a

    # Compute monic polynomial coefficients of polynomial with scaled roots
    scaled_poly = np.poly(scaled_roots)

    # Scale coefficients to enforce C(0) = 1.0
    scaled_poly /= np.polyval(scaled_poly, 0)

    return scaled_poly
def chebyshev_polynomial_coefficients ( a , b , degree ) : if a >= b or a <= 0 : raise ValueError ( f'invalid interval [{a},{b}]' ) # Chebyshev roots for the interval [-1,1] std_roots = np . cos ( np . pi * ( np . arange ( degree ) + 0.5 ) / degree ) # Chebyshev roots for the interval [a,b] scaled_roots = 0.5 * ( b - a ) * ( 1 + std_roots ) + a # Compute monic polynomial coefficients of polynomial with scaled roots scaled_poly = np . poly ( scaled_roots ) # Scale coefficients to enforce C(0) = 1.0 scaled_poly /= np . polyval ( scaled_poly , 0 ) return scaled_poly