- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Return the scaled companion matrix of a 1-D array of Chebyshev series coefficients in Python

To return the scaled companion matrix of a 1-D array of polynomial coefficients, return the chebyshev.chebcompanion() method in Python Numpy. The basis polynomials are scaled so that the companion matrix is symmetric when c is a Chebyshev basis polynomial. This provides better eigenvalue estimates than the unscaled case and for basis polynomials the eigenvalues are guaranteed to be real if numpy.linalg.eigvalsh is used to obtain them. The method returns the Scaled companion matrix of dimensions (deg, deg). The parameter, c is a 1-D array of Chebyshev series coefficients ordered from low to high degree.

## Steps

At first, import the required library −

import numpy as np from numpy.polynomial import chebyshev as C

Create a 1D array of coefficients −

c = np.array([1, 2, 3])

Display the array −

print("Our Array...\n",c)

Check the Dimensions −

print("\nDimensions of our Array...\n",c.ndim)

Get the Datatype −

print("\nDatatype of our Array object...\n",c.dtype)

Get the Shape −

print("\nShape of our Array object...\n",c.shape)

To return the scaled companion matrix of a 1-D array of polynomial coefficients, return the chebyshev.chebcompanion() method in Python Numpy −

print("\nResult...\n",C.chebcompanion(c))

## Example

import numpy as np from numpy.polynomial import chebyshev as C # Create a 1D array of coefficients c = np.array([1, 2, 3]) # Display the array print("Our Array...\n",c) # Check the Dimensions print("\nDimensions of our Array...\n",c.ndim) # Get the Datatype print("\nDatatype of our Array object...\n",c.dtype) # Get the Shape print("\nShape of our Array object...\n",c.shape) # To return the scaled companion matrix of a 1-D array of polynomial coefficients, return the chebyshev.chebcompanion() method in Python Numpy print("\nResult...\n",C.chebcompanion(c))

## Output

Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result... [[ 0. 0.47140452] [ 0.70710678 -0.33333333]]

- Related Articles
- Return the scaled companion matrix of a 1-D array of Hermite series coefficients in Python
- Return the scaled companion matrix of a 1-D array of Hermite_e series coefficients in Python
- Return the scaled companion matrix of a 1-D array of Laguerre polynomial coefficients in Python
- Return the scaled companion matrix of a 1-D array of Legendre polynomial coefficients in Python
- Return the companion matrix of a 1-D array of polynomial coefficients in Python
- Differentiate a Chebyshev series with multidimensional coefficients over axis 1 in Python
- Differentiate a Chebyshev series with multidimensional coefficients in Python
- Differentiate a Chebyshev series with multidimensional coefficients over specific axis in Python
- Evaluate a Chebyshev series at points x when coefficients are multi-dimensional in Python
- Integrate a Chebyshev series over axis 1 in Python
- Compute the roots of a Chebyshev series in Python
- Evaluate a 2-D Chebyshev series at points (x, y) with 1D array of coefficient in Python
- Evaluate a 2-D Chebyshev series at points (x, y) with 3D array of coefficient in Python
- Generate a Vandermonde matrix of the Chebyshev polynomial with float array of points in Python
- Generate a Vandermonde matrix of the Chebyshev polynomial with complex array of points in Python