Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 11:37:04 chebyshev_polynomial_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7. Test chebyshev_polynomial(). chebyshev_polynomial_test01(): t_project_coefficients_data() estimates the Chebyshev polynomial coefficients for a function given as data (x,fx). Here, we use fx = f(x) = x^2 for the data. Since T(0,x) = 1 and T(2,x) = 2*x^2 - 1, the correct expansion is f(x) = 1/2 T(0,x) + 0 T(1,x) + 1/2 T(2,x) + 0 * all other polys, if Chebyshev polynomials are based in [-1,+1]. Chebyshev polynomials will be based in [0,1] Data ( X, D ): 1: 0.814724 0.663775 2: 0.905792 0.820459 3: 0.126987 0.0161257 4: 0.913376 0.834255 5: 0.632359 0.399878 6: 0.0975404 0.00951413 7: 0.278498 0.0775613 8: 0.546882 0.299079 9: 0.957507 0.916819 10: 0.964889 0.93101 11: 0.157613 0.0248419 12: 0.970593 0.94205 13: 0.957167 0.916169 14: 0.485376 0.23559 15: 0.80028 0.640449 16: 0.141886 0.0201317 17: 0.421761 0.177883 18: 0.915736 0.838572 19: 0.792207 0.627592 20: 0.959492 0.920626 Coefficients of Chebyshev expansion of degree 4. 1: 0.375 2: 0.5 3: 0.125 4: -9.36384e-17 I X(I) Data(I) Chebyshev(X(I)) 1 0.814724 0.663775 0.663775 2 0.905792 0.820459 0.820459 3 0.126987 0.0161257 0.0161257 4 0.913376 0.834255 0.834255 5 0.632359 0.399878 0.399878 6 0.0975404 0.00951413 0.00951413 7 0.278498 0.0775613 0.0775613 8 0.546882 0.299079 0.299079 9 0.957507 0.916819 0.916819 10 0.964889 0.93101 0.93101 11 0.157613 0.0248419 0.0248419 12 0.970593 0.94205 0.94205 13 0.957167 0.916169 0.916169 14 0.485376 0.23559 0.23559 15 0.80028 0.640449 0.640449 16 0.141886 0.0201317 0.0201317 17 0.421761 0.177883 0.177883 18 0.915736 0.838572 0.838572 19 0.792207 0.627592 0.627592 20 0.959492 0.920626 0.920626 t_mass_matrix_test(): t_mass_matrix() computes the mass matrix for the Chebyshev T polynomials T(i,x). A(I,J) = integral ( -1 <=x <= +1 ) T(i,x) T(j,x) / sqrt ( 1 - x^2 ) dx 0 if i is not equal to j; pi if i = j = 0; pi/2 if i = j =/= 0. T mass matrix: Col: 1 2 3 4 Row 1 : 3.14159 7.77156e-16 -5.55112e-16 -2.22045e-16 2 : 7.77156e-16 1.5708 1.11022e-16 3.33067e-16 3 :-5.55112e-16 3.33067e-16 1.5708 6.10623e-16 4 :-2.22045e-16 3.33067e-16 6.38378e-16 1.5708 t_moment_test(): t_moment() returns the value of integral ( -1 <=x <= +1 ) x^e / sqrt ( 1 - x^2 ) dx E Integral 0 3.14159 1 0 2 1.5708 3 0 4 1.1781 5 0 6 0.981748 7 0 8 0.859029 9 0 10 0.773126 t_polynomial_test(): t_polynomial() evaluates the Chebyshev polynomial T(n,x). Tabulated Computed N X T(n,x) T(n,x) Error 0 0.8 1 1 0 1 0.8 0.8 0.8 0 2 0.8 0.28 0.2800000000000002 -2.2e-16 3 0.8 -0.352 -0.3519999999999996 -3.3e-16 4 0.8 -0.8431999999999999 -0.8431999999999997 -2.2e-16 5 0.8 -0.99712 -0.99712 0 6 0.8 -0.752192 -0.7521920000000004 4.4e-16 7 0.8 -0.2063872 -0.2063872000000007 6.7e-16 8 0.8 0.42197248 0.4219724799999993 6.7e-16 9 0.8 0.881543168 0.8815431679999997 3.3e-16 10 0.8 0.9884965888 0.9884965888000001 -1.1e-16 11 0.8 0.7000513741 0.7000513740800007 2e-11 12 0.8 0.1315856097 0.131585609728001 -2.8e-11 t_polynomial_ab_test(): t_polynomial_ab() evaluates Chebyshev polynomials TAB(n,x) shifted from [-1,+1] to the domain [A,B]. Here, we will use the new domain [0,1] and the desired maximum polynomial degree will be N = 5. Tables of T values: Col: 1 2 3 4 5 Row 1 : 1 -1 1 -1 1 2 : 1 -0.8 0.28 0.352 -0.8432 3 : 1 -0.6 -0.28 0.936 -0.8432 4 : 1 -0.4 -0.68 0.944 -0.0752 5 : 1 -0.2 -0.92 0.568 0.6928 6 : 1 0 -1 -0 1 7 : 1 0.2 -0.92 -0.568 0.6928 8 : 1 0.4 -0.68 -0.944 -0.0752 9 : 1 0.6 -0.28 -0.936 -0.8432 10 : 1 0.8 0.28 -0.352 -0.8432 11 : 1 1 1 1 1 Col: 6 Row 1 : -1 2 : 0.99712 3 : 0.07584 4 : -0.88384 5 : -0.84512 6 : 0 7 : 0.84512 8 : 0.88384 9 : -0.07584 10 : -0.99712 11 : 1 t_polynomial_ab_value_test(): t_polynomial_ab_value() evaluates the shifted Chebyshev polynomial TAB(n,x). Here, we will use the new domain [0,1]. Tabulated Computed N X01 T01(n,x) T01(n,x) Error -1 0.850000 0.0000000000000000e+00 0.0000000000000000e+00 0 0 0.850000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.850000 6.9999999999999996e-01 6.9999999999999996e-01 0 2 0.850000 -2.0000000000000000e-02 -2.0000000000000129e-02 1.3e-16 3 0.850000 -7.2799999999999998e-01 -7.2800000000000009e-01 1.1e-16 4 0.850000 -9.9919999999999998e-01 -9.9919999999999998e-01 0 5 0.850000 -6.7088000000000003e-01 -6.7087999999999981e-01 -2.2e-16 6 0.850000 5.9968000000000000e-02 5.9968000000000354e-02 -3.5e-16 7 0.850000 7.5483520000000004e-01 7.5483520000000026e-01 -2.2e-16 8 0.850000 9.9680128000000001e-01 9.9680128000000001e-01 0 9 0.850000 6.4068659200000000e-01 6.4068659199999978e-01 2.2e-16 10 0.850000 -9.9840051200000002e-02 -9.9840051200000390e-02 3.9e-16 11 0.850000 -7.8046266367999995e-01 -7.8046266368000028e-01 3.3e-16 12 0.850000 -9.9280767795199998e-01 -9.9280767795199987e-01 -1.1e-16 7 0.000000 -1.0000000000000000e+00 -1.0000000000000000e+00 0 7 0.100000 2.0638719999999999e-01 2.0638720000000066e-01 -6.7e-16 7 0.200000 -9.7847039999999996e-01 -9.7847039999999996e-01 0 7 0.300000 2.5802239999999999e-01 2.5802239999999987e-01 1.1e-16 7 0.400000 9.8702080000000003e-01 9.8702080000000003e-01 0 7 0.500000 0.0000000000000000e+00 -0.0000000000000000e+00 0 7 0.600000 -9.8702080000000003e-01 -9.8702080000000003e-01 0 7 0.700000 -2.5802239999999999e-01 -2.5802240000000076e-01 7.8e-16 7 0.800000 9.7847039999999996e-01 9.7847040000000041e-01 -4.4e-16 7 0.900000 -2.0638719999999999e-01 -2.0638720000000066e-01 6.7e-16 7 1.000000 1.0000000000000000e+00 1.0000000000000000e+00 0 t_polynomial_coefficient_table_test(): t_polynomial_coefficient_table() determines a table of ans = 58 coefficients for T(0:n,x). +1.000000 +1.000000 * x +2.000000 * x^2 -1.000000 +4.000000 * x^3 -3.000000 * x +8.000000 * x^4 -8.000000 * x^2 +1.000000 +16.000000 * x^5 -20.000000 * x^3 +5.000000 * x t_polynomial_coefficients_test(): t_polynomial_coefficients() determines the coefficients of T(d,x). Coefficients of T5(x) = +16.000000 * x^5 -20.000000 * x^3 +5.000000 * x t_polynomial_value_test(): t_polynomial_value() evaluates the Chebyshev polynomial T(n,x). Tabulated Computed N X T(n,x) T(n,x) Error 0 0.800000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.800000 8.0000000000000004e-01 8.0000000000000004e-01 0 2 0.800000 2.8000000000000003e-01 2.8000000000000025e-01 -2.2e-16 3 0.800000 -3.5199999999999998e-01 -3.5199999999999965e-01 -3.3e-16 4 0.800000 -8.4319999999999995e-01 -8.4319999999999973e-01 -2.2e-16 5 0.800000 -9.9712000000000001e-01 -9.9712000000000001e-01 0 6 0.800000 -7.5219199999999997e-01 -7.5219200000000042e-01 4.4e-16 7 0.800000 -2.0638719999999999e-01 -2.0638720000000066e-01 6.7e-16 8 0.800000 4.2197247999999998e-01 4.2197247999999932e-01 6.7e-16 9 0.800000 8.8154316799999999e-01 8.8154316799999966e-01 3.3e-16 10 0.800000 9.8849658880000002e-01 9.8849658880000013e-01 -1.1e-16 11 0.800000 7.0005137409999996e-01 7.0005137408000073e-01 2e-11 12 0.800000 1.3158560969999999e-01 1.3158560972800104e-01 -2.8e-11 t_polynomial_zeros_test(): t_polynomial_zeros() computes the zeros of T(n,x); N X T(n,x) 1 0.0000 6.12323e-17 1 0.7071 2.22045e-16 2 -0.7071 -2.22045e-16 1 0.8660 3.33067e-16 2 0.0000 -1.83697e-16 3 -0.8660 -3.33067e-16 1 0.9239 -2.22045e-16 2 0.3827 -2.22045e-16 3 -0.3827 1.11022e-16 4 -0.9239 -2.22045e-16 1 0.9511 -4.44089e-16 2 0.5878 0 3 0.0000 3.06162e-16 4 -0.5878 -7.77156e-16 5 -0.9511 4.44089e-16 t_quadrature_rule_test(): t_quadrature_rule() computes the quadrature rule associated with T(n,x); X W 1: -0.974928 0.448799 2: -0.781831 0.448799 3: -0.433884 0.448799 4: 2.19909e-16 0.448799 5: 0.433884 0.448799 6: 0.781831 0.448799 7: 0.974928 0.448799 Use the quadrature rule to estimate: Q = Integral ( -1 <= X <= +1 ) X^E / sqrt ( 1-x^2) dx E Q_Estimate Q_Exact 0 3.14159 3.14159 1 -1.11022e-16 0 2 1.5708 1.5708 3 -1.11022e-16 0 4 1.1781 1.1781 5 -1.11022e-16 0 6 0.981748 0.981748 7 5.55112e-17 0 8 0.859029 0.859029 9 1.66533e-16 0 10 0.773126 0.773126 11 2.22045e-16 0 12 0.708699 0.708699 13 3.33067e-16 0 chebyshev_polynomial_test07(): t_project_coefficients() computes the Chebyshev coefficients of a function defined over [-1,+1]. t_project_coefficients_ab() works in [A,B]. Chebyshev coefficients for exp(x) in [-1,+1] 1: 1.26607 2: 1.13031 3: 0.27145 4: 0.0437939 Chebyshev coefficients for exp(x) in [-1,+1] 1: 1.26607 2: 1.13032 3: 0.271495 4: 0.0443368 5: 0.00547404 6: 0.000539728 Chebyshev coefficients for sin(x) in [-1,+1] 1: 1.85037e-17 2: 0.880101 3: 1.11022e-16 4: -0.0391267 5: 2.77556e-16 6: 0.00050252 Chebyshev coefficients for sin(x) in [-1,+1] 1: 1.85037e-17 2: 0.880101 3: 1.11022e-16 4: -0.0391267 5: 3.14563e-16 6: 0.00050252 Chebyshev coefficients for sqrt(x) in [0,+1] 1: 0.638441 2: 0.420681 3: -0.0808705 4: 0.0318506 5: -0.01484 6: 0.00614694 chebyshev_polynomial_test08(): t_project_coefficients_data() computes the Chebyshev coefficients of a function defined by data. We are looking for an approximation that is good in [-1,+1]. Begin by using equally spaced points in [-1,+1]. Chebyshev coefficients for exp(x) on [-1,+1] 1: 1.26667 2: 1.13052 3: 0.271785 4: 0.0443939 Chebyshev coefficients for exp(x) on [-1,+1] 1: 1.26608 2: 1.13032 3: 0.271515 4: 0.0443381 5: 0.00547599 6: 0.000542394 Chebyshev coefficients for sin(x) on [-1,+1] 1: -1.45427e-19 2: 0.880099 3: -1.51791e-17 4: -0.0391279 5: 1.91121e-17 6: 0.000500014 Now sample equally spaced points in [0,+1]. The approximation still applies to the interval [-1,+1]. Chebyshev coefficients for sin(x) on [0,+1] 1: 0.449926 2: 0.425221 3: -0.0293448 4: -0.00449978 5: 0.00015411 6: 1.41389e-05 Chebyshev coefficients for sqrt(x) on [0,+1] 1: 0.627654 2: 0.439083 3: -0.0996074 4: 0.0460427 5: -0.0260146 6: 0.014499 Now random points in [-1,+1]. Chebyshev coefficients for sin(x) on [-1,+1] 1: 1.35157e-06 2: 0.880107 3: 2.76201e-06 4: -0.0391212 5: 1.23493e-06 6: 0.000504624 chebyshev_polynomial_test09(): t_project_coefficients() computes the Chebyshev interpolant C(F)(N,X) of a function F(X) defined over [-1,+1]. t_project_value() evaluates that projection. Compute projections of order N to exp(x) over [-1,+1], N Max|F(X)-C(F)(N,X)| 0 1.718 1 0.3722 2 0.05647 3 0.006657 4 0.0006397 5 5.18e-05 6 3.62e-06 7 2.224e-07 8 1.219e-08 9 6.027e-10 10 2.714e-11 chebyshev_polynomial_test10(): t_project_coefficients_ab() computes the Chebyshev interpolant C(F)(N,X) of a function F(X) defined over [A,B]. t_project_value_ab() evaluates that projection. Compute projections of order N to exp(x) over [0.000000, 1.500000], N Max|F(X)-C(F)(N,X)| 0 2.365 1 0.3967 2 0.04629 3 0.004159 4 0.0003031 5 1.855e-05 6 9.786e-07 7 4.532e-08 8 1.87e-09 9 6.956e-11 10 2.354e-12 tt_product_test(): tt_product(i,j;x) = T(I,X) * T(J,X) I J X TI TJ TI*TJ TT_PRODUCT 0 0 0.412092 1 1 1 1 0 3 -0.907657 1 -0.268092 -0.268092 -0.268092 2 4 0.389657 -0.696334 -0.0302366 0.0210548 0.0210548 3 1 -0.931108 -0.435616 -0.931108 0.405606 0.405606 5 0 0.531034 0.335837 1 0.335837 0.335837 3 2 -0.0204712 0.0613793 -0.999162 -0.0613279 -0.0613279 5 0 0.41873 0.831256 1 0.831256 0.831256 4 -1 0.359405 0.100106 0 0 0 3 4 -0.762005 0.516179 -0.947963 -0.489318 -0.489318 4 0 -0.319229 0.267825 1 0.267825 0.267825 tt_product_integral_test(): tt_product_integral() computes the product integral of a pair of Chebyshev T polynomials T(i,x) and T(j,x). A(I,J) = integral ( -1 <=x <= +1 ) T(i,x) T(j,x) / sqrt ( 1 - x^2 ) dx 0 if i is not equal to j; pi if i = j = 0; pi/2 if i = j =/= 0. T(i,x)*T(j,x) integral matrix: Col: 1 2 3 4 5 Row 1 : 3.14159 0 0 0 0 2 : 0 1.5708 0 0 0 3 : 0 0 1.5708 0 0 4 : 0 0 0 1.5708 0 5 : 0 0 0 0 1.5708 ttt_product_integral_test(): ttt_product_integral() computes the triple integral Tijk = integral ( -1 <= x <= 1 ) T(i,x) T(j,x) T(k,x) / sqrt ( 1-x^2) dx I J K Tijk Tijk computed exact 5 1 2 0 -5.55112e-15 5 3 4 0 -7.27196e-15 4 1 0 0 -4.52416e-15 3 3 1 0 -2.7478e-15 6 1 4 0 -3.55271e-15 3 1 1 0 -2.7478e-15 5 2 1 0 -5.55112e-15 6 2 2 0 -6.80012e-15 6 1 3 0 -6.4948e-15 5 2 2 0 -3.91354e-15 2 1 2 0 -1.77636e-15 5 3 0 0 -4.63518e-15 4 2 0 0 -4.60743e-15 3 1 3 0 -2.7478e-15 3 2 0 0 -2.498e-15 5 1 3 0 -3.66374e-15 5 3 2 0.785398 0.785398 2 1 4 0 -3.91354e-15 2 3 2 0 -3.08087e-15 6 1 2 0 -5.30131e-15 tu_product_test(): tu_product(i,j;x) = T(I,X) * U(J,X) I J X TI UJ TI*UJ TU_PRODUCT 6 -1 -0.786694 -0.659556 0 -0 0 5 4 0.549821 0.228799 -1.16544 -0.266652 -0.266652 2 0 -0.831128 0.381549 1 0.381549 0.381549 3 4 0.600137 -0.935819 -1.24648 1.16648 1.16648 1 -1 -0.636306 -0.636306 0 -0 0 6 2 -0.727863 -0.177861 1.11914 -0.199051 -0.199051 1 4 0.0997204 0.0997204 0.882252 0.0879786 0.882252 2 2 0.24411 -0.88082 -0.761641 0.670869 0.670869 0 0 -0.196384 1 1 1 0.5 1 0 -0.753362 -0.753362 1 -0.753362 1 u_mass_matrix_test(): u_mass_matrix() computes the mass matrix for the Chebyshev U polynomials U(i,x). A(I,J) = integral ( -1 <=x <= +1 ) U(i,x) U(j,x) * sqrt ( 1 - x^2 ) dx 0 if i is not equal to j; pi/2 if i = j. U mass matrix: Col: 1 2 3 4 Row 1 : 1.5708 6.66134e-16 5.55112e-17 2.77556e-16 2 : 6.66134e-16 1.5708 1.11022e-15 1.77636e-15 3 : 5.55112e-17 9.99201e-16 1.5708 2.33147e-15 4 : 2.77556e-16 1.77636e-15 2.27596e-15 1.5708 u_moment_test(): u_moment() returns the value of integral ( -1 <=x <= +1 ) x^e * sqrt ( 1 - x^2 ) dx E Integral 0 1.5708 1 0 2 0.392699 3 0 4 0.19635 5 0 6 0.122718 7 0 8 0.0859029 9 0 10 0.0644272 u_polynomial_test(): u_polynomial() evaluates the Chebyshev polynomial U(n,x). Tabulated Computed N X U(n,x) U(n,x) Error 0 0.8 1 1 0 1 0.8 1.6 1.6 0 2 0.8 1.56 1.56 -4.4e-16 3 0.8 0.896 0.8960000000000008 -7.8e-16 4 0.8 -0.1264 -0.1263999999999992 -8.3e-16 5 0.8 -1.09824 -1.098239999999999 -6.7e-16 6 0.8 -1.630784 -1.630784 0 7 0.8 -1.5110144 -1.511014400000001 6.7e-16 8 0.8 -0.78683904 -0.7868390400000014 1.3e-15 9 0.8 0.252071936 0.2520719359999986 1.4e-15 10 0.8 1.1901541376 1.190154137599999 8.9e-16 11 0.8 1.65217468416 1.65217468416 0 12 0.8 1.453325357056 1.453325357056001 -1.1e-15 u_polynomial_ab_test(): u_polynomial_ab() evaluates Chebyshev polynomials UAB(n,x) shifted from [-1,+1] to the domain [A,B]. Here, we will use the new domain [0,1] and the desired maximum polynomial degree will be N = 5. Tables of U values: Col: 1 2 3 4 5 Row 1 : 1 -2 3 -4 5 2 : 1 -1.6 1.56 -0.896 -0.1264 3 : 1 -1.2 0.44 0.672 -1.2464 4 : 1 -0.8 -0.36 1.088 -0.5104 5 : 1 -0.4 -0.84 0.736 0.5456 6 : 1 0 -1 -0 1 7 : 1 0.4 -0.84 -0.736 0.5456 8 : 1 0.8 -0.36 -1.088 -0.5104 9 : 1 1.2 0.44 -0.672 -1.2464 10 : 1 1.6 1.56 0.896 -0.1264 11 : 1 2 3 4 5 Col: 6 Row 1 : -6 2 : 1.09824 3 : 0.82368 4 : -0.67968 5 : -0.95424 6 : 0 7 : 0.95424 8 : 0.67968 9 : -0.82368 10 : -1.09824 11 : 6 u_polynomial_ab_value_test(): u_polynomial_ab_value() evaluates the shifted Chebyshev polynomial UAB(n,x). Here, we will use the new domain [0,1]. Tabulated Computed N X01 U01(n,x) U01(n,x) Error -1 0.850000 0.0000000000000000e+00 0.0000000000000000e+00 0 0 0.850000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.850000 1.3999999999999999e+00 1.3999999999999999e+00 0 2 0.850000 9.5999999999999996e-01 9.5999999999999974e-01 2.2e-16 3 0.850000 -5.6000000000000001e-02 -5.6000000000000272e-02 2.7e-16 4 0.850000 -1.0384000000000000e+00 -1.0384000000000002e+00 2.2e-16 5 0.850000 -1.3977599999999999e+00 -1.3977599999999999e+00 0 6 0.850000 -9.1846399999999995e-01 -9.1846399999999950e-01 -4.4e-16 7 0.850000 1.1191039999999999e-01 1.1191040000000063e-01 -6.4e-16 8 0.850000 1.0751385600000001e+00 1.0751385600000003e+00 -2.2e-16 9 0.850000 1.3932835840000000e+00 1.3932835839999997e+00 2.2e-16 10 0.850000 8.7545845759999996e-01 8.7545845759999930e-01 6.7e-16 11 0.850000 -1.6764174336000001e-01 -1.6764174336000082e-01 8e-16 12 0.850000 -1.1101568983040000e+00 -1.1101568983040004e+00 4.4e-16 7 0.000000 -8.0000000000000000e+00 -8.0000000000000000e+00 0 7 0.100000 1.5110144000000001e+00 1.5110144000000008e+00 -6.7e-16 7 0.200000 -1.1332608000000000e+00 -1.1332608000000002e+00 2.2e-16 7 0.300000 -1.6363520000000001e-01 -1.6363520000000020e-01 1.9e-16 7 0.400000 1.0198016000000001e+00 1.0198016000000001e+00 0 7 0.500000 0.0000000000000000e+00 -0.0000000000000000e+00 0 7 0.600000 -1.0198016000000001e+00 -1.0198016000000001e+00 0 7 0.700000 1.6363520000000001e-01 1.6363519999999931e-01 6.9e-16 7 0.800000 1.1332608000000000e+00 1.1332607999999995e+00 4.4e-16 7 0.900000 -1.5110144000000001e+00 -1.5110144000000008e+00 6.7e-16 7 1.000000 8.0000000000000000e+00 8.0000000000000000e+00 0 u_polynomial_coefficients_test(): u_polynomial_coefficients() determines the polynomial coefficients for U(n,x). +1.000000 +2.000000 * x +4.000000 * x^2 -1.000000 +8.000000 * x^3 -4.000000 * x +16.000000 * x^4 -12.000000 * x^2 +1.000000 +32.000000 * x^5 -32.000000 * x^3 +6.000000 * x u_polynomial_value_test(): u_polynomial_value() evaluates the Chebyshev polynomial U(n,x). Tabulated Computed N X U(n,x) U(n,x) Error 0 0.800000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.800000 1.6000000000000001e+00 1.6000000000000001e+00 0 2 0.800000 1.5600000000000001e+00 1.5600000000000005e+00 -4.4e-16 3 0.800000 8.9600000000000002e-01 8.9600000000000080e-01 -7.8e-16 4 0.800000 -1.2640000000000001e-01 -1.2639999999999918e-01 -8.3e-16 5 0.800000 -1.0982400000000001e+00 -1.0982399999999994e+00 -6.7e-16 6 0.800000 -1.6307840000000000e+00 -1.6307840000000000e+00 0 7 0.800000 -1.5110144000000001e+00 -1.5110144000000008e+00 6.7e-16 8 0.800000 -7.8683904000000005e-01 -7.8683904000000138e-01 1.3e-15 9 0.800000 2.5207193600000000e-01 2.5207193599999855e-01 1.4e-15 10 0.800000 1.1901541376000000e+00 1.1901541375999991e+00 8.9e-16 11 0.800000 1.6521746841600000e+00 1.6521746841600000e+00 0 12 0.800000 1.4533253570560001e+00 1.4533253570560012e+00 -1.1e-15 u_polynomial_zeros_test(): u_polynomial_zeros() computes the zeros of U(n,x); N X U(n,x) 1 0.0000 1.22465e-16 1 0.5000 4.44089e-16 2 -0.5000 -8.88178e-16 1 0.7071 6.66134e-16 2 0.0000 -2.44929e-16 3 -0.7071 6.66134e-16 1 0.8090 0 2 0.3090 -1.11022e-16 3 -0.3090 5.55112e-16 4 -0.8090 -8.88178e-16 1 0.8660 1.33227e-15 2 0.5000 -8.88178e-16 3 0.0000 3.67394e-16 4 -0.5000 -1.77636e-15 5 -0.8660 -1.33227e-15 u_quadrature_rule_test(): u_quadrature_rule() computes the quadrature rule associated with U(n,x); X W 1: -0.92388 0.0575094 2: -0.707107 0.19635 3: -0.382683 0.33519 4: 7.90193e-18 0.392699 5: 0.382683 0.33519 6: 0.707107 0.19635 7: 0.92388 0.0575094 Use the quadrature rule to estimate: Q = Integral ( -1 <= X <= +1 ) X^E * sqrt ( 1-x^2) dx E Q_Estimate Q_Exact 0 1.5708 1.5708 1 2.77556e-17 0 2 0.392699 0.392699 3 -5.55112e-17 0 4 0.19635 0.19635 5 -1.249e-16 0 6 0.122718 0.122718 7 -1.59595e-16 0 8 0.0859029 0.0859029 9 -1.73472e-16 0 10 0.0644272 0.0644272 11 -1.83881e-16 0 12 0.0506214 0.0506214 13 -1.76942e-16 0 uu_product_test: uu_product(i,j;x) = U(I,X) * U(J,X) I J X UI UJ UI*UJ UU_PRODUCT 0 4 -0.165466 1 0.683446 0.683446 0.683446 3 1 0.889574 2.07337 1.77915 3.68883 3.68883 6 1 -0.324561 0.715248 -0.649122 -0.464284 -0.464284 5 1 -0.777594 1.28266 -1.55519 -1.99478 -1.99478 2 -1 -0.516617 0.0675743 0 0 0 6 4 -0.736053 -1.30161 -0.80498 1.04777 1.04777 0 0 0.150417 1 1 1 1 5 -1 -0.293683 -1.02145 0 -0 0 1 2 -0.913952 -1.8279 2.34124 -4.27956 -4.27956 4 1 0.463445 -0.839278 0.92689 -0.777918 -0.777918 uu_product_integral_test(): uu_product_integral() computes the product integral of a pair of Chebyshev U polynomials U(i,x) and U(j,x). A(I,J) = integral ( -1 <=x <= +1 ) U(i,x) U(j,x) sqrt ( 1 - x^2 ) dx 0 if i is not equal to j; pi/2 if i = j U(i,x)*U(j,x) integral matrix: Col: 1 2 3 4 5 Row 1 : 1.5708 0 0 0 0 2 : 0 1.5708 0 0 0 3 : 0 0 1.5708 0 0 4 : 0 0 0 1.5708 0 5 : 0 0 0 0 1.5708 v_mass_matrix_test(): v_mass_matrix() computes the mass matrix for the Chebyshev polynomials V(i,x). A(I,J) = integral ( -1 <=x <= +1 ) V(i,x) V(j,x) sqrt(1+x)/sqrt(1-x) dx 0 if i is not equal to j; pi if i = j. V mass matrix: Col: 1 2 3 4 Row 1 : 3.14159 7.77156e-16 -5.55112e-16 -2.22045e-16 2 : 7.77156e-16 1.5708 1.11022e-16 3.33067e-16 3 :-5.55112e-16 3.33067e-16 1.5708 6.10623e-16 4 :-2.22045e-16 3.33067e-16 6.38378e-16 1.5708 v_moment_test(): v_moment() returns the value of integral ( -1 <=x <= +1 ) x^e * sqrt ( 1 + x ) / sqrt ( 1 - x ) dx E Integral 0 3.14159 1 1.5708 2 1.5708 3 1.1781 4 1.1781 5 0.981748 6 0.981748 7 0.859029 8 0.859029 9 0.773126 10 0.773126 v_polynomial_test(): v_polynomial() evaluates the Chebyshev polynomial V(n,x). Tabulated Computed N X V(n,x) V(n,x) Error 0 0.8 1 1 0 1 0.8 0.6 0.6000000000000001 -1.1e-16 2 0.8 -0.04 -0.03999999999999981 -1.9e-16 3 0.8 -0.664 -0.6639999999999998 -2.2e-16 4 0.8 -1.0224 -1.0224 0 5 0.8 -0.97184 -0.9718400000000001 1.1e-16 6 0.8 -0.532544 -0.5325440000000004 3.3e-16 7 0.8 0.1197696 0.1197695999999996 4.2e-16 8 0.8 0.72417536 0.7241753599999997 3.3e-16 9 0.8 1.038910976 1.038910976 0 10 0.8 0.9380822016 0.9380822016000002 -2.2e-16 11 0.8 0.46202054656 0.4620205465600005 -4.4e-16 12 0.8 -0.198849327104 -0.1988493271039994 -6.1e-16 v_polynomial_ab_test(): v_polynomial_ab() evaluates Chebyshev polynomials VAB(n,x) shifted from [-1,+1] to the domain [A,B]. Here, we will use the new domain [0,1] and the desired maximum polynomial degree will be N = 5. Tables of T values: Col: 1 2 3 4 5 Row 1 : 1 -3 5 -7 9 2 : 1 -2.6 3.16 -2.456 0.7696 3 : 1 -2.2 1.64 0.232 -1.9184 4 : 1 -1.8 0.44 1.448 -1.5984 5 : 1 -1.4 -0.44 1.576 -0.1904 6 : 1 -1 -1 1 1 7 : 1 -0.6 -1.24 0.104 1.2816 8 : 1 -0.2 -1.16 -0.728 0.5776 9 : 1 0.2 -0.76 -1.112 -0.5744 10 : 1 0.6 -0.04 -0.664 -1.0224 11 : 1 1 1 1 1 Col: 6 Row 1 : -11 2 : 1.22464 3 : 2.07008 4 : -0.16928 5 : -1.49984 6 : -1 7 : 0.40864 8 : 1.19008 9 : 0.42272 10 : -0.97184 11 : 1 v_polynomial_ab_value_test(): v_polynomial_ab_value() evaluates the shifted Chebyshev polynomial VAB(n,x). Here, we will use the new domain [0,1]. Tabulated Computed N X01 V01(n,x) V01(n,x) Error -1 0.850000 0.0000000000000000e+00 0.0000000000000000e+00 0 0 0.850000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.850000 4.0000000000000002e-01 3.9999999999999991e-01 1.1e-16 2 0.850000 -4.4000000000000000e-01 -4.4000000000000017e-01 1.7e-16 3 0.850000 -1.0160000000000000e+00 -1.0160000000000000e+00 0 4 0.850000 -9.8240000000000005e-01 -9.8239999999999972e-01 -3.3e-16 5 0.850000 -3.5936000000000001e-01 -3.5935999999999946e-01 -5.6e-16 6 0.850000 4.7929600000000000e-01 4.7929600000000050e-01 -5e-16 7 0.850000 1.0303743999999999e+00 1.0303744000000001e+00 -2.2e-16 8 0.850000 9.6322816000000000e-01 9.6322815999999956e-01 4.4e-16 9 0.850000 3.1814502400000000e-01 3.1814502399999922e-01 7.8e-16 10 0.850000 -5.1782512640000000e-01 -5.1782512640000067e-01 6.7e-16 11 0.850000 -1.0431002009599999e+00 -1.0431002009600001e+00 2.2e-16 12 0.850000 -9.4251515494399996e-01 -9.4251515494399940e-01 -5.6e-16 7 0.000000 -1.5000000000000000e+01 -1.5000000000000000e+01 0 7 0.100000 3.1417983999999999e+00 3.1417984000000003e+00 -4.4e-16 7 0.200000 -1.3912447999999999e+00 -1.3912448000000008e+00 8.9e-16 7 0.300000 -1.2177792000000001e+00 -1.2177792000000005e+00 4.4e-16 7 0.400000 1.1837055999999999e+00 1.1837056000000004e+00 -4.4e-16 7 0.500000 1.0000000000000000e+00 1.0000000000000000e+00 0 7 0.600000 -8.5589760000000004e-01 -8.5589759999999959e-01 -4.4e-16 7 0.700000 -8.9050879999999999e-01 -8.9050880000000054e-01 5.6e-16 7 0.800000 8.7527679999999997e-01 8.7527680000000074e-01 -7.8e-16 7 0.900000 1.1976960000000000e-01 1.1976959999999959e-01 4.2e-16 7 1.000000 1.0000000000000000e+00 1.0000000000000000e+00 0 v_polynomial_coefficients_test(): v_polynomial_coefficients() determines the Chebyshev polynomial coefficients. +1.000000 +2.000000 * x -1.000000 +4.000000 * x^2 -2.000000 * x -1.000000 +8.000000 * x^3 -4.000000 * x^2 -4.000000 * x +1.000000 +16.000000 * x^4 -8.000000 * x^3 -12.000000 * x^2 +4.000000 * x +1.000000 +32.000000 * x^5 -16.000000 * x^4 -32.000000 * x^3 +12.000000 * x^2 +6.000000 * x -1.000000 v_polynomial_value_test(): v_polynomial_value() evaluates the Chebyshev polynomial V(n,x). Tabulated Computed N X V(n,x) V(n,x) Error 0 0.800000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.800000 5.9999999999999998e-01 6.0000000000000009e-01 -1.1e-16 2 0.800000 -4.0000000000000001e-02 -3.9999999999999813e-02 -1.9e-16 3 0.800000 -6.6400000000000003e-01 -6.6399999999999981e-01 -2.2e-16 4 0.800000 -1.0224000000000000e+00 -1.0224000000000000e+00 0 5 0.800000 -9.7184000000000004e-01 -9.7184000000000015e-01 1.1e-16 6 0.800000 -5.3254400000000002e-01 -5.3254400000000035e-01 3.3e-16 7 0.800000 1.1976960000000000e-01 1.1976959999999959e-01 4.2e-16 8 0.800000 7.2417536000000005e-01 7.2417535999999971e-01 3.3e-16 9 0.800000 1.0389109759999999e+00 1.0389109759999999e+00 0 10 0.800000 9.3808220160000000e-01 9.3808220160000022e-01 -2.2e-16 11 0.800000 4.6202054656000002e-01 4.6202054656000047e-01 -4.4e-16 12 0.800000 -1.9884932710400000e-01 -1.9884932710399938e-01 -6.1e-16 v_polynomial_zeros_test(): v_polynomial_zeros() computes the zeros of V(n,x); N X V(n,x) 1 0.5000 2.22045e-16 1 -0.3090 -3.33067e-16 2 0.8090 2.22045e-16 1 -0.6235 4.44089e-16 2 0.2225 -2.22045e-16 3 0.9010 1.11022e-16 1 -0.7660 -3.10862e-15 2 -0.1736 3.33067e-16 3 0.5000 -6.66134e-16 4 0.9397 7.77156e-16 1 -0.8413 3.55271e-15 2 -0.4154 -1.11022e-15 3 0.1423 -1.66533e-16 4 0.6549 -2.22045e-16 5 0.9595 -4.44089e-16 v_quadrature_rule_test(): v_quadrature_rule() computes the quadrature rule associated with V(n,x); X W 1: -0.913545 0.036214 2: -0.669131 0.138594 3: -0.309017 0.289438 4: 0.104528 0.462664 5: 0.5 0.628319 6: 0.809017 0.757759 7: 0.978148 0.828605 Use the quadrature rule to estimate: Q = Integral ( -1 <= X <= +1 ) X^E * sqrt ( 1 + x ) / sqrt ( 1-x ) dx E Q_Estimate Q_Exact 0 3.14159 3.14159 1 1.5708 1.5708 2 1.5708 1.5708 3 1.1781 1.1781 4 1.1781 1.1781 5 0.981748 0.981748 6 0.981748 0.981748 7 0.859029 0.859029 8 0.859029 0.859029 9 0.773126 0.773126 10 0.773126 0.773126 11 0.708699 0.708699 12 0.708699 0.708699 13 0.658078 0.658078 vv_product_integral_test(): vv_product_integral() computes the product integral of a pair of Chebyshev V polynomials V(i,x) and V(j,x). A(I,J) = integral ( -1 <=x <= +1 ) V(i,x) V(j,x) sqrt ( 1 + x ) / sqrt ( 1 - x ) dx 0 if i is not equal to j; pi if i = j V(i,x)*V(j,x) integral matrix: Col: 1 2 3 4 5 Row 1 : 3.14159 0 0 0 0 2 : 0 3.14159 0 0 0 3 : 0 0 3.14159 0 0 4 : 0 0 0 3.14159 0 5 : 0 0 0 0 3.14159 w_mass_matrix_test(): w_mass_matrix() computes the mass matrix for the Chebyshev polynomials W(i,x). A(I,J) = integral ( -1 <=x <= +1 ) W(i,x) W(j,x) sqrt(1-x)/sqrt(1+x) dx 0 if i is not equal to j; pi if i = j. W mass matrix: Col: 1 2 3 4 Row 1 : 3.14159 7.77156e-16 -5.55112e-16 -2.22045e-16 2 : 7.77156e-16 1.5708 1.11022e-16 3.33067e-16 3 :-5.55112e-16 3.33067e-16 1.5708 6.10623e-16 4 :-2.22045e-16 3.33067e-16 6.38378e-16 1.5708 w_moment_test(): w_moment() returns the value of integral ( -1 <=x <= +1 ) x^e * sqrt ( 1 - x ) / sqrt ( 1 + x ) dx E Integral 0 3.14159 1 -1.5708 2 1.5708 3 -1.1781 4 1.1781 5 -0.981748 6 0.981748 7 -0.859029 8 0.859029 9 -0.773126 10 0.773126 w_polynomial_test(): w_polynomial() evaluates the Chebyshev polynomial W(n,x). Tabulated Computed N X W(n,x) W(n,x) Error 0 0.8 1 1 0 1 0.8 2.6 2.6 0 2 0.8 3.16 3.16 0 3 0.8 2.456 2.456000000000001 -8.9e-16 4 0.8 0.7696 0.7696000000000014 -1.4e-15 5 0.8 -1.22464 -1.224639999999999 -1.3e-15 6 0.8 -2.729024 -2.729023999999999 -8.9e-16 7 0.8 -3.1417984 -3.1417984 4.4e-16 8 0.8 -2.29785344 -2.297853440000002 1.8e-15 9 0.8 -0.534767104 -0.5347671040000024 2.3e-15 10 0.8 1.4422260736 1.442226073599998 2.2e-15 11 0.8 2.84232882176 2.842328821759999 8.9e-16 12 0.8 3.105500041216 3.105500041216001 -4.4e-16 w_polynomial_ab_test(): w_polynomial_ab() evaluates Chebyshev polynomials WAB(n,x) shifted from [-1,+1] to the domain [A,B]. Here, we will use the new domain [0,1] and the desired maximum polynomial degree will be N = 5. Tables of T values: Col: 1 2 3 4 5 Row 1 : 1 -1 1 -1 1 2 : 1 -0.6 -0.04 0.664 -1.0224 3 : 1 -0.2 -0.76 1.112 -0.5744 4 : 1 0.2 -1.16 0.728 0.5776 5 : 1 0.6 -1.24 -0.104 1.2816 6 : 1 1 -1 -1 1 7 : 1 1.4 -0.44 -1.576 -0.1904 8 : 1 1.8 0.44 -1.448 -1.5984 9 : 1 2.2 1.64 -0.232 -1.9184 10 : 1 2.6 3.16 2.456 0.7696 11 : 1 3 5 7 9 Col: 6 Row 1 : -1 2 : 0.97184 3 : -0.42272 4 : -1.19008 5 : -0.40864 6 : 1 7 : 1.49984 8 : 0.16928 9 : -2.07008 10 : -1.22464 11 : 11 w_polynomial_ab_value_test(): w_polynomial_ab_value() evaluates the shifted Chebyshev polynomial wab(n,x). Here, we will use the new domain [0,1]. Tabulated Computed N X01 W01(n,x) W01(n,x) Error -1 0.850000 0.0000000000000000e+00 0.0000000000000000e+00 0 0 0.850000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.850000 2.3999999999999999e+00 2.3999999999999999e+00 0 2 0.850000 2.3599999999999999e+00 2.3599999999999999e+00 0 3 0.850000 9.0400000000000003e-01 9.0399999999999991e-01 1.1e-16 4 0.850000 -1.0944000000000000e+00 -1.0944000000000000e+00 0 5 0.850000 -2.4361600000000001e+00 -2.4361600000000001e+00 0 6 0.850000 -2.3162240000000001e+00 -2.3162240000000001e+00 0 7 0.850000 -8.0655359999999998e-01 -8.0655359999999998e-01 0 8 0.850000 1.1870489600000000e+00 1.1870489600000003e+00 -2.2e-16 9 0.850000 2.4684221439999998e+00 2.4684221440000003e+00 -4.4e-16 10 0.850000 2.2687420415999999e+00 2.2687420415999999e+00 0 11 0.850000 7.0781671424000003e-01 7.0781671423999937e-01 6.7e-16 12 0.850000 -1.2777986416639999e+00 -1.2777986416640008e+00 8.9e-16 7 0.000000 -1.0000000000000000e+00 -1.0000000000000000e+00 0 7 0.100000 -1.1976960000000000e-01 -1.1976959999999959e-01 -4.2e-16 7 0.200000 -8.7527679999999997e-01 -8.7527679999999985e-01 -1.1e-16 7 0.300000 8.9050879999999999e-01 8.9050879999999988e-01 1.1e-16 7 0.400000 8.5589760000000004e-01 8.5589759999999959e-01 4.4e-16 7 0.500000 -1.0000000000000000e+00 -1.0000000000000000e+00 0 7 0.600000 -1.1837055999999999e+00 -1.1837056000000004e+00 4.4e-16 7 0.700000 1.2177792000000001e+00 1.2177791999999990e+00 1.1e-15 7 0.800000 1.3912447999999999e+00 1.3912447999999986e+00 1.3e-15 7 0.900000 -3.1417983999999999e+00 -3.1417984000000003e+00 4.4e-16 7 1.000000 1.5000000000000000e+01 1.5000000000000000e+01 0 w_polynomial_coefficients_test(): w_polynomial_coefficients() determines the Chebyshev polynomial coefficients. +1.000000 +2.000000 * x +1.000000 +4.000000 * x^2 +2.000000 * x -1.000000 +8.000000 * x^3 +4.000000 * x^2 -4.000000 * x -1.000000 +16.000000 * x^4 +8.000000 * x^3 -12.000000 * x^2 -4.000000 * x +1.000000 +32.000000 * x^5 +16.000000 * x^4 -32.000000 * x^3 -12.000000 * x^2 +6.000000 * x +1.000000 w_polynomial_value_test(): w_polynomial_value() evaluates the Chebyshev polynomial W(n,x). Tabulated Computed N X W(n,x) W(n,x) Error 0 0.800000 1.0000000000000000e+00 1.0000000000000000e+00 0 1 0.800000 2.6000000000000001e+00 2.6000000000000001e+00 0 2 0.800000 3.1600000000000001e+00 3.1600000000000001e+00 0 3 0.800000 2.4560000000000000e+00 2.4560000000000008e+00 -8.9e-16 4 0.800000 7.6959999999999995e-01 7.6960000000000139e-01 -1.4e-15 5 0.800000 -1.2246400000000000e+00 -1.2246399999999986e+00 -1.3e-15 6 0.800000 -2.7290239999999999e+00 -2.7290239999999990e+00 -8.9e-16 7 0.800000 -3.1417983999999999e+00 -3.1417984000000003e+00 4.4e-16 8 0.800000 -2.2978534399999999e+00 -2.2978534400000017e+00 1.8e-15 9 0.800000 -5.3476710400000005e-01 -5.3476710400000238e-01 2.3e-15 10 0.800000 1.4422260736000001e+00 1.4422260735999979e+00 2.2e-15 11 0.800000 2.8423288217599998e+00 2.8423288217599989e+00 8.9e-16 12 0.800000 3.1055000412160001e+00 3.1055000412160005e+00 -4.4e-16 w_polynomial_zeros_test(): w_polynomial_zeros() computes the zeros of W(n,x); N X W(n,x) 1 -0.5000 4.44089e-16 1 -0.8090 -3.33067e-16 2 0.3090 2.22045e-16 1 -0.9010 8.88178e-16 2 -0.2225 -3.33067e-16 3 0.6235 4.44089e-16 1 -0.9397 -6.66134e-16 2 -0.5000 1.33227e-15 3 0.1736 -5.55112e-16 4 0.7660 -8.88178e-16 1 -0.9595 4.44089e-16 2 -0.6549 -6.66134e-16 3 -0.1423 1.05471e-15 4 0.4154 0 5 0.8413 3.10862e-15 w_quadrature_rule_test(): w_quadrature_rule() computes the quadrature rule associated with W(n,x); X W 1: -0.978148 0.828605 2: -0.809017 0.757759 3: -0.5 0.628319 4: -0.104528 0.462664 5: 0.309017 0.289438 6: 0.669131 0.138594 7: 0.913545 0.036214 Use the quadrature rule to estimate: Q = Integral ( -1 <= X <= +1 ) X^E * sqrt(1-x)/sqrt(1+x) dx E Q_Estimate Q_Exact 0 3.14159 3.14159 1 -1.5708 -1.5708 2 1.5708 1.5708 3 -1.1781 -1.1781 4 1.1781 1.1781 5 -0.981748 -0.981748 6 0.981748 0.981748 7 -0.859029 -0.859029 8 0.859029 0.859029 9 -0.773126 -0.773126 10 0.773126 0.773126 11 -0.708699 -0.708699 12 0.708699 0.708699 13 -0.658078 -0.658078 ww_product_integral_test(): ww_product_integral() computes the product integral of a pair of Chebyshev W polynomials W(i,x) and W(j,x). A(I,J) = integral ( -1 <=x <= +1 ) W(i,x) W(j,x) sqrt ( 1 - x ) / sqrt ( 1 + x ) dx 0 if i is not equal to j; pi if i = j W(i,x)*W(j,x) integral matrix: Col: 1 2 3 4 5 Row 1 : 3.14159 0 0 0 0 2 : 0 3.14159 0 0 0 3 : 0 0 3.14159 0 0 4 : 0 0 0 3.14159 0 5 : 0 0 0 0 3.14159 chebyshev_polynomial_test(): Normal end of execution. 13-May-2025 11:37:32