05 March 2008 08:38:15 AM POLPAK_PRB C++ version Test the routines in the POLPAK library. TEST001 AGM computes the arithmetic geometric mean. A B AGM AGM Diff (Tabulated) AGM(A,B) 22 96 52.27464119870424 52.27464119870424 7.10543e-15 83 56 68.83653005985852 68.83653005985852 0 42 7 20.65930119673401 20.65930119673401 3.55271e-15 26 11 17.69685487374365 17.69685487374367 1.77636e-14 4 63 23.8670497217533 23.8670497217533 3.55271e-15 6 45 20.71701598280599 20.71701598280599 3.55271e-15 40 75 56.12784225561668 56.12784225561668 0 80 0 0 0 0 90 35 59.26956508122964 59.26956508122989 2.4869e-13 9 1 3.936235503649555 3.936235503649556 4.44089e-16 53 53 53 53 0 1 2 1.456791031046907 1.456791031046907 0 1 4 2.243028580287603 2.243028580287603 0 1 8 3.615756177597363 3.615756177597363 0 1.5 8 4.081692408022163 4.081692408022163 0 TEST002 AGUD computes the inverse Gudermannian; GUD computes the Gudermannian. X GUD(X) AGUD(GUD(X)) 1 0.865769 1 1.2 0.985692 1.2 1.4 1.08725 1.4 1.6 1.17236 1.6 1.8 1.24316 1.8 2 1.30176 2 2.2 1.35009 2.2 2.4 1.38986 2.4 2.6 1.42252 2.6 2.8 1.44933 2.8 3 1.4713 3 TEST003 ALIGN_ENUM counts the number of possible alignments of two biological sequences. Alignment enumeration table: 0 1 2 3 4 5 0 1 1 1 1 1 1 1 1 3 5 7 9 11 2 1 5 13 25 41 61 3 1 7 25 63 129 231 4 1 9 41 129 321 681 5 1 11 61 231 681 1683 6 1 13 85 377 1289 3653 7 1 15 113 575 2241 7183 8 1 17 145 833 3649 13073 9 1 19 181 1159 5641 22363 10 1 21 221 1561 8361 36365 6 7 8 9 10 0 1 1 1 1 1 1 13 15 17 19 21 2 85 113 145 181 221 3 377 575 833 1159 1561 4 1289 2241 3649 5641 8361 5 3653 7183 13073 22363 36365 6 8989 19825 40081 75517 134245 7 19825 48639 108545 224143 433905 8 40081 108545 265729 598417 1256465 9 75517 224143 598417 1462563 3317445 10 134245 433905 1256465 3317445 8097453 TEST0035 ARC_COSINE computes the inverse cosine, and chops input arguments that are out of bounds. X ARC_COSINE(X) COS(ARC_COSINE(X)) 0 1.5708 6.12323e-17 0.2 1.36944 0.2 0.4 1.15928 0.4 0.6 0.927295 0.6 0.8 0.643501 0.8 1 0 1 1.2 0 1 1.4 0 1 1.6 0 1 1.8 0 1 2 0 1 TEST004 ASINH2 computes the inverse hyperbolic sine of a given value. X ASINH2(X) SINH(ASINH2(X)) 1 0.881374 1 1.2 1.01597 1.2 1.4 1.13798 1.4 1.6 1.24898 1.6 1.8 1.35044 1.8 2 1.44364 2 2.2 1.52966 2.2 2.4 1.60944 2.4 2.6 1.68374 2.6 2.8 1.75323 2.8 3 1.81845 3 TEST005 ATAN4 computes the arc-tangent given Y and X; ATAN2 is the system version of this routine. X Y ATAN2(Y,X) ATAN4(Y,X) 1 0 0 0 1 1 0.785398 0.785398 0 1 1.5708 1.5708 -1 1 2.35619 2.35619 -1 0 3.14159 3.14159 -1 -1 -2.35619 3.92699 0 -1 -1.5708 4.71239 1 -1 -0.785398 5.49779 TEST006 ATANH2 computes the inverse hyperbolic tangent of a given value. X ATANH2(X) TANH(ATANH2(X)) -0.2 -0.202733 -0.2 -0.1 -0.100335 -0.1 0 0 0 0.1 0.100335 0.1 0.2 0.202733 0.2 0.3 0.30952 0.3 0.4 0.423649 0.4 0.5 0.549306 0.5 0.6 0.693147 0.6 0.7 0.867301 0.7 0.8 1.09861 0.8 0.9 1.47222 0.9 TEST007 BELL computes Bell numbers. BELL_VALUES returns some exact values. N exact C(I) computed C(I) 0 1 1 1 1 1 2 2 2 3 5 5 4 15 15 5 52 52 6 203 203 7 877 877 8 4140 4140 9 21147 21147 10 115975 115975 TEST008 BENFORD(I) is the Benford probability of the initial digit sequence I. I, BENFORD(I) 1 0.30103 2 0.176091 3 0.124939 4 0.09691 5 0.0791812 6 0.0669468 7 0.0579919 8 0.0511525 9 0.0457575 TEST010 BERNOULLI_NUMBER computes Bernoulli numbers; BERNOULLI_NUMBER_VALUES returns some exact values. I Exact BERNOULLI_NUMBER 0 1 1 1 -0.5 -0.5 2 0.166667 0.166667 3 0 0 4 -0.0333333 -0.0333333 6 -0.0238095 0.0238095 8 -0.0333333 -0.0333333 10 0.0757576 0.0757576 20 -529.124 -529.124 30 6.01581e+08 6.01581e+08 TEST0102 BERNOULLI_NUMBER2 computes Bernoulli numbers; BERNOULLI_NUMBER_VALUES returns some exact values. I Exact BERNOULLI_NUMBER2 0 1 1 1 -0.5 -0.5 2 0.166667 0.166667 3 0 0 4 -0.0333333 -0.0333333 6 -0.0238095 0.0238095 8 -0.0333333 -0.0333333 10 0.0757576 0.0757576 20 -529.124 -529.124 30 6.01581e+08 6.01581e+08 TEST0104 BERNOULLI_NUMBER3 computes Bernoulli numbers. BERNOULLI_NUMBER_VALUES returns some exact values. I Exact BERNOULLI_NUMBER3 0 1 1 1 -0.5 -0.5 2 0.166667 0.166667 3 0 0 4 -0.0333333 -0.0333331 6 -0.0238095 0.0238095 8 -0.0333333 -0.0333333 10 0.0757576 0.0757576 20 -529.124 -529.124 30 6.01581e+08 6.01581e+08 TEST011 BERNOULLI_POLY evaluates Bernoulli polynomials; X = 0.2 I BX 1 -0.3 2 0.00666667 3 0.048 4 -0.00773333 5 -0.02368 6 0.00691352 7 0.0249088 8 -0.01015 9 -0.0452782 10 0.0233263 11 0.12605 12 -0.0781468 13 -0.497979 14 0.36044 15 2.64878 TEST0115 BERNOULLI_POLY2 evaluates Bernoulli polynomials. X = 0.2 I BX 1 -0.3 2 0.00666667 3 0.048 4 -0.00773314 5 -0.0236798 6 0.00691363 7 0.0249088 8 -0.01015 9 -0.0452782 10 0.0233263 11 0.12605 12 -0.0781468 13 -0.497979 14 0.36044 15 2.64878 TEST012: BETA evaluates the Beta function. BETA_VALUES returns some exact values. X Y Exact F BETA(X,Y) 0.2 1 5 5 0.4 1 2.5 2.5 0.6 1 1.66667 1.66667 0.8 1 1.25 1.25 1 0.2 5 5 1 0.4 2.5 2.5 1 1 1 1 2 2 0.166667 0.166667 3 3 0.0333333 0.0333333 4 4 0.00714286 0.00714286 5 5 0.0015873 0.0015873 6 2 0.0238095 0.0238095 6 3 0.00595238 0.00595238 6 4 0.00198413 0.00198413 6 5 0.000793651 0.000793651 6 6 0.00036075 0.00036075 7 7 8.32501e-05 8.32501e-05 TEST013: BERNSTEIN_POLY evaluates the Bernstein polynomials. BERNSTEIN_POLY_VALUES returns some exact values. N K X Exact B(N,K)(X) 0 0 0.25 1 1 1 0 0.25 0.75 0.75 1 1 0.25 0.25 0.25 2 0 0.25 0.5625 0.5625 2 1 0.25 0.375 0.375 2 2 0.25 0.0625 0.0625 3 0 0.25 0.421875 0.421875 3 1 0.25 0.421875 0.421875 3 2 0.25 0.140625 0.140625 3 3 0.25 0.015625 0.015625 4 0 0.25 0.316406 0.316406 4 1 0.25 0.421875 0.421875 4 2 0.25 0.210938 0.210938 4 3 0.25 0.046875 0.046875 4 4 0.25 0.00390625 0.00390625 TEST014 BPAB evaluates Bernstein polynomials. The Bernstein polynomials of degree 10 based on the interval from 0 to 1 evaluated at X = 0.3 0 0.0282475 1 0.121061 2 0.233474 3 0.266828 4 0.200121 5 0.102919 6 0.0367569 7 0.00900169 8 0.0014467 9 0.000137781 10 5.9049e-06 TEST015 CARDAN_POLY_COEF returns the coefficients of a Cardan polynomial. CARDAN evaluates a Cardan polynomial directly. We use the parameter S = 1 Table of polynomial coefficients: 0 2 1 0 1 2 -2 0 1 3 0 -3 0 1 4 2 0 -4 0 1 5 0 5 0 -5 0 1 6 -2 0 9 0 -6 0 1 7 0 -7 0 14 0 -7 0 1 8 2 0 -16 0 20 0 -8 0 1 9 0 9 0 -30 0 27 0 -9 0 1 10 -2 0 25 0 -50 0 35 0 -10 0 1 Compare CARDAN_POLY_COEF + R8POLY_VAL_HORNER versus CARDAN alone. Evaluate polynomials at X = 0.25 We use the parameter S = 0.5 Order Horner Direct 0 2 2 1 0.25 0.25 2 -0.9375 -0.9375 3 -0.359375 -0.359375 4 0.378906 0.378906 5 0.274414 0.274414 6 -0.12085 -0.12085 7 -0.167419 -0.167419 8 0.0185699 0.0185699 9 0.0883522 0.0883522 10 0.0128031 0.0128031 TEST016 CATALAN computes Catalan numbers. CATALAN_VALUES returns some exact values. N exact C(I) computed C(I) 0 1 1 1 1 1 2 2 2 3 5 5 4 14 14 5 42 42 6 132 132 7 429 429 8 1430 1430 9 4862 4862 10 16796 16796 TEST017 CATALAN_ROW_NEXT computes a row of Catalan''s triangle. First, compute row 7: 7 1 7 27 75 165 297 429 429 Now compute rows consecutively, one at a time: 8 1 1 1 1 2 1 2 2 3 1 3 5 5 4 1 4 9 14 14 5 1 5 14 28 42 42 6 1 6 20 48 90 132 132 7 1 7 27 75 165 297 429 429 8 1 8 35 110 275 572 1001 1430 1430 9 1 9 44 154 429 1001 2002 3432 4862 4862 10 1 10 54 208 637 1638 3640 7072 11934 16796 16796 TEST0175: CHARLIER evaluates a Poisson-Charlier polynomial. N A X P(N,A,X) 0 0.25 0 1 1 0.25 0 -0.5 2 0.25 0 0.176777 3 0.25 0 -0.051031 4 0.25 0 0.0127578 5 0.25 0 -0.00285272 0 0.25 0.5 1 1 0.25 0.5 0.5 2 0.25 0.5 -1.23744 3 0.25 0.5 2.09227 4 0.25 0.5 -4.6821 5 0.25 0.5 13.8328 0 0.25 1 1 1 0.25 1 1.5 2 0.25 1 -1.23744 3 0.25 1 0.561341 4 0.25 1 -0.191366 5 0.25 1 0.0542017 0 0.25 1.5 1 1 0.25 1.5 2.5 2 0.25 1.5 0.176777 3 0.25 1.5 -2.19433 4 0.25 1.5 3.68699 5 0.25 1.5 -7.10613 0 0.25 2 1 1 0.25 2 3.5 2 0.25 2 3.0052 3 0.25 2 -3.72527 4 0.25 2 2.054 5 0.25 2 -0.801615 0 0.25 2.5 1 1 0.25 2.5 4.5 2 0.25 2.5 7.24784 3 0.25 2.5 -1.58196 4 0.25 2.5 -5.09035 5 0.25 2.5 9.3826 0 0.5 0 1 1 0.5 0 -0.707107 2 0.5 0 0.353553 3 0.5 0 -0.144338 4 0.5 0 0.051031 5 0.5 0 -0.0161374 0 0.5 0.5 1 1 0.5 0.5 0 2 0.5 0.5 -0.707107 3 0.5 0.5 1.1547 4 0.5 0.5 -1.83712 5 0.5 0.5 3.61478 0 0.5 1 1 1 0.5 1 0.707107 2 0.5 1 -1.06066 3 0.5 1 0.721688 4 0.5 1 -0.357217 5 0.5 1 0.145237 0 0.5 1.5 1 1 0.5 1.5 1.41421 2 0.5 1.5 -0.707107 3 0.5 1.5 -0.57735 4 0.5 1.5 1.42887 5 0.5 1.5 -2.19469 0 0.5 2 1 1 0.5 2 2.12132 2 0.5 2 0.353553 3 0.5 2 -1.87639 4 0.5 2 1.68402 5 0.5 2 -0.984383 0 0.5 2.5 1 1 0.5 2.5 2.82843 2 0.5 2.5 2.12132 3 0.5 2.5 -2.3094 4 0.5 2.5 -0.204124 5 0.5 2.5 2.32379 0 1 0 1 1 1 0 -1 2 1 0 0.707107 3 1 0 -0.408248 4 1 0 0.204124 5 1 0 -0.0912871 0 1 0.5 1 1 1 0.5 -0.5 2 1 0.5 -0.176777 3 1 0.5 0.663403 4 1 0.5 -1.00786 5 1 0.5 1.43492 0 1 1 1 1 1 1 0 2 1 1 -0.707107 3 1 1 0.816497 4 1 1 -0.612372 5 1 1 0.365148 0 1 1.5 1 1 1 1.5 0.5 2 1 1.5 -0.883883 3 1 1.5 0.357217 4 1 1.5 0.318944 5 1 1.5 -0.818731 0 1 2 1 1 1 2 1 2 1 2 -0.707107 3 1 2 -0.408248 4 1 2 1.02062 5 1 2 -1.00416 0 1 2.5 1 1 1 2.5 1.5 2 1 2.5 -0.176777 3 1 2.5 -1.17371 4 1 2.5 1.03338 5 1 2.5 -0.105551 0 2 0 1 1 2 0 -1.41421 2 2 0 1.41421 3 2 0 -1.1547 4 2 0 0.816497 5 2 0 -0.516398 0 2 0.5 1 1 2 0.5 -1.06066 2 2 0.5 0.618718 3 2 0.5 -0.0180422 4 2 0.5 -0.507121 5 2 0.5 0.898149 0 2 1 1 1 2 1 -0.707107 2 2 1 0 3 2 1 0.57735 4 2 1 -0.816497 5 2 1 0.774597 0 2 1.5 1 1 2 1.5 -0.353553 2 2 1.5 -0.441942 3 2 1.5 0.73973 4 2 1.5 -0.532636 5 2 1.5 0.0963203 0 2 2 1 1 2 2 0 2 2 2 -0.707107 3 2 2 0.57735 4 2 2 0 5 2 2 -0.516398 0 2 2.5 1 1 2 2.5 0.353553 2 2 2.5 -0.795495 3 2 2.5 0.198464 4 2 2.5 0.5135 5 2 2.5 -0.745852 0 10 0 1 1 10 0 -3.16228 2 10 0 7.07107 3 10 0 -12.9099 4 10 0 20.4124 5 10 0 -28.8675 0 10 0.5 1 1 10 0.5 -3.00416 2 10 0.5 6.34628 3 10 0.5 -10.8718 4 10 0.5 15.9912 5 10 0.5 -20.8062 0 10 1 1 1 10 1 -2.84605 2 10 1 5.65685 3 10 1 -9.03696 4 10 1 12.2474 5 10 1 -14.4338 0 10 1.5 1 1 10 1.5 -2.68794 2 10 1.5 5.00278 3 10 1.5 -7.39578 4 10 1.5 9.11529 5 10 1.5 -9.49872 0 10 2 1 1 10 2 -2.52982 2 10 2 4.38406 3 10 2 -5.93857 4 10 2 6.53197 5 10 2 -5.7735 0 10 2.5 1 1 10 2.5 -2.37171 2 10 2.5 3.8007 3 10 2.5 -4.65565 4 10 2.5 4.43779 5 10 2.5 -3.05324 TEST018: CHEBY_T_POLYNOMIAL evaluates the Chebyshev T polynomial. CHEBY_T_POLYNOMIAL_VALUES returns some exact values. N X Exact F T(N)(X) 0 0.8 1 1 1 0.8 0.8 0.8 2 0.8 0.28 0.28 3 0.8 -0.352 -0.352 4 0.8 -0.8432 -0.8432 5 0.8 -0.99712 -0.99712 6 0.8 -0.752192 -0.752192 7 0.8 -0.206387 -0.206387 8 0.8 0.421972 0.421972 9 0.8 0.881543 0.881543 10 0.8 0.988497 0.988497 11 0.8 0.700051 0.700051 12 0.8 0.131586 0.131586 TEST019 CHEBY_T_POLYNOMIAL_COEF determines the Chebyshev T polynomial coefficients. T(0) 1 T(1) 1 * x 0 T(2) 2 * x^2 0 * x -1 T(3) 4 * x^3 0 * x^2 2 * x -0 T(4) 8 * x^4 0 * x^3 0 * x^2 3 * x 1 T(5) 16 * x^5 0 * x^4 -2 * x^3 -2 * x^2 2 * x 0 TEST020: CHEBY_U_POLYNOMIAL evaluates the Chebyshev U polynomial. CHEBY_U_POLYNOMIAL_VALUES returns some exact values. N X Exact F U(N)(X) 0 0.2 1 1 1 0.2 0.4 0.4 2 0.2 -0.84 -0.84 3 0.2 -0.736 -0.736 4 0.2 0.5456 0.5456 5 0.2 0.95424 0.95424 6 0.2 -0.163904 -0.163904 7 0.2 -1.0198 -1.0198 8 0.2 -0.244017 -0.244017 9 0.2 0.922195 0.922195 10 0.2 0.612895 0.612895 11 0.2 -0.677037 -0.677037 12 0.2 -0.883709 -0.883709 TEST021 CHEBY_U_POLYNOMIAL_COEF determines the Chebyshev U polynomial coefficients. U(0) 1 U(1) 2 * x 0 U(2) 4 * x^2 0 * x -1 U(3) 8 * x^3 0 * x^2 -4 * x -0 U(4) 16 * x^4 0 * x^3 -12 * x^2 -0 * x 1 U(5) 32 * x^5 0 * x^4 -32 * x^3 -0 * x^2 6 * x 0 TEST0217: COLLATZ_COUNT(N) counts the length of the Collatz sequence beginning with N. N COUNT(N) COUNT(N) (computed) (table) 1 1 1 2 2 2 3 8 8 4 3 3 5 6 6 6 9 9 7 17 17 8 4 4 9 20 20 10 7 7 27 112 112 50 25 25 100 26 26 200 27 27 300 17 17 400 28 28 500 111 111 600 18 18 700 83 83 800 29 29 TEST022 R8_CHOOSE evaluates C(N,K). N K CNK 0 0 1 1 0 1 1 1 1 2 0 1 2 1 2 2 2 1 3 0 1 3 1 3 3 2 3 3 3 1 4 0 1 4 1 4 4 2 6 4 3 4 4 4 1 TEST023 I4_CHOOSE evaluates C(N,K). N K CNK 0 0 1 1 0 1 1 1 1 2 0 1 2 1 2 2 2 1 3 0 1 3 1 3 3 2 3 3 3 1 4 0 1 4 1 4 4 2 6 4 3 4 4 4 1 TEST024 COMB_ROW computes a row of Pascal's triangle. 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 5 10 10 5 1 6 1 6 15 20 15 6 1 7 1 7 21 35 35 21 7 1 8 1 8 28 56 70 56 28 8 1 9 1 9 36 84 126 126 84 36 9 1 10 1 10 45 120 210 252 210 120 45 10 1 TEST0245: R8_FACTORIAL evaluates the factorial function. R8_FACTORIAL_VALUES returns some exact values. N Exact F R8_FACTORIAL(N) 0 1 1 1 1 1 2 2 2 3 6 6 4 24 24 5 120 120 6 720 720 7 5040 5040 8 40320 40320 9 362880 362880 10 3.6288e+06 3.6288e+06 11 3.99168e+07 3.99168e+07 12 4.79002e+08 4.79002e+08 13 6.22702e+09 6.22702e+09 14 8.71783e+10 8.71783e+10 15 1.30767e+12 1.30767e+12 16 2.09228e+13 2.09228e+13 17 3.55687e+14 3.55687e+14 18 6.40237e+15 6.40237e+15 19 1.21645e+17 1.21645e+17 20 2.4329e+18 2.4329e+18 25 1.55112e+25 1.55112e+25 30 2.65253e+32 2.65253e+32 TEST025: ERROR_F evaluates the error function. ERF_VALUES returns some exact values. X Exact F ERF(X) 0 0 0 0.1 0.112463 0.112463 0.2 0.222703 0.222703 0.3 0.328627 0.328627 0.4 0.428392 0.428392 0.5 0.5205 0.5205 0.6 0.603856 0.603856 0.7 0.677801 0.677801 0.8 0.742101 0.742101 0.9 0.796908 0.796908 1 0.842701 0.842701 1.1 0.880205 0.880205 1.2 0.910314 0.910314 1.3 0.934008 0.934008 1.4 0.952285 0.952285 1.5 0.966105 0.966105 1.6 0.976348 0.976348 1.7 0.98379 0.98379 1.8 0.989091 0.989091 1.9 0.99279 0.99279 2 0.995322 0.995322 TEST026 EULER_NUMBER computes Euler numbers. EULER_NUMBER_VALUES returns some exact values. N exact EULER_NUMBER 0 1 1 1 0 0 2 -1 -1 4 5 5 6 61 -61 8 1385 1385 10 -50521 -50521 12 2702765 2702765 TEST0265 EULER_NUMBER2 computes Euler numbers. EULER_NUMBER_VALUES returns some exact values. N exact EULER_NUMBER2 0 1 1 1 0 0 2 -1 -1 4 5 5 6 61 -61 8 1385 1385 10 -50521 -50521 12 2702765 2.70276e+06 TEST028 EULER_POLY evaluates Euler polynomials. N X F(X) 0 0.5 1 1 0.5 2.77556e-17 2 0.5 -0.25 3 0.5 -1.45953e-06 4 0.5 0.312497 5 0.5 -3.32929e-06 6 0.5 -0.953128 7 0.5 -1.73264e-06 8 0.5 5.41016 9 0.5 -1.02449e-06 10 0.5 -49.3369 11 0.5 6.47439e-07 12 0.5 659.855 13 0.5 5.22754e-06 14 0.5 -12168 15 0.5 0.000218677 TEST027 EULERIAN evaluates Eulerian numbers. 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 4 1 0 0 0 0 1 11 11 1 0 0 0 1 26 66 26 1 0 0 1 57 302 302 57 1 0 1 120 1191 2416 1191 120 1 TEST029 F_HOFSTADTER evaluates Hofstadter's recursive F function. N F(N) 0 0 1 1 2 1 3 2 4 2 5 3 6 3 7 4 8 4 9 5 10 5 11 6 12 6 13 7 14 7 15 8 16 8 17 9 18 9 19 10 20 10 21 11 22 11 23 12 24 12 25 13 26 13 27 14 28 14 29 15 30 15 TEST031 FIBONACCI_DIRECT evalutes a Fibonacci number directly. 1 1 2 1 3 2 4 3 5 5 6 8 7 13 8 21 9 34 10 55 11 89 12 144 13 233 14 377 15 610 16 987 17 1597 18 2584 19 4181 20 6765 TEST032 FIBONACCI_FLOOR computes the largest Fibonacci number less than or equal to a given positive integer. N Fibonacci Index 1 1 2 2 2 3 3 3 4 4 3 4 5 5 5 6 5 5 7 5 5 8 8 6 9 8 6 10 8 6 11 8 6 12 8 6 13 13 7 14 13 7 15 13 7 16 13 7 17 13 7 18 13 7 19 13 7 20 13 7 TEST033 FIBONACCI_RECURSIVE computes the Fibonacci sequence. 1 1 2 1 3 2 4 3 5 5 6 8 7 13 8 21 9 34 10 55 11 89 12 144 13 233 14 377 15 610 16 987 17 1597 18 2584 19 4181 20 6765 TEST034 G_HOFSTADTER evaluates Hofstadter's recursive G function. N G(N) 0 0 1 1 2 1 3 2 4 3 5 3 6 4 7 4 8 5 9 6 10 6 11 7 12 8 13 8 14 9 15 9 16 10 17 11 18 11 19 12 20 12 21 13 22 14 23 14 24 15 25 16 26 16 27 17 28 17 29 18 30 19 TEST036: GAMMA_LOG evaluates the logarithm of the Gamma function. GAMMA_LOG_VALUES returns some exact values. X Exact F GAMMA_LOG(X) 0.2 1.52406 1.52406 0.4 0.796678 0.796678 0.6 0.398234 0.398234 0.8 0.15206 0.15206 1 0 0 1.1 -0.0498725 -0.0498724 1.2 -0.0853741 -0.0853741 1.3 -0.108175 -0.108175 1.4 -0.119613 -0.119613 1.5 -0.120782 -0.120782 1.6 -0.112592 -0.112592 1.7 -0.0958077 -0.0958077 1.8 -0.0710839 -0.0710839 1.9 -0.0389843 -0.0389843 2 0 0 10 12.8018 12.8018 20 39.3399 39.3399 30 71.257 71.257 TEST0365: LGAMMA is a C math library function which evaluates the logarithm of the Gamma function. GAMMA_LOG_VALUES returns some exact values. X Exact F LGAMMA(X) 0.2 1.52406 1.52406 0.4 0.796678 0.796678 0.6 0.398234 0.398234 0.8 0.15206 0.15206 1 0 0 1.1 -0.0498725 -0.0498724 1.2 -0.0853741 -0.0853741 1.3 -0.108175 -0.108175 1.4 -0.119613 -0.119613 1.5 -0.120782 -0.120782 1.6 -0.112592 -0.112592 1.7 -0.0958077 -0.0958077 1.8 -0.0710839 -0.0710839 1.9 -0.0389843 -0.0389843 2 0 0 10 12.8018 12.8018 20 39.3399 39.3399 30 71.257 71.257 TEST037 GEGENBAUER_POLY evaluates the Gegenbauer polynomials. GEGENBAUER_POLY_VALUES returns some exact values of the Gegenbauer polynomials. N A X GPV GEGENBAUER 0 0.5 0.2 1 1 1 0.5 0.2 0.2 0.2 2 0.5 0.2 -0.44 -0.44 3 0.5 0.2 -0.28 -0.28 4 0.5 0.2 0.232 0.232 5 0.5 0.2 0.30752 0.30752 6 0.5 0.2 -0.080576 -0.080576 7 0.5 0.2 -0.293517 -0.293517 8 0.5 0.2 -0.0395648 -0.0395648 9 0.5 0.2 0.245971 0.245957 10 0.5 0.2 0.129072 0.129072 2 0 0.4 0 0 2 1 0.4 -0.36 -0.36 2 2 0.4 -0.08 -0.08 2 3 0.4 0.84 0.84 2 4 0.4 2.4 2.4 2 5 0.4 4.6 4.6 2 6 0.4 7.44 7.44 2 7 0.4 10.92 10.92 2 8 0.4 15.04 15.04 2 9 0.4 19.8 19.8 2 10 0.4 25.2 25.2 5 3 -0.5 -9 9 5 3 -0.4 -0.16128 -0.16128 5 3 -0.3 -6.67296 -6.67296 5 3 -0.2 -8.37504 -8.37504 5 3 -0.1 -5.52672 -5.52672 5 3 0 0 0 5 3 0.1 5.52672 5.52672 5 3 0.2 8.37504 8.37504 5 3 0.3 6.67296 6.67296 5 3 0.4 0.16128 0.16128 5 3 0.5 -9 -9 5 3 0.6 -15.4253 -15.4253 5 3 0.7 -9.69696 -9.69696 5 3 0.8 22.441 22.441 5 3 0.9 100.889 100.889 5 3 1 252 252 TEST038: GUD evaluates the Gudermannian function. GUD_VALUES returns some exact values. X Exact F GUD(X) -2 -1.30176 -1.30176 -1 -0.865769 -0.865769 0 0 0 0.1 0.0998337 0.0998337 0.2 0.19868 0.19868 0.5 0.480381 0.480381 1 0.865769 0.865769 1.5 1.13173 1.13173 2 1.30176 1.30176 2.5 1.40699 1.40699 3 1.4713 1.4713 3.5 1.51042 1.51042 4 1.53417 1.53417 TEST039 HAIL(I) computes the length of the hail sequence for I, also known as the 3*N+1 sequence. I, HAIL(I) 1 0 2 1 3 7 4 2 5 5 6 8 7 16 8 3 9 19 10 6 11 14 12 9 13 9 14 17 15 17 16 4 17 12 18 20 19 20 20 7 TEST040 H_HOFSTADTER evaluates Hofstadter's recursive H function. N H(N) 0 0 1 1 2 1 3 2 4 3 5 4 6 4 7 5 8 5 9 6 10 7 11 7 12 8 13 9 14 10 15 10 16 11 17 12 18 13 19 13 20 14 21 14 22 15 23 16 24 17 25 17 26 18 27 18 28 19 29 20 30 20 TEST041: HERMITE_POLY evaluates the Hermite polynomial. HERMITE_POLY_VALUES returns some exact values. N X Exact F H(N)(X) 0 5 1 1 1 5 10 10 2 5 98 98 3 5 940 940 4 5 8812 8812 5 5 80600 80600 6 5 717880 717880 7 5 6.2116e+06 6.2116e+06 8 5 5.20657e+08 5.20657e+07 9 5 4.21271e+08 4.21271e+08 10 5 3.27553e+09 3.27553e+09 11 5 2.43299e+10 2.43299e+10 12 5 1.71237e+11 1.71237e+11 5 0.5 41 41 5 1 -8 -8 5 3 3816 3816 5 10 3.0412e+06 3.0412e+06 TEST042 HERMITE_POLY_COEF determines Hermite polynomial coefficients. H(0) 1 H(1) 2 * x 0 H(2) 4 * x^2 0 * x -2 H(3) 8 * x^3 0 * x^2 -12 * x -0 H(4) 16 * x^4 0 * x^3 -48 * x^2 -0 * x 12 H(5) 32 * x^5 0 * x^4 -160 * x^3 -0 * x^2 120 * x 0 TEST0425: R8_HYPER_2F1 evaluates the hypergeometric function 2F1. A B C X 2F1 2F1 DIFF (tabulated) (computed) -2.5 3.3 6.7 0.25 0.7235612934899779 0.7235612934899781 2.22e-16 -0.5 1.1 6.7 0.25 0.9791110934527796 0.9791110934527797 1.11e-16 0.5 1.1 6.7 0.25 1.021657814008856 1.021657814008856 0 2.5 3.3 6.7 0.25 1.405156320011213 1.405156320011212 4.441e-16 -2.5 3.3 6.7 0.55 0.4696143163982161 0.4696143163982162 5.551e-17 -0.5 1.1 6.7 0.55 0.9529619497744632 0.9529619497744636 3.331e-16 0.5 1.1 6.7 0.55 1.051281421394799 1.051281421394798 8.882e-16 2.5 3.3 6.7 0.55 2.399906290477786 2.399906290477784 1.776e-15 -2.5 3.3 6.7 0.85 0.2910609592841472 0.2910609592841474 2.22e-16 -0.5 1.1 6.7 0.85 0.9253696791037318 0.9253696791037318 0 0.5 1.1 6.7 0.85 1.0865504094807 1.0865504094807 0 2.5 3.3 6.7 0.85 5.738156552618904 5.738156552619301 3.97e-13 3.3 6.7 -5.5 0.25 15090.66974870461 15090.6697487046 1.091e-11 1.1 6.7 -0.5 0.25 -104.3117006736435 -104.3117006736435 2.842e-14 1.1 6.7 0.5 0.25 21.17505070776881 21.1750507077688 1.066e-14 3.3 6.7 4.5 0.25 4.194691581903192 4.194691581903191 8.882e-16 3.3 6.7 -5.5 0.55 10170777974.04881 10170777974.04883 1.144e-05 1.1 6.7 -0.5 0.55 -24708.63532248916 -24708.63532248914 1.819e-11 1.1 6.7 0.5 0.55 1372.230454838499 1372.230454838497 2.274e-12 3.3 6.7 4.5 0.55 58.09272870639465 58.09272870639462 2.842e-14 3.3 6.7 -5.5 0.85 5.868208761512417e+18 5.86820876151238e+18 3.686e+04 1.1 6.7 -0.5 0.85 -446350101.47296 -446350101.4729605 4.768e-07 1.1 6.7 0.5 0.85 5383505.756129573 5383505.756129581 8.382e-09 3.3 6.7 4.5 0.85 20396.91377601966 20396.91377601965 1.455e-11 TEST043: I4_FACTORIAL evaluates the factorial function. I4_FACTORIAL_VALUES returns some exact values. X Exact F I4_FACTORIAL(X) 0 1 1 1 1 1 2 2 2 3 6 6 4 24 24 5 120 120 6 720 720 7 5040 5040 8 40320 40320 9 362880 362880 10 3628800 3628800 11 39916800 39916800 12 479001600 479001600 TEST044: I4_FACTORIAL2 evaluates the double factorial function. N Exact I4_FACTORIAL2(N) 0 1 1 1 1 1 2 2 2 3 3 3 4 8 8 5 15 15 6 48 48 7 105 105 8 384 384 9 945 945 10 3840 3840 11 10395 10395 12 46080 46080 13 135135 135135 14 645120 645120 15 2027025 2027025 TEST045: For the number of partitions of an integer, I4_PARTITION_COUNT_VALUES returns some exact values. N Exact F 0 1 1 1 2 2 3 3 4 5 5 7 6 11 7 15 8 22 9 30 10 42 11 56 12 77 13 101 14 135 15 176 16 231 17 297 18 385 19 490 20 627 TEST046: For the number of partitions of an integer into distinct parts, I4_PARTITION_DISTINCT_COUNT computes any value. I4_PARTITION_DISTINCT_COUNT_VALUES returns some exact values. N Exact F Q(N) 0 1 1 1 1 1 2 1 1 3 2 2 4 2 2 5 3 3 6 4 4 7 5 5 8 6 6 9 8 8 10 10 10 11 12 12 12 15 15 13 18 18 14 22 22 15 27 27 16 32 32 17 38 38 18 46 46 19 54 54 20 64 64 TEST047 I4_POCHHAMMER evaluates the integer Pochhammer function. I J I4_Pochhammer(I,J) 3 3 3 3 4 12 3 5 60 TEST048 I4_TO_TRIANGLE converts a linear index to a triangular one. TRIANGLE_TO_I4 converts a triangular index to a linear one. I4_IS_TRIANGULAR returns 0 or 1 depending on whether I is triangular. I => J K => I 0/1 0 0 0 0 1 1 1 1 1 1 2 2 1 2 0 3 2 2 3 1 4 3 1 4 0 5 3 2 5 0 6 3 3 6 1 7 4 1 7 0 8 4 2 8 0 9 4 3 9 0 10 4 4 10 1 11 5 1 11 0 12 5 2 12 0 13 5 3 13 0 14 5 4 14 0 15 5 5 15 1 16 6 1 16 0 17 6 2 17 0 18 6 3 18 0 19 6 4 19 0 20 6 5 20 0 TEST049 JACOBI_POLY evaluates the Jacobi polynomials. JACOBI_POLY_VALUES returns some exact values of the Jacobi polynomials. N A B X JPV JACOBI 0 0 1 0.5 1 1 1 0 1 0.5 0.25 0.25 2 0 1 0.5 -0.375 -0.375 3 0 1 0.5 -0.4844 -0.4844 4 0 1 0.5 -0.1328 -0.1328 5 0 1 0.5 0.2754 0.2754 5 1 1 0.5 -0.1641 -0.1641 5 2 1 0.5 -1.175 -1.175 5 3 1 0.5 -2.361 -2.361 5 4 1 0.5 -2.616 -2.616 5 5 1 0.5 0.1172 0.1172 5 0 2 0.5 0.4219 0.4219 5 0 3 0.5 0.5049 0.5049 5 0 4 0.5 0.5098 0.5098 5 0 5 0.5 0.4307 0.4307 5 0 1 -1 -6 -6 5 0 1 -0.8 0.03862 0.03862 5 0 1 -0.6 0.8118 0.8118 5 0 1 -0.4 0.03666 0.03666 5 0 1 -0.2 -0.4851 -0.4851 5 0 1 0 -0.3125 -0.3125 5 0 1 0.2 0.1891 0.1891 5 0 1 0.4 0.4023 0.4023 5 0 1 0.6 0.01216 0.01216 5 0 1 0.8 -0.4396 -0.4396 5 0 1 1 1 1 TEST050 JACOBI_SYMBOL computes the Jacobi symbol (Q/P), which records if Q is a quadratic residue modulo the number P. Jacobi Symbols for P = 3 3 0 0 3 1 1 3 2 -1 3 3 0 Jacobi Symbols for P = 9 9 0 0 9 1 1 9 2 1 9 3 0 9 4 1 9 5 1 9 6 0 9 7 1 9 8 1 9 9 0 Jacobi Symbols for P = 10 10 0 0 10 1 1 10 2 0 10 3 -1 10 4 0 10 5 0 10 6 0 10 7 -1 10 8 0 10 9 1 10 10 0 Jacobi Symbols for P = 12 12 0 0 12 1 1 12 2 0 12 3 0 12 4 0 12 5 -1 12 6 0 12 7 1 12 8 0 12 9 0 12 10 0 12 11 -1 12 12 0 TEST051 LAGUERRE_ASSOCIATED evaluates the associated Laguerre polynomials. Table of L(N,M)(X) for N(max) = 6 M = 0 X = 0 0 1 1 1 2 1 3 1 4 1 5 1 6 1 Table of L(N,M)(X) for N(max) = 6 M = 0 X = 1 0 1 1 0 2 -0.5 3 -0.6667 4 -0.625 5 -0.4667 6 -0.2569 Table of L(N,M)(X) for N(max) = 6 M = 1 X = 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 Table of L(N,M)(X) for N(max) = 6 M = 2 X = 0.5 0 1 1 2.5 2 4.125 3 5.604 4 6.753 5 7.455 6 7.654 Table of L(N,M)(X) for N(max) = 6 M = 3 X = 0.5 0 1 1 3.5 2 7.625 3 13.23 4 19.98 5 27.44 6 35.09 Table of L(N,M)(X) for N(max) = 6 M = 1 X = 0.5 0 1 1 1.5 2 1.625 3 1.479 4 1.148 5 0.7029 6 0.1987 TEST052 LAGUERRE_GENERAL evaluates the generalized Laguerre functions. Table of L(N,ALPHA)(X) for N(max) = 10 ALPHA = 0 X = 0 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 Table of L(N,ALPHA)(X) for N(max) = 10 ALPHA = 0 X = 1 0 1 1 0 2 -0.5 3 -0.6667 4 -0.625 5 -0.4667 6 -0.2569 7 -0.04048 8 0.154 9 0.3097 10 0.4189 Table of L(N,ALPHA)(X) for N(max) = 10 ALPHA = 0.1 X = 0 0 1 1 1.1 2 1.155 3 1.194 4 1.223 5 1.248 6 1.269 7 1.287 8 1.303 9 1.317 10 1.33 Table of L(N,ALPHA)(X) for N(max) = 10 ALPHA = 0.1 X = 0.5 0 1 1 0.6 2 0.23 3 -0.06733 4 -0.2894 5 -0.4425 6 -0.5357 7 -0.5788 8 -0.5808 9 -0.5503 10 -0.4951 Table of L(N,ALPHA)(X) for N(max) = 10 ALPHA = 0.5 X = 0.5 0 1 1 1 2 0.75 3 0.4167 4 0.07292 5 -0.2437 6 -0.5137 7 -0.7277 8 -0.8828 9 -0.9803 10 -1.024 Table of L(N,ALPHA)(X) for N(max) = 10 ALPHA = 1 X = 0.5 0 1 1 1.5 2 1.625 3 1.479 4 1.148 5 0.7029 6 0.1987 7 -0.3196 8 -0.818 9 -1.271 10 -1.66 TEST054: LAGUERRE_POLY evaluates the Laguerre polynomial. LAGUERRE_POLY_VALUES returns some exact values. N X Exact F L(N)(X) 0 1 1 1 1 1 0 0 2 1 -0.5 -0.5 3 1 -0.6667 -0.6667 4 1 -0.625 -0.625 5 1 -0.4667 -0.4667 6 1 -0.2569 -0.2569 7 1 -0.04048 -0.04048 8 1 0.154 0.154 9 1 0.3097 0.3097 10 1 0.4189 0.4189 11 1 0.4801 0.4801 12 1 0.4962 0.4962 5 0.5 -0.4456 -0.4456 5 3 0.85 0.85 5 5 -3.167 -3.167 5 10 34.33 34.33 TEST055 LAGUERRE_POLY_COEF determines Laguerre polynomial coefficients. L(0) 1 L(1) -1 * x 1 L(2) 0.5 * x^2 -2 * x 1 L(3) -0.1667 * x^3 1.5 * x^2 -3 * x 1 L(4) 0.04167 * x^4 -0.6667 * x^3 3 * x^2 -4 * x 1 L(5) -0.008333 * x^5 0.2083 * x^4 -1.667 * x^3 5 * x^2 -5 * x 1 Factorially scaled L(0) 1 Factorially scaled L(1) -1 * x 1 Factorially scaled L(2) 1 * x^2 -4 * x 2 Factorially scaled L(3) -1 * x^3 9 * x^2 -18 * x 6 Factorially scaled L(4) 1 * x^4 -16 * x^3 72 * x^2 -96 * x 24 Factorially scaled L(5) -1 * x^5 25 * x^4 -200 * x^3 600 * x^2 -600 * x 120 TEST057: LEGENDRE_POLY evaluates the Legendre PN function. LEGENDRE_POLY_VALUES returns some exact values. N X Exact F P(N)(X) 0 0.25 1 1 1 0.25 0.25 0.25 2 0.25 -0.4062 -0.4062 3 0.25 -0.3359 -0.3359 9 0.25 0.1768 0.1768 10 0.25 0.2212 0.2212 3 0 0 -0 3 0.1 -0.1475 -0.1475 3 0.2 -0.28 -0.28 3 0.3 -0.3825 -0.3825 3 0.4 -0.44 -0.44 3 0.5 -0.4375 -0.4375 3 1 1 1 TEST58 LEGENDRE_POLY_COEF determines the Legendre P polynomial coefficients. P(0) 1 P(1) 1 * x 0 P(2) 1.5 * x^2 0 * x -0.5 P(3) 2.5 * x^3 0 * x^2 -1.5 * x -0 P(4) 4.375 * x^4 0 * x^3 -3.75 * x^2 -0 * x 0.375 P(5) 7.875 * x^5 0 * x^4 -8.75 * x^3 -0 * x^2 1.875 * x 0 TEST059: LEGENDRE_ASSOCIATED evaluates associated Legendre functions. LEGENDRE_ASSOCIATED_VALUES returns some exact values. N M X Exact F PNM(X) 1 0 0 0 0 1 0 0.5 0.5 0.5 1 0 0.7071 0.7071 0.7071 1 0 1 1 1 1 1 0.5 -0.866 -0.866 2 0 0.5 -0.125 -0.125 2 1 0.5 -1.299 -1.299 2 2 0.5 2.25 2.25 3 0 0.5 -0.4375 -0.4375 3 1 0.5 -0.3248 -0.3248 3 2 0.5 5.625 5.625 3 3 0.5 -9.743 -9.743 4 2 0.5 4.219 4.219 5 2 0.5 -4.922 -4.922 6 3 0.5 12.79 12.79 7 3 0.5 116.7 116.7 8 4 0.5 -1051 -1051 9 4 0.5 -2078 -2078 10 5 0.5 3.009e+04 3.009e+04 TEST0595: LEGENDRE_ASSOCIATED_NORMALIZED evaluates the associated Legendre functions using a normalization appropriate for the spherical harmonic functions. N M X LAN 0 0 0.5 0.2821 1 0 0.5 0.2443 1 1 0.5 -0.2992 2 0 0.5 -0.07885 2 1 0.5 -0.3345 2 2 0.5 0.2897 3 0 0.5 -0.3265 3 1 0.5 -0.06997 3 2 0.5 0.3832 3 3 0.5 -0.271 4 0 0.5 -0.2446 4 1 0.5 0.2561 4 2 0.5 0.1882 4 3 0.5 -0.4065 4 4 0.5 0.2489 5 0 0.5 0.08406 5 1 0.5 0.3294 5 2 0.5 -0.1589 5 3 0.5 -0.2809 5 4 0.5 0.4128 5 5 0.5 -0.2261 TEST060: LEGENDRE_FUNCTION_Q evaluates the Legendre Q function. LEGENDRE_FUNCTION_Q_VALUES returns some exact values. N X Exact F Q(N)(X) 0 0 0 0 1 0 -1 -1 2 0 0 -0 3 0 0.6667 0.6667 9 0 -0.4063 -0.4063 10 0 0 -0 0 0.5 0.5493 0.5493 1 0.5 -0.7253 -0.7253 2 0.5 -0.8187 -0.8187 3 0.5 -0.1987 -0.1987 9 0.5 -0.1162 -0.1162 10 0.5 0.2917 0.2917 TEST061 LEGENDRE_SYMBOL computes the Legendre symbol (Q/P) which records whether Q is a quadratic residue modulo the prime P. Legendre Symbols for P = 7 7 0 0 7 1 1 7 2 1 7 3 -1 7 4 1 7 5 -1 7 6 -1 7 7 0 Legendre Symbols for P = 11 11 0 0 11 1 1 11 2 -1 11 3 1 11 4 1 11 5 1 11 6 -1 11 7 -1 11 8 -1 11 9 1 11 10 -1 11 11 0 Legendre Symbols for P = 13 13 0 0 13 1 1 13 2 -1 13 3 1 13 4 1 13 5 -1 13 6 -1 13 7 -1 13 8 -1 13 9 1 13 10 1 13 11 -1 13 12 1 13 13 0 Legendre Symbols for P = 17 17 0 0 17 1 1 17 2 1 17 3 -1 17 4 1 17 5 -1 17 6 -1 17 7 -1 17 8 1 17 9 1 17 10 -1 17 11 -1 17 12 -1 17 13 1 17 14 -1 17 15 1 17 16 1 17 17 0 TEST0615: LERCH evaluates the Lerch function. LERCH_VALUES returns some tabulated values. Z S A Lerch Lerch Tabulated Computed 1 2 0 1.645 1.645 1 3 0 1.202 1.202 1 10 0 1.001 1.001 0.5 2 1 1.164 1.164 0.5 3 1 1.074 1.074 0.5 10 1 1 1 0.3333 2 2 0.2959 0.2959 0.3333 3 2 0.1395 0.1395 0.3333 10 2 0.0009823 0.0009823 0.1 2 3 0.1178 0.1178 0.1 3 3 0.03868 0.03868 0.1 10 3 1.703e-05 1.703e-05 TEST062 LOCK counts the combinations on a button lock. I, LOCK(I) 0 1 1 1 2 3 3 13 4 75 5 541 6 4683 7 47293 8 545835 9 7087261 10 102247563 TEST0625 MERTENS computes the Mertens function. MERTENS_VALUES returns some exact values. N Exact MERTENS(N) 1 1 1 2 0 0 3 -1 -1 4 -1 -1 5 -2 -2 6 -1 -1 7 -2 -2 8 -2 -2 9 -2 -2 10 -1 -1 11 -2 -2 12 -2 -2 100 1 1 1000 2 2 10000 -23 -23 TEST063 MOEBIUS computes the Moebius function. MOEBIUS_VALUES returns some exact values. N Exact MOEBIUS(N) 1 1 1 2 -1 -1 3 -1 -1 4 0 0 5 -1 -1 6 1 1 7 -1 -1 8 0 0 9 0 0 10 1 1 11 -1 -1 12 0 0 13 -1 -1 14 1 1 15 1 1 16 0 0 17 -1 -1 18 0 0 19 -1 -1 20 0 0 TEST0635 MOTZKIN computes the Motzkin numbers A(0:N). A(N) counts the paths from (0,0) to (N,0). I, A(I) 0 1 1 1 2 2 3 4 4 9 5 21 6 51 7 127 8 323 9 835 10 2188 TEST064 OMEGA computes the OMEGA function. OMEGA_VALUES returns some exact values. N Exact OMEGA(N) 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 2 2 7 1 1 8 1 1 9 1 1 10 2 2 30 3 3 101 1 1 210 4 4 1320 4 4 1764 3 3 2003 1 1 2310 5 5 2827 2 2 8717 2 2 12553 1 1 30030 6 6 510510 7 7 9699690 8 8 TEST065 PENTAGON_NUM computes the pentagonal numbers. 1 1 2 5 3 12 4 22 5 35 6 51 7 70 8 92 9 117 10 145 TEST066 PHI computes the PHI function. PHI_VALUES returns some exact values. N Exact PHI(N) 1 1 1 2 1 1 3 2 2 4 2 2 5 4 4 6 2 2 7 6 6 8 4 4 9 6 6 10 4 4 20 8 8 30 8 8 40 16 16 50 20 20 60 16 16 100 40 40 149 148 148 500 200 200 750 200 200 999 648 648 TEST0665 POLY_BERNOULLI computes the poly-Bernoulli numbers of negative index, B_n^(-k) N K B_N^(-K) 0 0 1 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 0 1 1 1 1 2 2 1 4 3 1 8 4 1 16 5 1 32 6 1 64 0 2 1 1 2 4 2 2 14 3 2 46 4 2 146 5 2 454 6 2 1394 0 3 1 1 3 8 2 3 46 3 3 230 4 3 1066 5 3 4718 6 3 20266 0 4 1 1 4 16 2 4 146 3 4 1066 4 4 6902 5 4 41506 6 4 237686 0 5 1 1 5 32 2 5 454 3 5 4718 4 5 41506 5 5 329462 6 5 2441314 0 6 1 1 6 64 2 6 1394 3 6 20266 4 6 237686 5 6 2441314 6 6 22934774 TEST0667 POLY_COEF_COUNT counts the number of coefficients in a polynomial of degree DEGREE and dimension DIM. Dimension Degree Count 1 0 1 1 1 2 1 2 3 1 3 4 1 4 5 1 5 6 4 0 1 4 1 5 4 2 15 4 3 35 4 4 70 4 5 126 7 0 1 7 1 8 7 2 36 7 3 120 7 4 330 7 5 792 10 0 1 10 1 11 10 2 66 10 3 286 10 4 1001 10 5 3003 TEST067 PYRAMID_NUM computes the pyramidal numbers. 1 1 2 4 3 10 4 20 5 35 6 56 7 84 8 120 9 165 10 220 TEST0675 R8_ACOSH2 computes the inverse hyperbolic cosine of a given value. X R8_ACOSH2(X) COSH(R8_ACOSH2(X)) 1 0 1 1.2 0.6224 1.2 1.4 0.867 1.4 1.6 1.047 1.6 1.8 1.193 1.8 2 1.317 2 2.2 1.425 2.2 2.4 1.522 2.4 2.6 1.609 2.6 2.8 1.689 2.8 3 1.763 3 TEST068: R8_FACTORIAL evaluates the factorial function. R8_FACTORIAL_VALUES returns some exact values. N Exact F R8_FACTORIAL(N) 0 1 1 1 1 1 2 2 2 3 6 6 4 24 24 5 120 120 6 720 720 7 5040 5040 8 4.032e+04 4.032e+04 9 3.629e+05 3.629e+05 10 3.629e+06 3.629e+06 11 3.992e+07 3.992e+07 12 4.79e+08 4.79e+08 13 6.227e+09 6.227e+09 14 8.718e+10 8.718e+10 15 1.308e+12 1.308e+12 16 2.092e+13 2.092e+13 17 3.557e+14 3.557e+14 18 6.402e+15 6.402e+15 19 1.216e+17 1.216e+17 20 2.433e+18 2.433e+18 25 1.551e+25 1.551e+25 30 2.653e+32 2.653e+32 TEST0685: R8_FACTORIAL_LOG evaluates the logarithm of the factorial function. R8_FACTORIAL_LOG_VALUES returns some exact values. N Exact F R8_FACTORIAL_LOG(N) 0 0 0 1 0 0 2 0.6931 0.6931 3 1.792 1.792 4 3.178 3.178 5 4.787 4.787 6 6.579 6.579 7 8.525 8.525 8 10.6 10.6 9 12.8 12.8 10 15.1 15.1 11 17.5 17.5 12 19.99 19.99 13 22.55 22.55 14 25.19 25.19 15 27.9 27.9 16 30.67 30.67 17 33.51 33.51 18 36.4 36.4 19 39.34 39.34 20 42.34 42.34 25 58 58 50 148.5 148.5 100 363.7 363.7 150 605 605 500 2611 2611 1000 5912 5912 TEST06855: R8_GAMMA evaluates the Gamma function. GAMMA_VALUES returns some exact values. X Gamma(X) Gamma(X) DIFF (Tabulated) (R8_GAMMA) -0.5 -3.544907701811032 -3.544907701811032 4.441e-16 -0.01 -100.5871979644108 -100.5871979644108 4.263e-14 0.01 99.4325851191506 99.4325851191506 0 0.1 9.513507698668732 9.513507698668731 1.776e-15 0.2 4.590843711998803 4.590843711998803 0 0.4 2.218159543757688 2.218159543757688 0 0.5 1.772453850905516 1.772453850905516 0 0.6 1.489192248812817 1.489192248812817 0 0.8 1.164229713725303 1.164229713725303 2.22e-16 1 1 1 0 1.1 0.9513507698668732 0.9513507698668732 0 1.2 0.9181687423997607 0.9181687423997607 0 1.3 0.8974706963062772 0.8974706963062772 0 1.4 0.8872638175030753 0.8872638175030754 1.11e-16 1.5 0.8862269254527581 0.8862269254527581 0 1.6 0.8935153492876903 0.8935153492876903 0 1.7 0.9086387328532904 0.9086387328532904 0 1.8 0.9313837709802427 0.9313837709802427 0 1.9 0.9617658319073874 0.9617658319073874 0 2 1 1 0 3 2 2 0 4 6 6 0 10 362880 362880 0 20 1.21645100408832e+17 1.216451004088321e+17 80 30 8.841761993739702e+30 8.841761993739751e+30 4.954e+16 TEST06856: R8_PSI evaluates the Psi function. PSI_VALUES returns some exact values. X Psi(X) Psi(X) DIFF (Tabulated) (R8_PSI) 1 -0.5772156649015329 -0.5772156649015329 0 1.1 -0.4237549404110768 -0.4237549404110768 5.551e-17 1.2 -0.2890398965921883 -0.2890398965921884 5.551e-17 1.3 -0.1691908888667997 -0.1691908888667995 1.665e-16 1.4 -0.06138454458511615 -0.06138454458511624 9.021e-17 1.5 0.03648997397857652 0.03648997397857652 0 1.6 0.1260474527734763 0.1260474527734763 2.776e-17 1.7 0.208547874873494 0.208547874873494 2.776e-17 1.8 0.2849914332938615 0.2849914332938615 0 1.9 0.3561841611640597 0.3561841611640596 1.11e-16 2 0.4227843350984671 0.4227843350984672 1.11e-16 TEST069 SIGMA computes the SIGMA function. SIGMA_VALUES returns some exact values. N Exact SIGMA(N) 1 1 1 2 3 3 3 4 4 4 7 7 5 6 6 6 12 12 7 8 8 8 15 15 9 13 13 10 18 18 30 72 72 127 128 128 128 255 255 129 176 176 210 576 576 360 1170 1170 617 618 618 815 984 984 816 2232 2232 1000 2340 2340 TEST0695: SIN_POWER_INT computes the integral of the N-th power of the sine function. SIN_POWER_INT_VALUES returns selected values. A B N Exact Computed 10 20 0 10 10 0 1 1 0.4597 0.4597 0 1 2 0.2727 0.2727 0 1 3 0.1789 0.1789 0 1 4 0.124 0.124 0 1 5 0.08897 0.08897 0 2 5 0.9039 0.9039 1 2 5 0.815 0.815 0 1 10 0.02189 0.02189 0 1 11 0.01702 0.01702 TEST0697: SPHERICAL_HARMONIC evaluates spherical harmonic functions. SPHERICAL_HARMONIC_VALUES returns some exact values. N M THETA PHI YR YI 0 0 0.5236 1.047 0.2821 0 0.2821 0 1 0 0.5236 1.047 0.4231 0 0.4231 0 2 1 0.5236 1.047 -0.1673 -0.2897 -0.1673 -0.2897 3 2 0.5236 1.047 -0.1106 0.1916 -0.1106 0.1916 4 3 0.5236 1.047 0.1355 0 0.1355 1.038e-16 5 5 0.2618 0.6283 0.000539 0 0.000539 -6.601e-20 5 4 0.2618 0.6283 -0.005147 0.003739 -0.005147 0.003739 5 3 0.2618 0.6283 0.01371 -0.0422 0.01371 -0.0422 5 2 0.2618 0.6283 0.06096 0.1876 0.06096 0.1876 5 1 0.2618 0.6283 -0.417 -0.303 -0.417 -0.303 4 2 0.6283 0.7854 0 0.4139 2.535e-17 0.4139 4 2 1.885 0.7854 0 -0.1003 -6.143e-18 -0.1003 4 2 3.142 0.7854 0 0 0 0 4 2 4.398 0.7854 0 -0.1003 -6.143e-18 -0.1003 4 2 5.655 0.7854 0 0.4139 2.535e-17 0.4139 3 -1 0.3927 0.4488 0.3641 -0.1754 0.3641 -0.1754 3 -1 0.3927 0.8976 0.252 -0.316 0.252 -0.316 3 -1 0.3927 1.346 0.08993 -0.394 0.08993 -0.394 3 -1 0.3927 1.795 -0.08993 -0.394 -0.08993 -0.394 3 -1 0.3927 2.244 -0.252 -0.316 -0.252 -0.316 TEST070 STIRLING1: Stirling numbers of first kind. Get rows 1 through 8 1 1 0 0 0 0 0 0 0 2 -1 1 0 0 0 0 0 0 3 2 -3 1 0 0 0 0 0 4 -6 11 -6 1 0 0 0 0 5 24 -50 35 -10 1 0 0 0 6 -120 274 -225 85 -15 1 0 0 7 720 -1764 1624 -735 175 -21 1 0 8 -5040 13068 -13132 6769 -1960 322 -28 1 TEST071 STIRLING2: Stirling numbers of second kind. Get rows 1 through 8 1 1 0 0 0 0 0 0 0 2 1 1 0 0 0 0 0 0 3 1 3 1 0 0 0 0 0 4 1 7 6 1 0 0 0 0 5 1 15 25 10 1 0 0 0 6 1 31 90 65 15 1 0 0 7 1 63 301 350 140 21 1 0 8 1 127 966 1701 1050 266 28 1 TEST072 TAU computes the Tau function. TAU_VALUES returns some exact values. N exact C(I) computed C(I) 1 1 1 2 2 2 3 2 2 4 3 3 5 2 2 6 4 4 7 2 2 8 4 4 9 3 3 10 4 4 23 2 2 72 12 12 126 12 12 226 4 4 300 18 18 480 24 24 521 2 2 610 8 8 832 14 14 960 28 28 TEST073 TETRAHEDRON_NUM computes the tetrahedron numbers. 1 1 2 4 3 10 4 20 5 35 6 56 7 84 8 120 9 165 10 220 TEST074 TRIANGLE_NUM computes the triangular numbers. 1 1 2 3 3 6 4 10 5 15 6 21 7 28 8 36 9 45 10 55 TEST075 V_HOFSTADTER evaluates Hofstadter's recursive V function. N V(N) 0 0 1 1 2 1 3 1 4 1 5 2 6 3 7 4 8 5 9 5 10 6 11 6 12 7 13 8 14 8 15 9 16 9 17 10 18 11 19 11 20 11 21 12 22 12 23 13 24 14 25 14 26 15 27 15 28 16 29 17 30 17 TEST076 VIBONACCI computes a Vibonacci sequence. We compute the series 3 times. I V1 V2 V3 0 1 1 1 1 1 1 1 2 0 0 -2 3 1 -1 1 4 -1 -1 -1 5 0 0 -2 6 -1 -1 -3 7 1 1 1 8 -2 0 -2 9 -3 1 -3 10 -1 -1 5 11 4 -2 2 12 3 -3 -7 13 -7 -1 -5 14 10 -4 2 15 -3 3 7 16 -13 1 9 17 -16 2 -2 18 -3 -3 -11 19 -19 1 -9 TEST077 ZECKENDORF computes the Zeckendorf decomposition of an integer N into nonconsecutive Fibonacci numbers. N Sum M Parts 1 1 2 2 3 3 4 3 1 5 5 6 5 1 7 5 2 8 8 9 8 1 10 8 2 11 8 3 12 8 3 1 13 13 14 13 1 15 13 2 16 13 3 17 13 3 1 18 13 5 19 13 5 1 20 13 5 2 21 21 22 21 1 23 21 2 24 21 3 25 21 3 1 26 21 5 27 21 5 1 28 21 5 2 29 21 8 30 21 8 1 31 21 8 2 32 21 8 3 33 21 8 3 1 34 34 35 34 1 36 34 2 37 34 3 38 34 3 1 39 34 5 40 34 5 1 41 34 5 2 42 34 8 43 34 8 1 44 34 8 2 45 34 8 3 46 34 8 3 1 47 34 13 48 34 13 1 49 34 13 2 50 34 13 3 51 34 13 3 1 52 34 13 5 53 34 13 5 1 54 34 13 5 2 55 55 56 55 1 57 55 2 58 55 3 59 55 3 1 60 55 5 61 55 5 1 62 55 5 2 63 55 8 64 55 8 1 65 55 8 2 66 55 8 3 67 55 8 3 1 68 55 13 69 55 13 1 70 55 13 2 71 55 13 3 72 55 13 3 1 73 55 13 5 74 55 13 5 1 75 55 13 5 2 76 55 21 77 55 21 1 78 55 21 2 79 55 21 3 80 55 21 3 1 81 55 21 5 82 55 21 5 1 83 55 21 5 2 84 55 21 8 85 55 21 8 1 86 55 21 8 2 87 55 21 8 3 88 55 21 8 3 1 89 89 90 89 1 91 89 2 92 89 3 93 89 3 1 94 89 5 95 89 5 1 96 89 5 2 97 89 8 98 89 8 1 99 89 8 2 100 89 8 3 TEST0773 ZERNIKE_POLY_COEF returns the coefficients of a Zernike polynomial. ZERNIKE_POLY evaluates a Zernike polynomial directly. Table of polynomial coefficients: N M 0 0 1 1 0 0 0 1 1 0 1 2 0 -1 0 2 2 1 0 0 0 2 2 0 0 1 3 0 0 0 0 0 3 1 0 -2 0 3 3 2 0 0 0 0 3 3 0 0 0 1 4 0 1 0 -6 0 6 4 1 0 0 0 0 0 4 2 0 0 -3 0 4 4 3 0 0 0 0 0 4 4 0 0 0 0 1 5 0 0 0 0 0 0 0 5 1 0 3 0 -12 0 10 5 2 0 0 0 0 0 0 5 3 0 0 0 -4 0 5 5 4 0 0 0 0 0 0 5 5 0 0 0 0 0 1 Z1: Compute polynomial coefficients, then evaluate by Horner's method; Z2: Evaluate directly by recursion. N M Z1 Z2 0 0 1 1 1 0 0 0 1 1 0.9877 0.9877 2 0 0.9509 0.9509 2 1 0 0 2 2 0.9755 0.9755 3 0 0 0 3 1 0.9149 0.9149 3 2 0 0 3 3 0.9634 0.9634 4 0 0.8564 0.8564 4 1 0 0 4 2 0.8797 0.8797 4 3 0 0 4 4 0.9515 0.9515 5 0 0 0 5 1 0.7997 0.7997 5 2 0 0 5 3 0.8452 0.8452 5 4 0 0 5 5 0.9398 0.9398 TEST0775 ZERNIKE_POLY_COEF determines the Zernike polynomial coefficients. Zernike polynomial p(x) = 0 Zernike polynomial p(x) = 10 * x^5 -12 * x^3 +3 * x Zernike polynomial p(x) = 0 Zernike polynomial p(x) = 5 * x^5 -4 * x^3 Zernike polynomial p(x) = 0 Zernike polynomial p(x) = 1 * x^5 TEST078 ZETA computes the Zeta function. ZETA_VALUES returns some exact values. N exact Zeta computed Zeta 2 1.645 1.644 3 1.202 1.202 4 1.082 1.082 5 1.037 1.037 6 1.017 1.017 7 1.008 1.008 8 1.004 1.004 9 1.002 1.002 10 1.001 1.001 11 1 1 12 1 1 16 1 1 20 1 1 30 1 1 40 1 1 POLPAK_PRB Normal end of execution. 05 March 2008 08:38:15 AM