Tue Apr 16 19:07:05 2024 companion_matrix_test(): python version: 3.10.12 numpy version: 1.26.4 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.0 * T5(x) + 2.0 * T4(x) + 3.0 * T3(x) + 4.0 * T2(x) + 5.0 * T1(x) + 6.0 * T0(x) Monomial q(x) = + 16.0 * x^5 + 16.0 * x^4 + -8.0 * x^3 + -8.0 * x^2 + 1.0 * x^1 + 4.0 * x^0 Roots of q(x): [-1.15772219+0.j -0.52059361-0.46991561j -0.52059361+0.46991561j 0.5994547 -0.28231773j 0.5994547 +0.28231773j] Chebyshev companion matrix A(p): [[ 0. 1. 0. 0. 0. ] [ 0.5 0. 0.5 0. 0. ] [ 0. 0.5 0. 0.5 0. ] [ 0. 0. 0.5 0. 0.5] [-3. -2.5 -2. -1. -1. ]] Eigenvalues of A(p): [ 0.5994547 +0.28231773j 0.5994547 -0.28231773j -1.15772219+0.j -0.52059361+0.46991561j -0.52059361-0.46991561j] companion_gegenbauer_test(): companion_gegenbauer() computes the companion matrix of a polynomial p(x) in the Gegenbauer basis. alpha = 0.5 p(x) = + 1.0 * C5(x) + 2.0 * C4(x) + 3.0 * C3(x) + 4.0 * C2(x) + 5.0 * C1(x) + 6.0 * C0(x) Monomial q(x) = + 7.875 * x^5 + 8.75 * x^4 + -1.25 * x^3 + -1.5 * x^2 + 2.375 * x^1 + 4.75 * x^0 Roots of q(x): [-1.21958761+0.j -0.57236995-0.64079421j -0.57236995+0.64079421j 0.6266082 -0.52660313j 0.6266082 +0.52660313j] Gegenbauer companion matrix A(p): [[ 0. 1. 0. 0. 0. ] [ 0.33333333 0. 0.66666667 0. 0. ] [ 0. 0.4 0. 0.6 0. ] [ 0. 0. 0.42857143 0. 0.57142857] [-3.33333333 -2.77777778 -2.22222222 -1.22222222 -1.11111111]] Eigenvalues of A(p): [-1.21958761+0.j -0.57236995+0.64079421j -0.57236995-0.64079421j 0.6266082 +0.52660313j 0.6266082 -0.52660313j] alpha = 1.0 p(x) = + 1.0 * C5(x) + 2.0 * C4(x) + 3.0 * C3(x) + 4.0 * C2(x) + 5.0 * C1(x) + 6.0 * C0(x) Monomial q(x) = + 32.0 * x^5 + 32.0 * x^4 + -8.0 * x^3 + -8.0 * x^2 + 4.0 * x^1 + 4.0 * x^0 Roots of q(x): [-1. +0.j -0.48915917-0.33804836j -0.48915917+0.33804836j 0.48915917-0.33804836j 0.48915917+0.33804836j] Gegenbauer companion matrix A(p): [[ 0. 0.5 0. 0. 0. ] [ 0.5 0. 0.5 0. 0. ] [ 0. 0.5 0. 0.5 0. ] [ 0. 0. 0.5 0. 0.5] [-3. -2.5 -2. -1. -1. ]] Eigenvalues of A(p): [ 0.48915917+0.33804836j 0.48915917-0.33804836j -1. +0.j -0.48915917+0.33804836j -0.48915917-0.33804836j] companion_hermite_test(): companion_hermite() computes the companion matrix of a polynomial p(x) in the Hermite basis. Hermite p(x) = + 1.0 * H5(x) + 2.0 * H4(x) + 3.0 * H3(x) + 4.0 * H2(x) + 5.0 * H1(x) + 6.0 * H0(x) Monomial q(x) = + 32.0 * x^5 + 32.0 * x^4 + -136.0 * x^3 + -80.0 * x^2 + 94.0 * x^1 + 22.0 * x^0 Roots of q(x): [-2.17106865 -1.11155197 -0.21037397 0.79976198 1.69323261] Hermite companion matrix A(p): [[ 0. 0.5 0. 0. 0. ] [ 1. 0. 0.5 0. 0. ] [ 0. 2. 0. 0.5 0. ] [ 0. 0. 3. 0. 0.5] [-3. -2.5 -2. 2.5 -1. ]] Eigenvalues of A(p): [-2.17106865+0.j -1.11155197+0.j -0.21037397+0.j 0.79976198+0.j 1.69323261+0.j] companion_laguerre_test(): companion_laguerre() computes the companion matrix of a polynomial p(x) in the Laguerre basis. Laguerre p(x) = + 1.0 * L5(x) + 2.0 * L4(x) + 3.0 * L3(x) + 4.0 * L2(x) + 5.0 * L1(x) + 6.0 * L0(x) Monomial q(x) = + -0.008333333333333333 * x^5 + 0.29166666666666663 * x^4 + -3.5 * x^3 + 17.5 * x^2 + -35.0 * x^1 + 21.0 * x^0 Roots of q(x): [ 1.03110914 2.83721282 5.62029427 9.68290984 15.82847392] Laguerre companion matrix A(p): [[ 1. -1. 0. 0. 0.] [-1. 3. -2. 0. 0.] [ 0. -2. 5. -3. 0.] [ 0. 0. -3. 7. -4.] [30. 25. 20. 11. 19.]] Eigenvalues of A(p): [15.82847392+0.j 9.68290984+0.j 5.62029427+0.j 1.03110914+0.j 2.83721282+0.j] companion_legendre_test(): companion_legendre() computes the companion matrix of a polynomial p(x) in the Legendre basis. Legendre p(x) = + 1.0 * P5(x) + 2.0 * P4(x) + 3.0 * P3(x) + 4.0 * P2(x) + 5.0 * P1(x) + 6.0 * P0(x) Monomial q(x) = + 7.875 * x^5 + 8.75 * x^4 + -1.25 * x^3 + -1.5 * x^2 + 2.375 * x^1 + 4.75 * x^0 Roots of q(x): [-1.21958761+0.j -0.57236995-0.64079421j -0.57236995+0.64079421j 0.6266082 -0.52660313j 0.6266082 +0.52660313j] Legendre companion matrix A(p): [[ 0. 1. 0. 0. 0. ] [ 0.33333333 0. 0.66666667 0. 0. ] [ 0. 0.4 0. 0.6 0. ] [ 0. 0. 0.42857143 0. 0.57142857] [-3.33333333 -2.77777778 -2.22222222 -1.22222222 -1.11111111]] Eigenvalues of A(p): [-1.21958761+0.j -0.57236995+0.64079421j -0.57236995-0.64079421j 0.6266082 +0.52660313j 0.6266082 -0.52660313j] companion_monomial_test(): companion_monomial() computes the companion matrix of a polynomial p(x) in the monomial basis. p(x) = + 1.0 * x^5 + 2.0 * x^4 + 3.0 * x^3 + 4.0 * x^2 + 5.0 * x^1 + 6.0 * x^0 Monomial p(x) = + 1.0 * x^5 + 2.0 * x^4 + 3.0 * x^3 + 4.0 * x^2 + 5.0 * x^1 + 6.0 * x^0 Roots of p(x): [-1.49179799+0.j -0.80578647-1.22290471j -0.80578647+1.22290471j 0.55168546-1.25334886j 0.55168546+1.25334886j] Monomial companion matrix A(p): [[ 0. 1. 0. 0. 0.] [ 0. 0. 1. 0. 0.] [ 0. 0. 0. 1. 0.] [ 0. 0. 0. 0. 1.] [-6. -5. -4. -3. -2.]] Eigenvalues of A(p): [ 0.55168546+1.25334886j 0.55168546-1.25334886j -1.49179799+0.j -0.80578647+1.22290471j -0.80578647-1.22290471j] companion_matrix_test(): Normal end of execution. Tue Apr 16 19:07:05 2024