# fn.

fn, a MATLAB code which approximates elementary and special functions using Chebyshev polynomials; functions include Airy, Bessel I, Bessel J, Bessel K, Bessel Y, beta, confluent hypergeometric, cosine integral, Dawson's integral, digamma (psi), error, exponential integral, gamma, hyperbolic cosine integral, hyperbolic sine integral, incomplete gamma, log gamma, logarithmic integral, Pochhammer, psi, sine integral, Spence; by Wayne Fullerton.

The original version of the library provided routines for single precision complex, single precision real, and double precision real arguments and used the prefixes "C" and "D" to indicate the complex and double precision versions.

This scheme has been modified for consistency, and also to avoid conflict with the names of functions commonly provided by various compilers. The prefixes "C4_", and "R8_" are used to indicate functions for single precision complex, and double precision real arguments. For example, the sine function can be calculated by the functions C4_SIN or R8_SIN.

The original, true, correct version of FN is available through NETLIB: https://www.netlib.org/fn/index.html.

### Languages:

fn is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

### Related Data and Programs:

c8lib, a MATLAB code which implements certain elementary functions for double precision complex variables;

clausen, a MATLAB code which evaluates a Chebyshev approximant to the Clausen function Cl2(x).

machar, a MATLAB code which computes the appropriate values of machine constants for a given machine.

legendre_polynomial, a MATLAB code which evaluates the Legendre polynomial and associated functions.

machine, a MATLAB code which stores the appropriate values of machine constants for a given machine.

r8lib, a MATLAB code which contains many utility routines, using "R8" or "double precision real" arithmetic.

test_values, a MATLAB code which supplies test values of various mathematical functions.

### Reference:

1. Wayne Fullerton,
Portable Special Function Routines,
in Portability of Numerical Software,
edited by Wayne Cowell,
Lecture Notes in Computer Science, Volume 57, pages 452-483,
Springer 1977,
ISBN: 978-3-540-08446-4,
LC: QA297.W65.

### Source Code:

• c4_cos.m, evaluates the cosine of a C4 argument.
• c4_sin.m, evaluates the sine of a C4 argument.
• i4_mach.m, returns integer machine dependent constants.
• i4_uniform_ab.m, returns a scaled pseudorandom I4.
• r8_acos.m, evaluates the arc-cosine of an R8 argument.
• r8_acosh.m, evaluates the arc-hyperbolic cosine of an R8 argument.
• r8_admp.m, modulus and phase of the derivative of the Airy function.
• r8_ai.m, evaluates the Airy function Ai of an R8 argument.
• r8_aid.m, evaluates the derivative of the Airy function Ai of an R8 argument.
• r8_aide.m, exponentially scaled derivative, Airy function Ai of an R8 argument.
• r8_aie.m, evaluates the exponentially scaled Airy function Ai of an R8 argument.
• r8_aimp.m, evaluates the modulus and phase of the Airy function.
• r8_aint.m, rounds an R8 argument towards 0.
• r8_asin.m, evaluates the arc-sine of an R8 argument.
• r8_asinh.m, evaluates the arc-sine of an R8 argument.
• r8_atan.m, evaluates the arc-tangent of an R8 argument.
• r8_atan2.m, evaluates the arc-tangent of two R8 arguments.
• r8_atanh.m, evaluates the arc-hyperbolic tangent of an R8 argument.
• r8_b0mp.m, evaluates the modulus and phase for the Bessel J0 and Y0 functions.
• r8_b1mp.m, evaluates the modulus and phase for the Bessel J1 and Y1 functions.
• r8_besi0.m, evaluates the Bessel function I of order 0 of an R8 argument.
• r8_besi0e.m, evaluates the exponentially scaled Bessel function I0(X).
• r8_besi1.m, evaluates the Bessel function I of order 1 of an R8 argument.
• r8_besi1e.m, evaluates the exponentially scaled Bessel function I1(X).
• r8_besj0.m, evaluates the Bessel function J of order 0 of an R8 argument.
• r8_besj1.m, evaluates the Bessel function J of order 1 of an R8 argument.
• r8_besk.m, evaluates the Bessel function K of order NU of an R8 argument.
• r8_besk0.m, evaluates the Bessel function K of order 0 of an R8 argument.
• r8_besk0e.m, evaluates the exponentially scaled Bessel function K0(X).
• r8_besk1.m, evaluates the Bessel function K of order 1 of an R8 argument.
• r8_besk1e.m, evaluates the exponentially scaled Bessel function K1(X).
• r8_beskes.m, evaluates a sequence of exponentially scaled K Bessel functions at X.
• r8_besks.m, evaluates a sequence of K Bessel functions at X.
• r8_besy0.m, evaluates the Bessel function Y of order 0 of an R8 argument.
• r8_besy1.m, evaluates the Bessel function Y of order 1 of an R8 argument.
• r8_beta.m, evaluates the beta function of R8 arguments.
• r8_betai.m, evaluates the incomplete beta ratio of R8 arguments.
• r8_bi.m, evaluates the Airy function Bi of an R8 argument.
• r8_bid.m, evaluates the derivative of the Airy function Bi of an R8 argument.
• r8_bide.m, exponentially scaled derivative, Airy function Bi of an R8 argument.
• r8_binom.m, evaluates the binomial coefficient using R8 arithmetic.
• r8_cbrt.m, computes the cube root of an R8.
• r8_chi.m, evaluates the hyperbolic cosine integral of an R8 argument.
• r8_chu.m, evaluates the confluent hypergeometric function of R8 arguments.
• r8_chu_scaled.m, scaled confluent hypergeometric function of R8 arguments.
• r8_ci.m, evaluates the cosine integral Ci of an R8 argument.
• r8_cin.m, evaluates the alternate cosine integral Cin of an R8 argument.
• r8_cinh.m, evaluates the alternate hyperbolic cosine integral Cinh of an R8 argument.
• r8_cos.m, evaluates the cosine of an R8 argument.
• r8_cos_deg.m, evaluates the cosine of an R8 argument in degrees.
• r8_cosh.m, evaluates the hyperbolic cosine of an R8 argument.
• r8_cot.m, evaluates the cotangent of an R8 argument.
• r8_csevl.m, evaluates a Chebyshev series.
• r8_dawson.m, evaluates Dawson's integral of an R8 argument.
• r8_e1.m, evaluates the exponential integral E1 for an R8 argument.
• r8_ei.m, evaluates the exponential integral Ei for an R8 argument.
• r8_erf.m, evaluates the error function of an R8 argument.
• r8_erfc.m, evaluates the co-error function of an R8 argument.
• r8_exp.m, evaluates the exponential of an R8 argument.
• r8_exprel.m, evaluates the exponential relative error term of an R8 argument.
• r8_fac.m, evaluates the factorial of an I4 argument.
• r8_gami.m, evaluates the incomplete gamma function for an R8 argument.
• r8_gamic.m, evaluates the complementary incomplete gamma function.
• r8_gamit.m, evaluates Tricomi's incomplete gamma function for an R8 argument.
• r8_gaml.m, evaluates bounds for an R8 argument of the gamma function.
• r8_gamma.m, evaluates the gamma function of an R8 argument.
• r8_gamr.m, evaluates the reciprocal gamma function of an R8 argument.
• r8_gmic.m, complementary incomplete gamma, small X, A near negative integer.
• r8_gmit.m, Tricomi's incomplete gamma function for small X.
• r8_inits.m, initializes a Chebyshev series.
• r8_int.m, returns the integer part of an R8 argument.
• r8_knus.m, computes a sequence of K Bessel functions.
• r8_lbeta.m, evaluates the logarithm of the beta function of R8 arguments.
• r8_lgams.m, evaluates the log of |gamma(x)| and sign, for an R8 argument.
• r8_lgic.m, evaluates the log complementary incomplete gamma function for large X.
• r8_lgit.m, evaluates the log of Tricomi's incomplete gamma function.
• r8_lgmc.m, evaluates the log gamma correction factor for an R8 argument.
• r8_li.m, evaluates the logarithmic integral for an R8 argument.
• r8_lngam.m, evaluates the log of the absolute value of gamma of an R8 argument.
• r8_lnrel.m, evaluates log ( 1 + X ) for an R8 argument.
• r8_log.m, evaluates the logarithm of an R8.
• r8_log10.m, evaluates the logarithm, base 10, of an R8.
• r8_mach.m, returns double precision real machine-dependent constants.
• r8_machar.m, determines double precision machine constants.
• r8_mop.m, evaluates -1 to an integer power.
• r8_pak.m, packs a base 2 exponent and mantissa into an R8.
• r8_poch.m, evaluates Pochhammer's function of R8 arguments.
• r8_poch1.m, evaluates a quantity related to Pochhammer's symbol.
• r8_power.m, returns a power, x^y.
• r8_psi.m, evaluates the psi function of an R8 argument.
• r8_rand.m, is a portable pseudorandom number generator.
• r8_randgs.m, generates a normally distributed random number.
• r8_random.m, is a portable pseudorandom number generator.
• r8_ren.m, is a simple random number generator.
• r8_shi.m, evaluates the hyperbolic sine integral Shi of an R8 argument.
• r8_si.m, evaluates the sine integral Si of an R8 argument.
• r8_sifg.m, is a utility routine.
• r8_sign.m, evaluates the sign of an R8 argument.
• r8_sin.m, evaluates the sine of an R8 argument.
• r8_sin_deg.m, evaluates the sine of an R8 argument in degrees.
• r8_sinh.m, evaluates the hyperbolic sine of an R8 argument.
• r8_spence.m, evaluates a form of Spence's function for an R8 argument.
• r8_sqrt.m, computes the square root of an R8.
• r8_tan.m, evaluates the tangent of an R8 argument.
• r8_tanh.m, evaluates the hyperbolic tangent of an R8 argument.
• r8_upak.m, unpacks an R8 into a mantissa and exponent.

Last revised on 18 January 2019.