08 June 2024 10:52:42.650 AM companion_matrix_test(): Fortran90 version companion_matrix() computes the companion matrix of a polynomial, in various bases. companion_chebyshev_test(): companion_chebyshev() computes the companion matrix of a polynomial p(x) in the Chebyshev basis. p(x) = + 1.00000 * T 5(x) + 2.00000 * T 4(x) + 3.00000 * T 3(x) + 4.00000 * T 2(x) + 5.00000 * T 1(x) + 6.00000 * T 0(x) Monomial q(x) p(x) = 16.0000 * x ^ 5 + 16.0000 * x ^ 4 - 8.00000 * x ^ 3 - 8.00000 * x ^ 2 + 1.00000 * x + 4.00000 Roots of q(x): 1 0.599455 0.282318 2 0.599455 -0.282318 3 -0.520594 0.469916 4 -0.520594 -0.469916 5 -1.15772 0.00000 Chebyshev companion matrix C(p): Col 1 2 3 4 5 Row 1: 0.00000 1.00000 0.00000 0.00000 0.00000 2: 0.500000 0.00000 0.500000 0.00000 0.00000 3: 0.00000 0.500000 0.00000 0.500000 0.00000 4: 0.00000 0.00000 0.500000 0.00000 0.500000 5: -3.00000 -2.50000 -2.00000 -1.00000 -1.00000 Eigenvalues of C(p): 1 0.599455 0.282318 2 0.599455 -0.282318 3 -1.15772 0.00000 4 -0.520594 0.469916 5 -0.520594 -0.469916 companion_gegenbauer_test(): companion_gegenbauer() computes the companion matrix of a polynomial p(x) in the Gegenbauer basis. p(x) = + 1.00000 * C 5(x) + 2.00000 * C 4(x) + 3.00000 * C 3(x) + 4.00000 * C 2(x) + 5.00000 * C 1(x) + 6.00000 * C 0(x) Gegenbauer parameter alpha will be 0.500000 Monomial q(x) p(x) = 7.87500 * x ^ 5 + 8.75000 * x ^ 4 - 1.25000 * x ^ 3 - 1.50000 * x ^ 2 + 2.37500 * x + 4.75000 Roots of q(x): 1 0.626608 0.526603 2 0.626608 -0.526603 3 -0.572370 0.640794 4 -0.572370 -0.640794 5 -1.21959 0.00000 Gegenbauer companion matrix C(p) Col 1 2 3 4 5 Row 1: 0.00000 1.00000 0.00000 0.00000 0.00000 2: 0.333333 0.00000 0.666667 0.00000 0.00000 3: 0.00000 0.400000 0.00000 0.600000 0.00000 4: 0.00000 0.00000 0.428571 0.00000 0.571429 5: -3.33333 -2.77778 -2.22222 -1.22222 -1.11111 Eigenvalues of C(p): 1 -1.21959 0.00000 2 -0.572370 0.640794 3 -0.572370 -0.640794 4 0.626608 0.526603 5 0.626608 -0.526603 Gegenbauer parameter alpha will be 1.00000 Monomial q(x) p(x) = 32.0000 * x ^ 5 + 32.0000 * x ^ 4 - 8.00000 * x ^ 3 - 8.00000 * x ^ 2 + 4.00000 * x + 4.00000 Roots of q(x): 1 0.489159 0.338048 2 0.489159 -0.338048 3 -0.489159 0.338048 4 -0.489159 -0.338048 5 -1.00000 0.00000 Gegenbauer companion matrix C(p) Col 1 2 3 4 5 Row 1: 0.00000 0.500000 0.00000 0.00000 0.00000 2: 0.500000 0.00000 0.500000 0.00000 0.00000 3: 0.00000 0.500000 0.00000 0.500000 0.00000 4: 0.00000 0.00000 0.500000 0.00000 0.500000 5: -3.00000 -2.50000 -2.00000 -1.00000 -1.00000 Eigenvalues of C(p): 1 0.489159 0.338048 2 0.489159 -0.338048 3 -1.00000 0.00000 4 -0.489159 0.338048 5 -0.489159 -0.338048 companion_hermite_test(): companion_hermite() computes the companion matrix of a polynomial p(x) in the Hermite basis. Hermite p(x) = + 1.00000 * H 5(x) + 2.00000 * H 4(x) + 3.00000 * H 3(x) + 4.00000 * H 2(x) + 5.00000 * H 1(x) + 6.00000 * H 0(x) Monomial q(x) p(x) = 32.0000 * x ^ 5 + 32.0000 * x ^ 4 - 136.000 * x ^ 3 - 80.0000 * x ^ 2 + 94.0000 * x + 22.0000 Roots of q(x): 1 -0.210374 0.00000 2 -1.11155 0.00000 3 0.799762 0.00000 4 1.69323 0.00000 5 -2.17107 0.00000 Hermite companion matrix C(p): Col 1 2 3 4 5 Row 1: 0.00000 0.500000 0.00000 0.00000 0.00000 2: 1.00000 0.00000 0.500000 0.00000 0.00000 3: 0.00000 2.00000 0.00000 0.500000 0.00000 4: 0.00000 0.00000 3.00000 0.00000 0.500000 5: -3.00000 -2.50000 -2.00000 2.50000 -1.00000 Eigenvalues of C(p): 1 -2.17107 0.00000 2 -1.11155 0.00000 3 -0.210374 0.00000 4 0.799762 0.00000 5 1.69323 0.00000 companion_laguerre_test(): companion_laguerre() computes the companion matrix of a polynomial p(x) in the Laguerre basis. Laguerre p(x) = + 1.00000 * L 5(x) + 2.00000 * L 4(x) + 3.00000 * L 3(x) + 4.00000 * L 2(x) + 5.00000 * L 1(x) + 6.00000 * L 0(x) Monomial q(x) p(x) = - 0.833333E-02 * x ^ 5 + 0.291667 * x ^ 4 - 3.50000 * x ^ 3 + 17.5000 * x ^ 2 - 35.0000 * x + 21.0000 Roots of q(x): 1 1.03111 0.00000 2 2.83721 0.00000 3 5.62029 0.00000 4 9.68291 0.00000 5 15.8285 0.00000 Laguerre companion matrix C(p): Col 1 2 3 4 5 Row 1: 1.00000 -1.00000 0.00000 0.00000 0.00000 2: -1.00000 3.00000 -2.00000 0.00000 0.00000 3: 0.00000 -2.00000 5.00000 -3.00000 0.00000 4: 0.00000 0.00000 -3.00000 7.00000 -4.00000 5: 30.0000 25.0000 20.0000 11.0000 19.0000 Eigenvalues of C(p): 1 15.8285 0.00000 2 9.68291 0.00000 3 5.62029 0.00000 4 1.03111 0.00000 5 2.83721 0.00000 companion_legendre_test(): companion_legendre() computes the companion matrix of a polynomial p(x) in the Legendre basis. Legendre p(x) = + 1.00000 * P 5(x) + 2.00000 * P 4(x) + 3.00000 * P 3(x) + 4.00000 * P 2(x) + 5.00000 * P 1(x) + 6.00000 * P 0(x) Monomial q(x) p(x) = 7.87500 * x ^ 5 + 8.75000 * x ^ 4 - 1.25000 * x ^ 3 - 1.50000 * x ^ 2 + 2.37500 * x + 4.75000 Roots of q(x): 1 0.626608 0.526603 2 0.626608 -0.526603 3 -0.572370 0.640794 4 -0.572370 -0.640794 5 -1.21959 0.00000 Legendre companion matrix C(p): Col 1 2 3 4 5 Row 1: 0.00000 1.00000 0.00000 0.00000 0.00000 2: 0.333333 0.00000 0.666667 0.00000 0.00000 3: 0.00000 0.400000 0.00000 0.600000 0.00000 4: 0.00000 0.00000 0.428571 0.00000 0.571429 5: -3.33333 -2.77778 -2.22222 -1.22222 -1.11111 Eigenvalues of C(p): 1 -1.21959 0.00000 2 -0.572370 0.640794 3 -0.572370 -0.640794 4 0.626608 0.526603 5 0.626608 -0.526603 companion_monomial_test(): companion_monomial() computes the companion matrix of a polynomial p(x) in the monomial basis. p(x) p(x) = 1.00000 * x ^ 5 + 2.00000 * x ^ 4 + 3.00000 * x ^ 3 + 4.00000 * x ^ 2 + 5.00000 * x + 6.00000 Roots of q(x): 1 0.551685 1.25335 2 0.551685 -1.25335 3 -0.805786 1.22290 4 -0.805786 -1.22290 5 -1.49180 0.00000 Monomial companion matrix C(p): Col 1 2 3 4 5 Row 1: 0.00000 1.00000 0.00000 0.00000 0.00000 2: 0.00000 0.00000 1.00000 0.00000 0.00000 3: 0.00000 0.00000 0.00000 1.00000 0.00000 4: 0.00000 0.00000 0.00000 0.00000 1.00000 5: -6.00000 -5.00000 -4.00000 -3.00000 -2.00000 Eigenvalues of C(p): 1 0.551685 1.25335 2 0.551685 -1.25335 3 -1.49180 0.00000 4 -0.805786 1.22290 5 -0.805786 -1.22290 companion_matrix_test(): Normal end of execution. 08 June 2024 10:52:42.651 AM