Return the Scaled Companion Matrix of a 1-D Array of Chebyshev Series Coefficients using NumPy in Pythonchebyshev.chebcompanion() Method:chebyshev. chebcompanion() method is used to provide the eigenvalues that estimate the unscaled case and for the basis polynomials. Always, we can say that if we use the numpy.linalg.eigvalsh to obtain the eigenvalues, then the eigenvalues are destined to be real. In this method, we take the input as a coefficient array as a parameter, and the input array should be a 1-D array of the Chebyshev series coefficient ordered, and its order should be from low degree to high degree. This will return the Scaled companion matrix of dimensions. Syntax for chebyshev.chebcompanion() Method: Parameters:
Return value: After the execution, it will return the Scaled companion matrix of dimensions(deg, deg) Example: In the below example, we are going to create a one-dimensional array by taking five coefficients, and it will return the scaled companion matrix along with the shape, dimensions, and datatype of the given array. The output will be a 2D-scaled companion matrix. Output: [ 4 5 6 8 10] The Shape of the array is: (5,) The dimension of the array is: 1 The Datatype of our Array is: int32 [[ 0. 0.70710678 0. -0.28284271] [ 0.70710678 0. 0.5 -0.25 ] [ 0. 0.5 0. 0.2 ] [ 0. 0. 0.5 -0.4 ]] Example 2: In the below example, we are going to create a one-dimensional array by taking six coefficients, and it will return the scaled companion matrix along with the shape, dimensions, and datatype of the given array. The output will be a 2D-scaled companion matrix. Output: [ 4 5 6 8 10 12] The Shape of the array is: (6,) The dimension of the array is: 1 The Datatype of our Array is: int32 [[ 0.012 0.70710678 0.021 0.014 -0.23570226] [ 0.70710678 0.021 0.5 0.03 -0.20833333] [ 0.02 0.5 0.04 0.5 -0.25 ] [ 0.01 0.03 0.5 0.04 0.16666667] [ 0.03 0.06 0.04 0.5 -0.41666667]] |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India