polpak
polpak,
a Fortran77 code which
evaluates a variety of mathematical functions, polynomials, and
sequences, including Bell, Benford, Bernoulli, Bernstein, Cardan,
Catalan, Charlier, Chebyshev, Collatz, Delannoy, Euler, Fibonacci,
Gegenbauer, Gudermannian, Hermite, Hofstadter, Jacobi, Krawtchouk,
Laguerre, Lambert, Legendre, Lerch, Meixner, Mertens, Moebius, Motzkin,
Phi, Stirling, Tau, Tribonacci, Zernike.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the MIT license
Languages:
POLPAK is available in
a C version and
a C++ version and
a Fortran77 version and
a Fortran90 version and
a MATLAB version and
a Python version
Related Data and Programs:
bernstein_polynomial,
a Fortran77 library which
evaluates the Bernstein polynomials,
useful for uniform approximation of functions;
CORDIC,
a Fortran77 library which
uses the CORDIC method to compute certain elementary functions.
FN,
a Fortran77 library which
evaluates elementary and special functions,
by Wayne Fullerton.
LEGENDRE_PRODUCT_POLYNOMIAL,
a Fortran77 library which
defines Legendre product polynomials, creating a multivariate
polynomial as the product of univariate Legendre polynomials.
SLATEC,
a Fortran90 library which
evaluates many special functions.
SPECIAL_FUNCTIONS,
a Fortran77 library which
computes special functions,
by Shanjie Zhang, Jianming Jin;
TEST_VALUES,
a Fortran77 library which
contains a few test values of many functions.
Reference:
-
Milton Abramowitz, Irene Stegun,
Handbook of Mathematical Functions,
National Bureau of Standards, 1964,
ISBN: 0-486-61272-4,
LC: QA47.A34.
-
Robert Banks,
Slicing Pizzas, Racing Turtles, and Further Adventures in Applied Mathematics,
Princeton, 1999,
ISBN13: 9780691059471,
LC: QA93.B358.
-
Frank Benford,
The Law of Anomalous Numbers,
Proceedings of the American Philosophical Society,
Volume 78, 1938, pages 551-572.
-
Paul Bratley, Bennett Fox, Linus Schrage,
A Guide to Simulation,
Second Edition,
Springer, 1987,
ISBN: 0387964673,
LC: QA76.9.C65.B73.
-
Chad Brewbaker,
Lonesum (0,1)-matrices and poly-Bernoulli numbers of negative
index,
Master of Science Thesis,
Computer Science Department,
Iowa State University, 2005.
-
William Briggs, Van Emden Henson,
The DFT: An Owner's Manual for the Discrete Fourier Transform,
SIAM, 1995,
ISBN13: 978-0-898713-42-8,
LC: QA403.5.B75.
-
Theodore Chihara,
An Introduction to Orthogonal Polynomials,
Gordon and Breach, 1978,
ISBN: 0677041500,
LC: QA404.5 C44.
-
William Cody,
Rational Chebyshev Approximations for the Error Function,
Mathematics of Computation,
Volume 23, Number 107, July 1969, pages 631-638.
-
Robert Corless, Gaston Gonnet, David Hare, David Jeffrey,
Donald Knuth,
On the Lambert W Function,
Advances in Computational Mathematics,
Volume 5, Number 1, December 1996, pages 329-359.
-
Bennett Fox,
Algorithm 647:
Implementation and Relative Efficiency of Quasirandom
Sequence Generators,
ACM Transactions on Mathematical Software,
Volume 12, Number 4, December 1986, pages 362-376.
-
Walter Gautschi,
Orthogonal Polynomials: Computation and Approximation,
Oxford, 2004,
ISBN: 0-19-850672-4,
LC: QA404.5 G3555.
-
Ralph Hartley,
A More Symmetrical Fourier Analysis Applied to Transmission
Problems,
Proceedings of the Institute of Radio Engineers,
Volume 30, 1942, pages 144-150.
-
Brian Hayes,
The Vibonacci Numbers,
American Scientist,
Volume 87, Number 4, July-August 1999, pages 296-301.
-
Brian Hayes,
Why W?,
American Scientist,
Volume 93, Number 2, March-April 2005, pages 104-108.
-
Ted Hill,
The First Digit Phenomenon,
American Scientist,
Volume 86, Number 4, July/August 1998, pages 358-363.
-
Douglas Hofstadter,
Goedel, Escher, Bach,
Basic Books, 1979,
ISBN: 0465026567,
LC: QA9.8H63.
-
Masanobu Kaneko,
Poly-Bernoulli Numbers,
Journal Theorie des Nombres Bordeaux,
Volume 9, Number 1, 1997, pages 221-228.
-
Cleve Moler,
Trigonometry is a Complex Subject,
MATLAB News and Notes, Summer 1998.
-
Thomas Osler,
Cardan Polynomials and the Reduction of Radicals,
Mathematics Magazine,
Volume 74, Number 1, February 2001, pages 26-32.
-
J Simoes Pereira,
Algorithm 234: Poisson-Charliers Polynomials,
Communications of the ACM,
Volume 7, Number 7, July 1964, page 420.
-
Charles Pinter,
A Book of Abstract Algebra,
Second Edition,
McGraw Hill, 2003,
ISBN: 0072943505,
LC: QA162.P56.
-
Ralph Raimi,
The Peculiar Distribution of First Digits,
Scientific American,
December 1969, pages 109-119.
-
Dennis Stanton, Dennis White,
Constructive Combinatorics,
Springer, 1986,
ISBN: 0387963472.
-
Gabor Szego,
Orthogonal Polynomials,
American Mathematical Society, 1992,
ISBN: 0821810235,
LC: QA3.A5.v23.
-
Daniel Velleman, Gregory Call,
Permutations and Combination Locks,
Mathematics Magazine,
Volume 68, Number 4, October 1995, pages 243-253.
-
Divakar Viswanath,
Random Fibonacci sequences and the number 1.13198824,
Mathematics of Computation,
Volume 69, Number 231, July 2000, pages 1131-1155.
-
Michael Waterman,
Introduction to Computational Biology,
Chapman and Hall, 1995,
ISBN: 0412993910,
LC: QH438.4.M33.W38.
-
Eric Weisstein,
CRC Concise Encyclopedia of Mathematics,
CRC Press, 2002,
Second edition,
ISBN: 1584883472,
LC: QA5.W45
-
Stephen Wolfram,
The Mathematica Book,
Fourth Edition,
Cambridge University Press, 1999,
ISBN: 0-521-64314-7,
LC: QA76.95.W65.
-
ML Wolfson, HV Wright,
ACM Algorithm 160: Combinatorial of M Things Taken N at a Time,
Communications of the ACM,
Volume 6, Number 4, April 1963, page 161.
-
Shanjie Zhang, Jianming Jin,
Computation of Special Functions,
Wiley, 1996,
ISBN: 0-471-11963-6,
LC: QA351.C45.
-
Daniel Zwillinger, editor,
CRC Standard Mathematical Tables and Formulae,
30th Edition,
CRC Press, 1996,
ISBN: 0-8493-2479-3,
LC: QA47.M315.
Source Code:
Examples and Tests:
List of Routines:
-
AGM_VALUES returns some values of the arithmetic geometric mean.
-
AGUD evaluates the inverse Gudermannian function.
-
ALIGN_ENUM counts the alignments of two sequences of M and N elements.
-
BELL returns the Bell numbers from 0 to N.
-
BELL_VALUES returns some values of the Bell numbers for testing.
-
BENFORD returns the Benford probability of one or more significant digits.
-
BERNOULLI_NUMBER computes the value of the Bernoulli numbers B(0) through B(N).
-
BERNOULLI_NUMBER2 evaluates the Bernoulli numbers.
-
BERNOULLI_NUMBER3 computes the value of the Bernoulli number B(N).
-
BERNOULLI_NUMBER_VALUES returns some values of the Bernoulli numbers.
-
BERNOULLI_POLY evaluates the Bernoulli polynomial of order N at X.
-
BERNOULLI_POLY2 evaluates the N-th Bernoulli polynomial at X.
-
BERNSTEIN_POLY evaluates the Bernstein polynomials at a point X.
-
BERNSTEIN_POLY_VALUES returns some values of the Bernstein polynomials.
-
BETA_VALUES returns some values of the Beta function.
-
BPAB evaluates at X the Bernstein polynomials based in [A,B].
-
CARDAN_POLY evaluates the Cardan polynomials.
-
CARDAN_POLY_COEF computes the coefficients of the N-th Cardan polynomial.
-
CARDINAL_COS evaluates the J-th cardinal cosine basis function.
-
CARDINAL_SIN evaluates the J-th cardinal sine basis function.
-
CATALAN computes the Catalan numbers, from C(0) to C(N).
-
CATALAN_CONSTANT returns the value of Catalan's constant.
-
CATALAN_ROW_NEXT computes row N of Catalan's triangle.
-
CATALAN_VALUES returns some values of the Catalan numbers for testing.
-
CHARLIER evaluates Charlier polynomials at a point.
-
CHEBY_T_POLY evaluates Chebyshev polynomials T(n,x).
-
CHEBY_T_POLY_COEF evaluates coefficients of Chebyshev polynomials T(n,x).
-
CHEBY_T_POLY_VALUES returns values of Chebyshev polynomials T(n,x).
-
CHEBY_T_POLY_ZERO returns zeroes of Chebyshev polynomials T(n,x).
-
CHEBY_U_POLY evaluates Chebyshev polynomials U(n,x).
-
CHEBY_U_POLY_COEF evaluates coefficients of Chebyshev polynomials U(n,x).
-
CHEBY_U_POLY_VALUES returns values of Chebyshev polynomials U(n,x).
-
CHEBY_U_POLY_ZERO returns zeroes of Chebyshev polynomials U(n,x).
-
CHEBYSHEV_DISCRETE evaluates discrete Chebyshev polynomials at a point.
-
COLLATZ_COUNT counts the number of terms in a Collatz sequence.
-
COLLATZ_COUNT_MAX seeks the maximum Collatz count for 1 through N.
-
COLLATZ_COUNT_VALUES returns some values of the Collatz count function.
-
COMB_ROW_NEXT computes the next row of Pascal's triangle.
-
COMMUL computes a multinomial combinatorial coefficient.
-
COMPLETE_SYMMETRIC_POLY evaluates a complete symmetric polynomial.
-
COS_POWER_INT evaluates the cosine power integral.
-
COS_POWER_INT_VALUES returns some values of the cosine power integral.
-
DELANNOY returns the Delannoy numbers up to orders (M,N).
-
ERF_VALUES returns some values of the ERF or "error" function for testing.
-
EULER_NUMBER computes the Euler numbers.
-
EULER_NUMBER2 computes the Euler numbers.
-
EULER_NUMBER_VALUES returns some values of the Euler numbers.
-
EULER_POLY evaluates the N-th Euler polynomial at X.
-
EULERIAN computes the Eulerian number E(N,K).
-
FIBONACCI_DIRECT computes the N-th Fibonacci number directly.
-
FIBONACCI_FLOOR returns the largest Fibonacci number less than or equal to N.
-
FIBONACCI_RECURSIVE computes the first N Fibonacci numbers.
-
GAMMA_LOG_VALUES returns some values of the Log Gamma function.
-
GAMMA_VALUES returns some values of the Gamma function.
-
GEGENBAUER_POLY computes the Gegenbauer polynomials C(I,ALPHA,X).
-
GEGENBAUER_POLY_VALUES returns some values of the Gegenbauer polynomials.
-
GEN_HERMITE_POLY evaluates the generalized Hermite polynomials at X.
-
GEN_LAGUERRE_POLY evaluates generalized Laguerre polynomials.
-
GUD evaluates the Gudermannian function.
-
GUD_VALUES returns some values of the Gudermannian function.
-
HERMITE_POLY_PHYS evaluates the physicisist's Hermite polynomials at X.
-
HERMITE_POLY_PHYS_COEF evaluates the physicist's Hermite polynomial coefficients.
-
HERMITE_POLY_PHYS_VALUES returns some values of the physicist's Hermite polynomial.
-
HYPER_2F1_VALUES returns some values of the hypergeometric function 2F1.
-
I4_CHOOSE computes the binomial coefficient C(N,K).
-
I4_FACTOR factors an I4 into prime factors.
-
I4_FACTORIAL computes the factorial of N.
-
I4_FACTORIAL_VALUES returns values of the factorial function.
-
I4_FACTORIAL2 computes the double factorial function.
-
I4_FACTORIAL2_VALUES returns values of the double factorial function.
-
I4_HUGE returns a "huge" I4.
-
I4_IS_PRIME reports whether an I4 is prime.
-
I4_IS_TRIANGULAR determines whether an integer is triangular.
-
I4_PARTITION_DISTINCT_COUNT returns any value of Q(N).
-
I4_SWAP switches two I4's.
-
I4_TO_TRIANGLE converts an integer to triangular coordinates.
-
I4_UNIFORM_AB returns a scaled pseudorandom I4 between A and B.
-
I4MAT_PRINT prints an I4MAT.
-
I4MAT_PRINT_SOME prints some of an I4MAT.
-
JACOBI_POLY evaluates the Jacobi polynomials at X.
-
JACOBI_POLY_VALUES returns some values of the Jacobi polynomial.
-
JACOBI_SYMBOL evaluates the Jacobi symbol (Q/P).
-
KRAWTCHOUK evaluates the Krawtchouk polynomials at X.
-
LAGUERRE_ASSOCIATED evaluates associated Laguerre polynomials L(N,M,X).
-
LAGUERRE_POLY evaluates the Laguerre polynomials at X.
-
LAGUERRE_POLY_COEF evaluates the Laguerre polynomial coefficients.
-
LAGUERRE_POLYNOMIAL_VALUES returns some values of the Laguerre polynomial.
-
LAMBERT_W estimates the Lambert W function.
-
LAMBERT_W_CRUDE is a crude estimate of the Lambert W function.
-
LAMBERT_W_VALUES returns some values of the Lambert W function.
-
LEGENDRE_ASSOCIATED evaluates the associated Legendre functions.
-
LEGENDRE_ASSOCIATED_NORMALIZED: normalized associated Legendre functions.
-
LEGENDRE_ASSOCIATED_NORMALIZED_SPHERE_VALUES: normalized associated Legendre.
-
LEGENDRE_ASSOCIATED_VALUES returns values of associated Legendre functions.
-
LEGENDRE_FUNCTION_Q evaluates the Legendre Q functions.
-
LEGENDRE_FUNCTION_Q_VALUES returns values of the Legendre Q function.
-
LEGENDRE_POLY evaluates the Legendre polynomials P(N,X) at X.
-
LEGENDRE_POLY_COEF evaluates the Legendre polynomial coefficients.
-
LEGENDRE_POLY_VALUES returns values of the Legendre polynomials.
-
LEGENDRE_SYMBOL evaluates the Legendre symbol (Q/P).
-
LERCH estimates the Lerch transcendent function.
-
LERCH_VALUES returns some values of the Lerch transcendent function.
-
LOCK returns the number of codes for a lock with N buttons.
-
MEIXNER evaluates Meixner polynomials at a point.
-
MERTENS evaluates the Mertens function.
-
MERTENS_VALUES returns some values of the Mertens function.
-
MOEBIUS returns the value of MU(N), the Moebius function of N.
-
MOEBIUS_VALUES returns some values of the Moebius function.
-
MOTZKIN returns the Motzkin numbers up to order N.
-
NORMAL_01_CDF_INVERSE inverts the standard normal CDF.
-
NORMAL_01_CDF_VALUES returns some values of the Normal 01 CDF.
-
OMEGA returns OMEGA(N), the number of distinct prime divisors of N.
-
OMEGA_VALUES returns some values of the OMEGA function.
-
PARTITION_DISTINCT_COUNT_VALUES returns some values of Q(N).
-
PENTAGON_NUM computes the N-th pentagonal number.
-
PHI computes the number of relatively prime predecessors of an integer.
-
PHI_VALUES returns some values of the PHI function.
-
PLANE_PARTITION_NUM returns the number of plane partitions of the integer N.
-
POLY_BERNOULLI evaluates the poly-Bernolli numbers with negative index.
-
POLY_COEF_COUNT: polynomial coefficient count given dimension and degree.
-
PRIME returns any of the first PRIME_MAX prime numbers.
-
PSI_VALUES returns some values of the Psi or Digamma function for testing.
-
PYRAMID_NUM returns the N-th pyramidal number.
-
PYRAMID_SQUARE_NUM returns the N-th pyramidal square number.
-
R8_AGM computes the arithmetic-geometric mean of A and B.
-
R8_BETA returns the value of the Beta function.
-
R8_CHOOSE computes the binomial coefficient C(N,K) as an R8.
-
R8_EPSILON returns the R8 roundoff unit.
-
R8_ERF evaluates the error function.
-
R8_ERF_INVERSE inverts the error function.
-
R8_EULER_CONSTANT returns the value of the Euler-Mascheroni constant.
-
R8_FACTORIAL computes the factorial of N.
-
R8_FACTORIAL_LOG computes log(factorial(N)).
-
R8_FACTORIAL_LOG_VALUES returns values of log(factorial(n)).
-
R8_FACTORIAL_VALUES returns values of the real factorial function.
-
R8_GAMMA_LOG evaluates log ( Gamma ( X ) ) for a real argument.
-
R8_HUGE returns a "huge" R8.
-
R8_HYPER_2F1 evaluates the hypergeometric function F(A,B,C,X).
-
R8_MOP returns the I-th power of -1 as an R8.
-
R8_NINT returns the nearest integer to an R8.
-
R8_PI returns the value of pi as an R8.
-
R8_PSI evaluates the function Psi(X).
-
R8_UNIFORM_01 returns a unit pseudorandom R8.
-
R8POLY_DEGREE returns the degree of a polynomial.
-
R8POLY_PRINT prints out a polynomial.
-
R8POLY_VALUE_HORNER evaluates a polynomial using Horner's method.
-
R8VEC_LINSPACE creates a vector of linearly spaced values.
-
R8VEC_PRINT prints an R8VEC.
-
R8VEC_PRINT_SOME prints "some" of an R8VEC.
-
R8VEC_UNIFORM_AB returns a scaled pseudorandom R8VEC.
-
S_LEN_TRIM returns the length of a string to the last nonblank.
-
SIGMA returns the value of SIGMA(N), the divisor sum.
-
SIGMA_VALUES returns some values of the Sigma function.
-
SIMPLEX_NUM evaluates the N-th Simplex number in M dimensions.
-
SIN_POWER_INT evaluates the sine power integral.
-
SIN_POWER_INT_VALUES returns some values of the sine power integral.
-
SLICE: maximum number of pieces created by a given number of slices.
-
SPHERICAL_HARMONIC evaluates spherical harmonic functions.
-
SPHERICAL_HARMONIC_VALUES returns values of spherical harmonic functions.
-
STIRLING1 computes the Stirling numbers of the first kind.
-
STIRLING2 computes the Stirling numbers of the second kind.
-
TAU returns the value of TAU(N), the number of distinct divisors of N.
-
TAU_VALUES returns some values of the Tau function.
-
TETRAHEDRON_NUM returns the N-th tetrahedral number.
-
TIMESTAMP prints out the current YMDHMS date as a timestamp.
-
TRIANGLE_NUM returns the N-th triangular number.
-
TRIANGLE_TO_I4 converts a triangular coordinate to an integer.
-
TRINOMIAL computes a trinomial coefficient.
-
VIBONACCI computes the first N Vibonacci numbers.
-
ZECKENDORF produces the Zeckendorf decomposition of a positive integer.
-
ZERNIKE_POLY evaluates a Zernike polynomial at RHO.
-
ZERNIKE_POLY_COEF: coefficients of a Zernike polynomial.
-
ZETA estimates the Riemann Zeta function.
-
ZETA_VALUES returns some values of the Riemann Zeta function.
You can go up one level to
the Fortran77 source codes.
Last revised on 11 April 2015.