11 June 2024 10:16:33 AM companion_matrix_test(): C++ 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 * T5(x) +2 * T4(x) +3 * T3(x) +4 * T2(x) +5 * T1(x) +6 * T0(x) Monomial q(x) = +16 * x^5 +16 * x^4 -8 * x^3 -8 * x^2 +1 * x +4 Roots of q(x): 0: -0.520594 0.469916 1: -0.520594 -0.469916 2: 0.599455 0.282318 3: 0.599455 -0.282318 4: -1.15772 0 Chebyshev companion matrix C(p): Col: 0 1 2 3 4 Row 0: 0 1 0 0 0 1: 0.5 0 0.5 0 0 2: 0 0.5 0 0.5 0 3: 0 0 0.5 0 0.5 4: -3 -2.5 -2 -1 -1 Eigenvalues of C(p): 0: 0.599455 0.282318 1: 0.599455 -0.282318 2: -1.15772 0 3: -0.520594 0.469916 4: -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 * T5(x) +2 * T4(x) +3 * T3(x) +4 * T2(x) +5 * T1(x) +6 * T0(x) Gegenbauer parameter alpha will be 0.5 Monomial q(x) = +7.875 * x^5 +8.75 * x^4 -1.25 * x^3 -1.5 * x^2 +2.375 * x +4.75 Roots of q(x): 0: 0.626608 0.526603 1: 0.626608 -0.526603 2: -0.57237 0.640794 3: -0.57237 -0.640794 4: -1.21959 0 Gegenbauer companion matrix C(p): Col: 0 1 2 3 4 Row 0: 0 1 0 0 0 1: 0.333333 0 0.666667 0 0 2: 0 0.4 0 0.6 0 3: 0 0 0.428571 0 0.571429 4: -3.33333 -2.77778 -2.22222 -1.22222 -1.11111 Eigenvalues of C(p): 0: -1.21959 0 1: -0.57237 0.640794 2: -0.57237 -0.640794 3: 0.626608 0.526603 4: 0.626608 -0.526603 Gegenbauer parameter alpha will be 1 Monomial q(x) = +32 * x^5 +32 * x^4 -8 * x^3 -8 * x^2 +4 * x +4 Roots of q(x): 0: 0.489159 0.338048 1: 0.489159 -0.338048 2: -0.489159 0.338048 3: -0.489159 -0.338048 4: -1 0 Gegenbauer companion matrix C(p): Col: 0 1 2 3 4 Row 0: 0 0.5 0 0 0 1: 0.5 0 0.5 0 0 2: 0 0.5 0 0.5 0 3: 0 0 0.5 0 0.5 4: -3 -2.5 -2 -1 -1 Eigenvalues of C(p): 0: 0.489159 0.338048 1: 0.489159 -0.338048 2: -1 0 3: -0.489159 0.338048 4: -0.489159 -0.338048 companion_hermite_test(): companion_hermite() computes the companion matrix of a polynomial p(x) in the Hermite basis. p(x) +1 * H5(x) +2 * H4(x) +3 * H3(x) +4 * H2(x) +5 * H1(x) +6 * H0(x) Monomial q(x) = +32 * x^5 +32 * x^4 -136 * x^3 -80 * x^2 +94 * x +22 Roots of q(x): 0: -0.210374 0 1: -1.11155 0 2: 0.799762 0 3: -2.17107 0 4: 1.69323 0 Hermite companion matrix C(p): Col: 0 1 2 3 4 Row 0: 0 0.5 0 0 0 1: 1 0 0.5 0 0 2: 0 2 0 0.5 0 3: 0 0 3 0 0.5 4: -3 -2.5 -2 2.5 -1 Eigenvalues of C(p): 0: -2.17107 0 1: -1.11155 0 2: -0.210374 0 3: 0.799762 0 4: 1.69323 0 companion_laguerre_test(): companion_laguerre() computes the companion matrix of a polynomial p(x) in the Laguerre basis. p(x) +1 * L5(x) +2 * L4(x) +3 * L3(x) +4 * L2(x) +5 * L1(x) +6 * L0(x) Monomial q(x) = -0.00833333 * x^5 +0.291667 * x^4 -3.5 * x^3 +17.5 * x^2 -35 * x +21 Roots of q(x): 0: 1.03111 0 1: 2.83721 0 2: 5.62029 0 3: 9.68291 0 4: 15.8285 0 Laguerre companion matrix C(p): Col: 0 1 2 3 4 Row 0: 1 -1 0 0 0 1: -1 3 -2 0 0 2: 0 -2 5 -3 0 3: 0 0 -3 7 -4 4: 30 25 20 11 19 Eigenvalues of C(p): 0: 15.8285 0 1: 9.68291 0 2: 5.62029 0 3: 1.03111 0 4: 2.83721 0 companion_legendre_test(): companion_legendre() computes the companion matrix of a polynomial p(x) in the Legendre basis. p(x) +1 * P5(x) +2 * P4(x) +3 * P3(x) +4 * P2(x) +5 * P1(x) +6 * P0(x) Monomial q(x) = +7.875 * x^5 +8.75 * x^4 -1.25 * x^3 -1.5 * x^2 +2.375 * x +4.75 Roots of q(x): 0: 0.626608 0.526603 1: 0.626608 -0.526603 2: -0.57237 0.640794 3: -0.57237 -0.640794 4: -1.21959 0 Legendre companion matrix C(p): Col: 0 1 2 3 4 Row 0: 0 1 0 0 0 1: 0.333333 0 0.666667 0 0 2: 0 0.4 0 0.6 0 3: 0 0 0.428571 0 0.571429 4: -3.33333 -2.77778 -2.22222 -1.22222 -1.11111 Eigenvalues of C(p): 0: -1.21959 0 1: -0.57237 0.640794 2: -0.57237 -0.640794 3: 0.626608 0.526603 4: 0.626608 -0.526603 companion_monomial_test(): companion_monomial() computes the companion matrix of a polynomial p(x) in the monomial basis. p(x) = +1 * x^5 +2 * x^4 +3 * x^3 +4 * x^2 +5 * x +6 Roots of q(x): 0: 0.551685 1.25335 1: 0.551685 -1.25335 2: -1.4918 0 3: -0.805786 1.2229 4: -0.805786 -1.2229 Monomial companion matrix C(p): Col: 0 1 2 3 4 Row 0: 0 1 0 0 0 1: 0 0 1 0 0 2: 0 0 0 1 0 3: 0 0 0 0 1 4: -6 -5 -4 -3 -2 Eigenvalues of C(p): 0: 0.551685 1.25335 1: 0.551685 -1.25335 2: -1.4918 0 3: -0.805786 1.2229 4: -0.805786 -1.2229 companion_matrix_test(): Normal end of execution. 11 June 2024 10:16:33 AM