28 February 2022 03:04:48 PM LEGENDRE_POLYNOMIAL_TEST: C version. Test the LEGENDRE_POLYNOMIAL library. P_EXPONENTIAL_PRODUCT_TEST P_EXPONENTIAL_PRODUCT_TEST computes a Legendre exponential product table. Tij = integral ( -1.0 <= X <= +1.0 ) exp(B*X) P(I,X) P(J,X) dx where P(I,X) = Legendre polynomial of degree I. Maximum degree P = 5 Exponential argument coefficient B = 0n Exponential product table: Col: 0 1 2 3 4 Row 0: 2.000000 0.000000 0.000000 0.000000 -0.000000 1: 0.000000 0.666667 0.000000 -0.000000 -0.000000 2: 0.000000 0.000000 0.400000 -0.000000 -0.000000 3: 0.000000 -0.000000 -0.000000 0.285714 -0.000000 4: -0.000000 -0.000000 -0.000000 -0.000000 0.222222 5: -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 Col: 5 Row 0: -0.000000 1: -0.000000 2: -0.000000 3: -0.000000 4: -0.000000 5: 0.181818 P_EXPONENTIAL_PRODUCT_TEST P_EXPONENTIAL_PRODUCT_TEST computes a Legendre exponential product table. Tij = integral ( -1.0 <= X <= +1.0 ) exp(B*X) P(I,X) P(J,X) dx where P(I,X) = Legendre polynomial of degree I. Maximum degree P = 5 Exponential argument coefficient B = 1n Exponential product table: Col: 0 1 2 3 4 Row 0: 2.350402 0.735759 0.143126 0.020130 0.002214 1: 0.735759 0.878885 0.306382 0.062605 0.009058 2: 0.143126 0.306382 0.512112 0.194658 0.041475 3: 0.020130 0.062605 0.194658 0.363558 0.143849 4: 0.002214 0.009058 0.041475 0.143849 0.282170 5: 0.000200 0.001015 0.006152 0.031381 0.114325 Col: 5 Row 0: 0.000200 1: 0.001015 2: 0.006152 3: 0.031381 4: 0.114325 5: 0.230635 P_INTEGRAL_TEST: P_INTEGRAL returns the integral of P(n,x) over [-1,+1]. N Integral 0 2 1 0 2 0.666667 3 0 4 0.4 5 0 6 0.285714 7 0 8 0.222222 9 0 10 0.181818 P_POLYNOMIAL_COEFFICIENTS_TEST P_POLYNOMIAL_COEFFICIENTS: coefficients of Legendre polynomial P(n,x). P(0,x) = 1 P(1,x) = 1 * x P(2,x) = 1.5 * x^2 -0.5 P(3,x) = 2.5 * x^3 -1.5 * x P(4,x) = 4.375 * x^4 -3.75 * x^2 0.375 P(5,x) = 7.875 * x^5 -8.75 * x^3 1.875 * x P(6,x) = 14.4375 * x^6 -19.6875 * x^4 6.5625 * x^2 -0.3125 P(7,x) = 26.8125 * x^7 -43.3125 * x^5 19.6875 * x^3 -2.1875 * x P(8,x) = 50.2734 * x^8 -93.8438 * x^6 54.1406 * x^4 -9.84375 * x^2 0.273438 P(9,x) = 94.9609 * x^9 -201.094 * x^7 140.766 * x^5 -36.0938 * x^3 2.46094 * x P(10,x) = 180.426 * x^10 -427.324 * x^8 351.914 * x^6 -117.305 * x^4 13.5352 * x^2 -0.246094 P_POLYNOMIAL_PRIME: P_POLYNOMIAL_PRIME evaluates the derivative of the Legendre polynomial P(n,x). Computed N X P'(N,X) 0 -1 0 1 -1 1 2 -1 -3 3 -1 6 4 -1 -10 5 -1 15 0 -0.8 0 1 -0.8 1 2 -0.8 -2.4 3 -0.8 3.300000000000001 4 -0.8 -2.960000000000001 5 -0.8 1.203000000000002 0 -0.6 0 1 -0.6 1 2 -0.6 -1.8 3 -0.6 1.199999999999999 4 -0.6 0.7200000000000008 5 -0.6 -2.472 0 -0.4 0 1 -0.4 1 2 -0.4 -1.2 3 -0.4 -0.2999999999999998 4 -0.4 1.88 5 -0.4 -1.317 0 -0.2 0 1 -0.2 1 2 -0.2 -0.6000000000000001 3 -0.2 -1.2 4 -0.2 1.36 5 -0.2 0.8879999999999999 0 0 0 1 0 1 2 0 0 3 0 -1.5 4 0 -0 5 0 1.875 0 0.2 0 1 0.2 1 2 0.2 0.6000000000000001 3 0.2 -1.2 4 0.2 -1.36 5 0.2 0.8879999999999999 0 0.4 0 1 0.4 1 2 0.4 1.2 3 0.4 -0.2999999999999998 4 0.4 -1.88 5 0.4 -1.317 0 0.6 0 1 0.6 1 2 0.6 1.8 3 0.6 1.199999999999999 4 0.6 -0.7200000000000008 5 0.6 -2.472 0 0.8 0 1 0.8 1 2 0.8 2.4 3 0.8 3.300000000000001 4 0.8 2.960000000000001 5 0.8 1.203000000000002 0 1 0 1 1 1 2 1 3 3 1 6 4 1 10 5 1 15 P_POLYNOMIAL_PRIME2_TEST: P_POLYNOMIAL_PRIME2 evaluates the second derivative of the Legendre polynomial P(n,x). Computed N X P"(N,X) 0 -1 0 1 -1 0 2 -1 3 3 -1 -15 4 -1 45 5 -1 -105 0 -0.8 0 1 -0.8 0 2 -0.8 3 3 -0.8 -12 4 -0.8 26.1 5 -0.8 -38.64000000000001 0 -0.6 0 1 -0.6 0 2 -0.6 3 3 -0.6 -8.999999999999998 4 -0.6 11.4 5 -0.6 -2.519999999999995 0 -0.4 0 1 -0.4 0 2 -0.4 3 3 -0.4 -6.000000000000001 4 -0.4 0.9000000000000012 5 -0.4 10.92 0 -0.2 0 1 -0.2 0 2 -0.2 3 3 -0.2 -3 4 -0.2 -5.399999999999999 5 -0.2 9.239999999999998 0 0 0 1 0 0 2 0 3 3 0 0 4 0 -7.5 5 0 -0 0 0.2 0 1 0.2 0 2 0.2 3 3 0.2 3 4 0.2 -5.399999999999999 5 0.2 -9.239999999999998 0 0.4 0 1 0.4 0 2 0.4 3 3 0.4 6.000000000000001 4 0.4 0.9000000000000012 5 0.4 -10.92 0 0.6 0 1 0.6 0 2 0.6 3 3 0.6 8.999999999999998 4 0.6 11.4 5 0.6 2.519999999999995 0 0.8 0 1 0.8 0 2 0.8 3 3 0.8 12 4 0.8 26.1 5 0.8 38.64000000000001 0 1 0 1 1 0 2 1 3 3 1 15 4 1 45 5 1 105 P_POLYNOMIAL_VALUE_TEST: P_POLYNOMIAL_VALUE evaluates the Legendre polynomial P(n,x). Tabulated Computed N X P(N,X) P(N,X) Error 0 0.25 1 1 0.000000e+00 1 0.25 0.25 0.25 0.000000e+00 2 0.25 -0.40625 -0.40625 0.000000e+00 3 0.25 -0.3359375 -0.3359375 0.000000e+00 4 0.25 0.15771484375 0.15771484375 0.000000e+00 5 0.25 0.3397216796875 0.3397216796875 0.000000e+00 6 0.25 0.0242767333984375 0.0242767333984375 0.000000e+00 7 0.25 -0.2799186706542969 -0.2799186706542969 0.000000e+00 8 0.25 -0.1524540185928345 -0.1524540185928345 -2.775558e-17 9 0.25 0.1768244206905365 0.1768244206905365 0.000000e+00 10 0.25 0.2212002165615559 0.2212002165615559 2.775558e-17 3 0 0 -0 0.000000e+00 3 0.1 -0.1475 -0.1475 0.000000e+00 3 0.2 -0.28 -0.28 0.000000e+00 3 0.3 -0.3825 -0.3825 0.000000e+00 3 0.4 -0.44 -0.4399999999999999 -5.551115e-17 3 0.5 -0.4375 -0.4375 0.000000e+00 3 0.6 -0.36 -0.36 5.551115e-17 3 0.7 -0.1925 -0.1925000000000001 1.110223e-16 3 0.8 0.08 0.08000000000000022 -2.220446e-16 3 0.9 0.4725 0.4725000000000001 -1.110223e-16 3 1 1 1 0.000000e+00 P_POLYNOMIAL_ZEROS_TEST: P_POLYNOMIAL_ZEROS computes the zeros of P(n,x) Check by calling P_POLYNOMIAL_VALUE there. Computed zeros for P(1,z): 0: 0.000000 Evaluate P(1,z): 0: 0.000000 Computed zeros for P(2,z): 0: -0.577350 1: 0.577350 Evaluate P(2,z): 0: -0.000000 1: -0.000000 Computed zeros for P(3,z): 0: -0.774597 1: 0.000000 2: 0.774597 Evaluate P(3,z): 0: 0.000000 1: -0.000000 2: -0.000000 Computed zeros for P(4,z): 0: -0.861136 1: -0.339981 2: 0.339981 3: 0.861136 Evaluate P(4,z): 0: 0.000000 1: 0.000000 2: 0.000000 3: -0.000000 Computed zeros for P(5,z): 0: -0.906180 1: -0.538469 2: -0.000000 3: 0.538469 4: 0.906180 Evaluate P(5,z): 0: -0.000000 1: -0.000000 2: -0.000000 3: -0.000000 4: -0.000000 P_POWER_PRODUCT_TEST P_POWER_PRODUCT_TEST computes a Legendre power product table. Tij = integral ( -1.0 <= X <= +1.0 ) X^E P(I,X) P(J,X) dx where P(I,X) = Legendre polynomial of degree I. Maximum degree P = 5 Exponent of X, E = 0 Power product table: Col: 0 1 2 3 4 Row 0: 2.000000 0.000000 0.000000 0.000000 0.000000 1: 0.000000 0.666667 0.000000 0.000000 0.000000 2: 0.000000 0.000000 0.400000 0.000000 0.000000 3: 0.000000 0.000000 0.000000 0.285714 0.000000 4: 0.000000 0.000000 0.000000 0.000000 0.222222 5: 0.000000 0.000000 0.000000 0.000000 0.000000 Col: 5 Row 0: 0.000000 1: 0.000000 2: 0.000000 3: 0.000000 4: 0.000000 5: 0.181818 P_POWER_PRODUCT_TEST P_POWER_PRODUCT_TEST computes a Legendre power product table. Tij = integral ( -1.0 <= X <= +1.0 ) X^E P(I,X) P(J,X) dx where P(I,X) = Legendre polynomial of degree I. Maximum degree P = 5 Exponent of X, E = 1 Power product table: Col: 0 1 2 3 4 Row 0: 0.000000 0.666667 0.000000 -0.000000 -0.000000 1: 0.666667 0.000000 0.266667 -0.000000 -0.000000 2: 0.000000 0.266667 0.000000 0.171429 -0.000000 3: -0.000000 -0.000000 0.171429 -0.000000 0.126984 4: -0.000000 -0.000000 -0.000000 0.126984 -0.000000 5: -0.000000 -0.000000 -0.000000 -0.000000 0.101010 Col: 5 Row 0: -0.000000 1: -0.000000 2: -0.000000 3: -0.000000 4: 0.101010 5: 0.000000 P_QUADRATURE_RULE_TEST: P_QUADRATURE_RULE computes the quadrature rule associated with P(n,x) X W 0: -0.949108 0.129485 1: -0.741531 0.279705 2: -0.405845 0.381830 3: 0.000000 0.417959 4: 0.405845 0.381830 5: 0.741531 0.279705 6: 0.949108 0.129485 Use the quadrature rule to estimate: Q = Integral ( -1 <= X <= +1.0 ) X^E dx E Q_Estimate Q_Exact 0 2 2 1 9.15934e-16 0 2 0.666667 0.666667 3 4.30211e-16 0 4 0.4 0.4 5 2.08167e-16 0 6 0.285714 0.285714 7 9.71445e-17 0 8 0.222222 0.222222 9 0 0 10 0.181818 0.181818 11 -2.77556e-17 0 12 0.153846 0.153846 13 -8.32667e-17 0 PM_POLYNOMIAL_VALUE_TEST: PM_POLYNOMIAL_VALUE evaluates the Legendre polynomial Pm(n,m,x). Tabulated Computed N M X Pm(N,M,X) Pm(N,M,X) Error 1 0 0 0 0 0.000000e+00 2 0 0 -0.5 -0.5 0.000000e+00 3 0 0 0 -0 0.000000e+00 4 0 0 0.375 0.375 0.000000e+00 5 0 0 0 0 0.000000e+00 1 1 0.5 -0.8660254037844386 -0.8660254037844386 0.000000e+00 2 1 0.5 -1.299038105676658 -1.299038105676658 0.000000e+00 3 1 0.5 -0.3247595264191645 -0.3247595264191645 0.000000e+00 4 1 0.5 1.353164693413185 1.353164693413185 -4.440892e-16 3 0 0.2 -0.28 -0.28 0.000000e+00 3 1 0.2 1.175755076535925 1.175755076535925 -4.440892e-16 3 2 0.2 2.88 2.88 0.000000e+00 3 3 0.2 -14.10906091843111 -14.1090609184311 -7.105427e-15 4 2 0.25 -3.955078125 -3.955078125 4.440892e-16 5 2 0.25 -9.99755859375 -9.997558593750002 1.776357e-15 6 3 0.25 82.65311444100485 82.65311444100486 -1.421085e-14 7 3 0.25 20.24442836815152 20.24442836815153 -1.065814e-14 8 4 0.25 -423.7997531890869 -423.7997531890869 -5.684342e-14 9 4 0.25 1638.320624828339 1638.320624828339 0.000000e+00 10 5 0.25 -20256.87389227225 -20256.87389227226 3.637979e-12 PMN_POLYNOMIAL_VALUE_TEST: PMN_POLYNOMIAL_VALUE evaluates the Legendre polynomial Pmn(n,m,x). Tabulated Computed N M X Pmn(N,M,X) Pmn(N,M,X) Error 0 0 0.5 0.7071067811865475 0.7071067811865476 -1.110223e-16 1 0 0.5 0.6123724356957945 0.6123724356957945 0.000000e+00 1 1 0.5 -0.75 -0.7499999999999999 -1.110223e-16 2 0 0.5 -0.1976423537605237 -0.1976423537605237 2.775558e-17 2 1 0.5 -0.8385254915624211 -0.8385254915624212 1.110223e-16 2 2 0.5 0.7261843774138907 0.7261843774138906 1.110223e-16 3 0 0.5 -0.8184875533567997 -0.8184875533567997 0.000000e+00 3 1 0.5 -0.1753901900050285 -0.1753901900050285 2.775558e-17 3 2 0.5 0.9606516343087123 0.9606516343087123 0.000000e+00 3 3 0.5 -0.6792832849776299 -0.67928328497763 1.110223e-16 4 0 0.5 -0.6131941618102092 -0.6131941618102091 -1.110223e-16 4 1 0.5 0.6418623720763665 0.6418623720763665 0.000000e+00 4 2 0.5 0.4716705890038619 0.4716705890038619 0.000000e+00 4 3 0.5 -1.018924927466445 -1.018924927466445 0.000000e+00 4 4 0.5 0.6239615396237876 0.6239615396237875 1.110223e-16 5 0 0.5 0.2107022704608181 0.2107022704608181 -2.775558e-17 5 1 0.5 0.8256314721961969 0.8256314721961968 1.110223e-16 5 2 0.5 -0.3982651281554632 -0.3982651281554632 -5.551115e-17 5 3 0.5 -0.7040399320721435 -0.7040399320721434 -1.110223e-16 5 4 0.5 1.034723155272289 1.034723155272289 4.440892e-16 5 5 0.5 -0.566741212915553 -0.566741212915553 0.000000e+00 PMNS_POLYNOMIAL_VALUE_TEST: PMNS_POLYNOMIAL_VALUE evaluates the Legendre polynomial Pmns(n,m,x). Tabulated Computed N M X Pmns(N,M,X) Pmns(N,M,X) Error 0 0 0.5 0.2820947917738781 0.2820947917738781 -5.551115e-17 1 0 0.5 0.24430125595146 0.24430125595146 2.775558e-17 1 1 0.5 -0.2992067103010745 -0.2992067103010745 0.000000e+00 2 0 0.5 -0.07884789131313 -0.07884789131313001 1.387779e-17 2 1 0.5 -0.3345232717786446 -0.3345232717786445 -5.551115e-17 2 2 0.5 0.2897056515173922 0.2897056515173921 5.551115e-17 3 0 0.5 -0.326529291016351 -0.326529291016351 0.000000e+00 3 1 0.5 -0.06997056236064664 -0.06997056236064664 0.000000e+00 3 2 0.5 0.3832445536624809 0.3832445536624809 -5.551115e-17 3 3 0.5 -0.2709948227475519 -0.2709948227475519 5.551115e-17 4 0 0.5 -0.24462907724141 -0.24462907724141 -2.775558e-17 4 1 0.5 0.2560660384200185 0.2560660384200185 0.000000e+00 4 2 0.5 0.1881693403754876 0.1881693403754876 2.775558e-17 4 3 0.5 -0.4064922341213279 -0.406492234121328 5.551115e-17 4 4 0.5 0.2489246395003027 0.2489246395003027 -5.551115e-17 5 0 0.5 0.0840580442633982 0.08405804426339822 -1.387779e-17 5 1 0.5 0.3293793022891428 0.3293793022891428 0.000000e+00 5 2 0.5 -0.1588847984307093 -0.1588847984307093 2.775558e-17 5 3 0.5 -0.2808712959945307 -0.2808712959945307 0.000000e+00 5 4 0.5 0.4127948151484925 0.4127948151484925 0.000000e+00 5 5 0.5 -0.2260970318780046 -0.2260970318780046 2.775558e-17 PN_PAIR_PRODUCT_TEST PN_PAIR_PRODUCT_TEST computes a pair product table for Pn(n,x). Tij = integral ( -1.0 <= X <= +1.0 ) Pn(I,X) Pn(J,X) dx where Pn(I,X) = normalized Legendre polynomial of degree I. Maximum degree P = 5 Pair product table: Col: 0 1 2 3 4 Row 0: 1.000000 0.000000 0.000000 0.000000 0.000000 1: 0.000000 1.000000 0.000000 0.000000 0.000000 2: 0.000000 0.000000 1.000000 0.000000 0.000000 3: 0.000000 0.000000 0.000000 1.000000 0.000000 4: 0.000000 0.000000 0.000000 0.000000 1.000000 5: 0.000000 0.000000 0.000000 0.000000 0.000000 Col: 5 Row 0: 0.000000 1: 0.000000 2: 0.000000 3: 0.000000 4: 0.000000 5: 1.000000 PN_POLYNOMIAL_COEFFICIENTS_TEST PN_POLYNOMIAL_COEFFICIENTS: coefficients of normalized Legendre polynomial Pn(n,x). P(0,x) = 0.707107 P(1,x) = 1.22474 * x P(2,x) = 2.37171 * x^2 -0.790569 P(3,x) = 4.67707 * x^3 -2.80624 * x P(4,x) = 9.28078 * x^4 -7.95495 * x^2 0.795495 P(5,x) = 18.4685 * x^5 -20.5206 * x^3 4.39726 * x P(6,x) = 36.8085 * x^6 -50.1935 * x^4 16.7312 * x^2 -0.796722 P(7,x) = 73.4291 * x^7 -118.616 * x^5 53.9164 * x^3 -5.99072 * x P(8,x) = 146.571 * x^8 -273.599 * x^6 157.846 * x^4 -28.6992 * x^2 0.7972 P(9,x) = 292.689 * x^9 -619.813 * x^7 433.869 * x^5 -111.248 * x^3 7.58512 * x P(10,x) = 584.646 * x^10 -1384.69 * x^8 1140.33 * x^6 -380.111 * x^4 43.8589 * x^2 -0.797435 PN_POLYNOMIAL_VALUE_TEST: PN_POLYNOMIAL_VALUE evaluates the normalized Legendre polynomial Pn(n,x). Tabulated Computed N X Pn(N,X) Pn(N,X) Error 0 0.25 0.7071067811865475 0.7071067811865475 0.000000e+00 1 0.25 0.3061862178478972 0.3061862178478972 -5.551115e-17 2 0.25 -0.642337649721702 -0.642337649721702 0.000000e+00 3 0.25 -0.6284815141846855 -0.6284815141846855 0.000000e+00 4 0.25 0.3345637065282053 0.3345637065282053 -5.551115e-17 5 0.25 0.7967179601799685 0.7967179601799685 0.000000e+00 6 0.25 0.06189376866246124 0.06189376866246124 0.000000e+00 7 0.25 -0.766588850921089 -0.766588850921089 0.000000e+00 8 0.25 -0.4444760242953344 -0.4444760242953344 0.000000e+00 9 0.25 0.5450094674858101 0.5450094674858101 0.000000e+00 10 0.25 0.7167706229835538 0.7167706229835538 0.000000e+00 3 0 0 -0 0.000000e+00 3 0.1 -0.2759472322745781 -0.2759472322745781 0.000000e+00 3 0.2 -0.5238320341483518 -0.5238320341483518 0.000000e+00 3 0.3 -0.7155919752205163 -0.7155919752205163 0.000000e+00 3 0.4 -0.823164625090267 -0.823164625090267 0.000000e+00 3 0.5 -0.8184875533567997 -0.8184875533567997 0.000000e+00 3 0.6 -0.6734983296193094 -0.6734983296193094 0.000000e+00 3 0.7 -0.360134523476992 -0.360134523476992 5.551115e-17 3 0.8 0.1496662954709581 0.1496662954709581 5.551115e-17 3 0.9 0.8839665576253438 0.8839665576253438 0.000000e+00 3 1 1.870828693386971 1.870828693386971 4.440892e-16 LEGENDRE_POLYNOMIAL_TEST: Normal end of execution. 28 February 2022 03:04:48 PM