summaryrefslogtreecommitdiff
path: root/gsl-1.9/specfunc/psi.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-08 17:33:11 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-08 17:33:11 +0000
commit73f643f3f4a55310b2c8c1a9858906b2dd676e72 (patch)
treeb1df97f18dace4a5702b0bc7aafdfee8a2f25ada /gsl-1.9/specfunc/psi.c
parentee523abdace8337d05ec4a179fcdf5de3fe0f634 (diff)
2011-04-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* AUTHORS, BUGS, COPYING, ChangeLog, INSTALL, Makefile.am, Makefile.in, NEWS, README, SUPPORT, THANKS, TODO, acconfig.h, aclocal.m4, autogen.sh, config.guess, config.h.in, config.sub, configure, configure.ac, gsl-config.in, gsl-histogram.c, gsl-randist.c, gsl.m4, gsl.pc.in, gsl.spec.in, gsl_machine.h, gsl_math.h, gsl_mode.h, gsl_nan.h, gsl_pow_int.h, gsl_precision.h, gsl_types.h, gsl_version.h.in, install-sh, ltmain.sh, mdate-sh, missing, mkinstalldirs, templates_off.h, templates_on.h, test_gsl_histogram.sh, version.c, blas/ChangeLog, blas/Makefile.am, blas/Makefile.in, blas/TODO, blas/blas.c, blas/gsl_blas.h, blas/gsl_blas_types.h, block/ChangeLog, block/Makefile.am, block/Makefile.in, block/block.c, block/block_source.c, block/file.c, block/fprintf_source.c, block/fwrite_source.c, block/gsl_block.h, block/gsl_block_char.h, block/gsl_block_complex_double.h, block/gsl_block_complex_float.h, block/gsl_block_complex_long_double.h, block/gsl_block_double.h, block/gsl_block_float.h, block/gsl_block_int.h, block/gsl_block_long.h, block/gsl_block_long_double.h, block/gsl_block_short.h, block/gsl_block_uchar.h, block/gsl_block_uint.h, block/gsl_block_ulong.h, block/gsl_block_ushort.h, block/gsl_check_range.h, block/init.c, block/init_source.c, block/test.c, block/test_complex_io.c, block/test_complex_source.c, block/test_io.c, block/test_source.c, bspline/ChangeLog, bspline/Makefile.am, bspline/Makefile.in, bspline/TODO, bspline/bspline.c, bspline/gsl_bspline.h, bspline/test.c, cblas/ChangeLog, cblas/Makefile.am, cblas/Makefile.in, cblas/TODO, cblas/caxpy.c, cblas/cblas.h, cblas/ccopy.c, cblas/cdotc_sub.c, cblas/cdotu_sub.c, cblas/cgbmv.c, cblas/cgemm.c, cblas/cgemv.c, cblas/cgerc.c, cblas/cgeru.c, cblas/chbmv.c, cblas/chemm.c, cblas/chemv.c, cblas/cher.c, cblas/cher2.c, cblas/cher2k.c, cblas/cherk.c, cblas/chpmv.c, cblas/chpr.c, cblas/chpr2.c, cblas/cscal.c, cblas/csscal.c, cblas/cswap.c, cblas/csymm.c, cblas/csyr2k.c, cblas/csyrk.c, cblas/ctbmv.c, cblas/ctbsv.c, cblas/ctpmv.c, cblas/ctpsv.c, cblas/ctrmm.c, cblas/ctrmv.c, cblas/ctrsm.c, cblas/ctrsv.c, cblas/dasum.c, cblas/daxpy.c, cblas/dcopy.c, cblas/ddot.c, cblas/dgbmv.c, cblas/dgemm.c, cblas/dgemv.c, cblas/dger.c, cblas/dnrm2.c, cblas/drot.c, cblas/drotg.c, cblas/drotm.c, cblas/drotmg.c, cblas/dsbmv.c, cblas/dscal.c, cblas/dsdot.c, cblas/dspmv.c, cblas/dspr.c, cblas/dspr2.c, cblas/dswap.c, cblas/dsymm.c, cblas/dsymv.c, cblas/dsyr.c, cblas/dsyr2.c, cblas/dsyr2k.c, cblas/dsyrk.c, cblas/dtbmv.c, cblas/dtbsv.c, cblas/dtpmv.c, cblas/dtpsv.c, cblas/dtrmm.c, cblas/dtrmv.c, cblas/dtrsm.c, cblas/dtrsv.c, cblas/dzasum.c, cblas/dznrm2.c, cblas/gsl_cblas.h, cblas/hypot.c, cblas/icamax.c, cblas/idamax.c, cblas/isamax.c, cblas/izamax.c, cblas/sasum.c, cblas/saxpy.c, cblas/scasum.c, cblas/scnrm2.c, cblas/scopy.c, cblas/sdot.c, cblas/sdsdot.c, cblas/sgbmv.c, cblas/sgemm.c, cblas/sgemv.c, cblas/sger.c, cblas/snrm2.c, cblas/source_asum_c.h, cblas/source_asum_r.h, cblas/source_axpy_c.h, cblas/source_axpy_r.h, cblas/source_copy_c.h, cblas/source_copy_r.h, cblas/source_dot_c.h, cblas/source_dot_r.h, cblas/source_gbmv_c.h, cblas/source_gbmv_r.h, cblas/source_gemm_c.h, cblas/source_gemm_r.h, cblas/source_gemv_c.h, cblas/source_gemv_r.h, cblas/source_ger.h, cblas/source_gerc.h, cblas/source_geru.h, cblas/source_hbmv.h, cblas/source_hemm.h, cblas/source_hemv.h, cblas/source_her.h, cblas/source_her2.h, cblas/source_her2k.h, cblas/source_herk.h, cblas/source_hpmv.h, cblas/source_hpr.h, cblas/source_hpr2.h, cblas/source_iamax_c.h, cblas/source_iamax_r.h, cblas/source_nrm2_c.h, cblas/source_nrm2_r.h, cblas/source_rot.h, cblas/source_rotg.h, cblas/source_rotm.h, cblas/source_rotmg.h, cblas/source_sbmv.h, cblas/source_scal_c.h, cblas/source_scal_c_s.h, cblas/source_scal_r.h, cblas/source_spmv.h, cblas/source_spr.h, cblas/source_spr2.h, cblas/source_swap_c.h, cblas/source_swap_r.h, cblas/source_symm_c.h, cblas/source_symm_r.h, cblas/source_symv.h, cblas/source_syr.h, cblas/source_syr2.h, cblas/source_syr2k_c.h, cblas/source_syr2k_r.h, cblas/source_syrk_c.h, cblas/source_syrk_r.h, cblas/source_tbmv_c.h, cblas/source_tbmv_r.h, cblas/source_tbsv_c.h, cblas/source_tbsv_r.h, cblas/source_tpmv_c.h, cblas/source_tpmv_r.h, cblas/source_tpsv_c.h, cblas/source_tpsv_r.h, cblas/source_trmm_c.h, cblas/source_trmm_r.h, cblas/source_trmv_c.h, cblas/source_trmv_r.h, cblas/source_trsm_c.h, cblas/source_trsm_r.h, cblas/source_trsv_c.h, cblas/source_trsv_r.h, cblas/srot.c, cblas/srotg.c, cblas/srotm.c, cblas/srotmg.c, cblas/ssbmv.c, cblas/sscal.c, cblas/sspmv.c, cblas/sspr.c, cblas/sspr2.c, cblas/sswap.c, cblas/ssymm.c, cblas/ssymv.c, cblas/ssyr.c, cblas/ssyr2.c, cblas/ssyr2k.c, cblas/ssyrk.c, cblas/stbmv.c, cblas/stbsv.c, cblas/stpmv.c, cblas/stpsv.c, cblas/strmm.c, cblas/strmv.c, cblas/strsm.c, cblas/strsv.c, cblas/test.c, cblas/test_amax.c, cblas/test_asum.c, cblas/test_axpy.c, cblas/test_copy.c, cblas/test_dot.c, cblas/test_gbmv.c, cblas/test_gemm.c, cblas/test_gemv.c, cblas/test_ger.c, cblas/test_hbmv.c, cblas/test_hemm.c, cblas/test_hemv.c, cblas/test_her.c, cblas/test_her2.c, cblas/test_her2k.c, cblas/test_herk.c, cblas/test_hpmv.c, cblas/test_hpr.c, cblas/test_hpr2.c, cblas/test_nrm2.c, cblas/test_rot.c, cblas/test_rotg.c, cblas/test_rotm.c, cblas/test_rotmg.c, cblas/test_sbmv.c, cblas/test_scal.c, cblas/test_spmv.c, cblas/test_spr.c, cblas/test_spr2.c, cblas/test_swap.c, cblas/test_symm.c, cblas/test_symv.c, cblas/test_syr.c, cblas/test_syr2.c, cblas/test_syr2k.c, cblas/test_syrk.c, cblas/test_tbmv.c, cblas/test_tbsv.c, cblas/test_tpmv.c, cblas/test_tpsv.c, cblas/test_trmm.c, cblas/test_trmv.c, cblas/test_trsm.c, cblas/test_trsv.c, cblas/tests.c, cblas/tests.h, cblas/xerbla.c, cblas/zaxpy.c, cblas/zcopy.c, cblas/zdotc_sub.c, cblas/zdotu_sub.c, cblas/zdscal.c, cblas/zgbmv.c, cblas/zgemm.c, cblas/zgemv.c, cblas/zgerc.c, cblas/zgeru.c, cblas/zhbmv.c, cblas/zhemm.c, cblas/zhemv.c, cblas/zher.c, cblas/zher2.c, cblas/zher2k.c, cblas/zherk.c, cblas/zhpmv.c, cblas/zhpr.c, cblas/zhpr2.c, cblas/zscal.c, cblas/zswap.c, cblas/zsymm.c, cblas/zsyr2k.c, cblas/zsyrk.c, cblas/ztbmv.c, cblas/ztbsv.c, cblas/ztpmv.c, cblas/ztpsv.c, cblas/ztrmm.c, cblas/ztrmv.c, cblas/ztrsm.c, cblas/ztrsv.c, cdf/ChangeLog, cdf/Makefile.am, cdf/Makefile.in, cdf/beta.c, cdf/beta_inc.c, cdf/betainv.c, cdf/binomial.c, cdf/cauchy.c, cdf/cauchyinv.c, cdf/chisq.c, cdf/chisqinv.c, cdf/error.h, cdf/exponential.c, cdf/exponentialinv.c, cdf/exppow.c, cdf/fdist.c, cdf/fdistinv.c, cdf/flat.c, cdf/flatinv.c, cdf/gamma.c, cdf/gammainv.c, cdf/gauss.c, cdf/gaussinv.c, cdf/geometric.c, cdf/gsl_cdf.h, cdf/gumbel1.c, cdf/gumbel1inv.c, cdf/gumbel2.c, cdf/gumbel2inv.c, cdf/hypergeometric.c, cdf/laplace.c, cdf/laplaceinv.c, cdf/logistic.c, cdf/logisticinv.c, cdf/lognormal.c, cdf/lognormalinv.c, cdf/nbinomial.c, cdf/pareto.c, cdf/paretoinv.c, cdf/pascal.c, cdf/poisson.c, cdf/rat_eval.h, cdf/rayleigh.c, cdf/rayleighinv.c, cdf/tdist.c, cdf/tdistinv.c, cdf/test.c, cdf/test_auto.c, cdf/weibull.c, cdf/weibullinv.c, cheb/ChangeLog, cheb/Makefile.am, cheb/Makefile.in, cheb/deriv.c, cheb/eval.c, cheb/gsl_chebyshev.h, cheb/init.c, cheb/integ.c, cheb/test.c, combination/ChangeLog, combination/Makefile.am, combination/Makefile.in, combination/combination.c, combination/file.c, combination/gsl_combination.h, combination/init.c, combination/test.c, complex/ChangeLog, complex/Makefile.am, complex/Makefile.in, complex/TODO, complex/gsl_complex.h, complex/gsl_complex_math.h, complex/math.c, complex/results.h, complex/results1.h, complex/results_real.h, complex/test.c, const/ChangeLog, const/Makefile.am, const/Makefile.in, const/TODO, const/gsl_const.h, const/gsl_const_cgs.h, const/gsl_const_cgsm.h, const/gsl_const_mks.h, const/gsl_const_mksa.h, const/gsl_const_num.h, const/test.c, deriv/ChangeLog, deriv/Makefile.am, deriv/Makefile.in, deriv/deriv.c, deriv/gsl_deriv.h, deriv/test.c, dht/ChangeLog, dht/Makefile.am, dht/Makefile.in, dht/dht.c, dht/gsl_dht.h, dht/test.c, diff/ChangeLog, diff/Makefile.am, diff/Makefile.in, diff/diff.c, diff/gsl_diff.h, diff/test.c, doc/12-cities.eps, doc/ChangeLog, doc/Makefile.am, doc/Makefile.in, doc/algorithm.sty, doc/algorithmic.sty, doc/autoconf.texi, doc/blas.texi, doc/bspline.eps, doc/bspline.texi, doc/calc.sty, doc/cblas.texi, doc/cheb.eps, doc/cheb.texi, doc/combination.texi, doc/complex.texi, doc/const.texi, doc/debug.texi, doc/dht.texi, doc/diff.texi, doc/dwt-orig.eps, doc/dwt-samp.eps, doc/dwt.texi, doc/eigen.texi, doc/err.texi, doc/fdl.texi, doc/fft-complex-radix2-f.eps, doc/fft-complex-radix2-t.eps, doc/fft-complex-radix2.eps, doc/fft-real-mixedradix.eps, doc/fft.texi, doc/fftalgorithms.bib, doc/fftalgorithms.tex, doc/final-route.eps, doc/fit-exp.eps, doc/fit-wlinear.eps, doc/fit-wlinear2.eps, doc/fitting.texi, doc/freemanuals.texi, doc/gpl.texi, doc/gsl-config.1, doc/gsl-design.texi, doc/gsl-histogram.1, doc/gsl-randist.1, doc/gsl-ref.info, doc/gsl-ref.info-1, doc/gsl-ref.info-2, doc/gsl-ref.info-3, doc/gsl-ref.info-4, doc/gsl-ref.info-5, doc/gsl-ref.info-6, doc/gsl-ref.texi, doc/gsl.3, doc/histogram.eps, doc/histogram.texi, doc/histogram2d.eps, doc/ieee754.texi, doc/initial-route.eps, doc/integration.texi, doc/interp.texi, doc/interp2.eps, doc/interpp2.eps, doc/intro.texi, doc/landau.dat, doc/linalg.texi, doc/math.texi, doc/mdate-sh, doc/min-interval.eps, doc/min.texi, doc/montecarlo.texi, doc/multifit.texi, doc/multimin.eps, doc/multimin.texi, doc/multiroots.texi, doc/ntuple.eps, doc/ntuple.texi, doc/ode-initval.texi, doc/permutation.texi, doc/poly.texi, doc/qrng.eps, doc/qrng.texi, doc/rand-bernoulli.tex, doc/rand-beta.tex, doc/rand-binomial.tex, doc/rand-bivariate-gaussian.tex, doc/rand-cauchy.tex, doc/rand-chisq.tex, doc/rand-erlang.tex, doc/rand-exponential.tex, doc/rand-exppow.tex, doc/rand-fdist.tex, doc/rand-flat.tex, doc/rand-gamma.tex, doc/rand-gaussian-tail.tex, doc/rand-gaussian.tex, doc/rand-geometric.tex, doc/rand-gumbel.tex, doc/rand-gumbel1.tex, doc/rand-gumbel2.tex, doc/rand-hypergeometric.tex, doc/rand-landau.tex, doc/rand-laplace.tex, doc/rand-levy.tex, doc/rand-levyskew.tex, doc/rand-logarithmic.tex, doc/rand-logistic.tex, doc/rand-lognormal.tex, doc/rand-nbinomial.tex, doc/rand-pareto.tex, doc/rand-pascal.tex, doc/rand-poisson.tex, doc/rand-rayleigh-tail.tex, doc/rand-rayleigh.tex, doc/rand-tdist.tex, doc/rand-weibull.tex, doc/randist.texi, doc/random-walk.tex, doc/randplots.gnp, doc/rng.texi, doc/roots-bisection.eps, doc/roots-false-position.eps, doc/roots-newtons-method.eps, doc/roots-secant-method.eps, doc/roots.texi, doc/siman-energy.eps, doc/siman-test.eps, doc/siman.texi, doc/sort.texi, doc/specfunc-airy.texi, doc/specfunc-bessel.texi, doc/specfunc-clausen.texi, doc/specfunc-coulomb.texi, doc/specfunc-coupling.texi, doc/specfunc-dawson.texi, doc/specfunc-debye.texi, doc/specfunc-dilog.texi, doc/specfunc-elementary.texi, doc/specfunc-ellint.texi, doc/specfunc-elljac.texi, doc/specfunc-erf.texi, doc/specfunc-exp.texi, doc/specfunc-expint.texi, doc/specfunc-fermi-dirac.texi, doc/specfunc-gamma.texi, doc/specfunc-gegenbauer.texi, doc/specfunc-hyperg.texi, doc/specfunc-laguerre.texi, doc/specfunc-lambert.texi, doc/specfunc-legendre.texi, doc/specfunc-log.texi, doc/specfunc-mathieu.texi, doc/specfunc-pow-int.texi, doc/specfunc-psi.texi, doc/specfunc-synchrotron.texi, doc/specfunc-transport.texi, doc/specfunc-trig.texi, doc/specfunc-zeta.texi, doc/specfunc.texi, doc/stamp-vti, doc/statistics.texi, doc/sum.texi, doc/texinfo.tex, doc/usage.texi, doc/vdp.eps, doc/vectors.texi, doc/version-ref.texi, doc/examples/blas.c, doc/examples/blas.out, doc/examples/block.c, doc/examples/block.out, doc/examples/bspline.c, doc/examples/cblas.c, doc/examples/cblas.out, doc/examples/cdf.c, doc/examples/cdf.out, doc/examples/cheb.c, doc/examples/combination.c, doc/examples/combination.out, doc/examples/const.c, doc/examples/const.out, doc/examples/demo_fn.c, doc/examples/demo_fn.h, doc/examples/diff.c, doc/examples/diff.out, doc/examples/dwt.c, doc/examples/dwt.dat, doc/examples/ecg.dat, doc/examples/eigen.c, doc/examples/eigen_nonsymm.c, doc/examples/expfit.c, doc/examples/fft.c, doc/examples/fftmr.c, doc/examples/fftreal.c, doc/examples/fitting.c, doc/examples/fitting2.c, doc/examples/fitting3.c, doc/examples/histogram.c, doc/examples/histogram2d.c, doc/examples/ieee.c, doc/examples/ieeeround.c, doc/examples/integration.c, doc/examples/integration.out, doc/examples/interp.c, doc/examples/interpp.c, doc/examples/intro.c, doc/examples/intro.out, doc/examples/linalglu.c, doc/examples/linalglu.out, doc/examples/matrix.c, doc/examples/matrixw.c, doc/examples/min.c, doc/examples/min.out, doc/examples/monte.c, doc/examples/nlfit.c, doc/examples/ntupler.c, doc/examples/ntuplew.c, doc/examples/ode-initval.c, doc/examples/odefixed.c, doc/examples/permseq.c, doc/examples/permshuffle.c, doc/examples/polyroots.c, doc/examples/polyroots.out, doc/examples/qrng.c, doc/examples/randpoisson.2.out, doc/examples/randpoisson.c, doc/examples/randpoisson.out, doc/examples/randwalk.c, doc/examples/rng.c, doc/examples/rng.out, doc/examples/rngunif.2.out, doc/examples/rngunif.c, doc/examples/rngunif.out, doc/examples/rootnewt.c, doc/examples/roots.c, doc/examples/siman.c, doc/examples/sortsmall.c, doc/examples/sortsmall.out, doc/examples/specfun.c, doc/examples/specfun.out, doc/examples/specfun_e.c, doc/examples/specfun_e.out, doc/examples/stat.c, doc/examples/stat.out, doc/examples/statsort.c, doc/examples/statsort.out, doc/examples/sum.c, doc/examples/sum.out, doc/examples/vector.c, doc/examples/vectorr.c, doc/examples/vectorview.c, doc/examples/vectorview.out, doc/examples/vectorw.c, eigen/ChangeLog, eigen/Makefile.am, eigen/Makefile.in, eigen/TODO, eigen/francis.c, eigen/gsl_eigen.h, eigen/herm.c, eigen/hermv.c, eigen/jacobi.c, eigen/nonsymm.c, eigen/nonsymmv.c, eigen/qrstep.c, eigen/schur.c, eigen/schur.h, eigen/sort.c, eigen/symm.c, eigen/symmv.c, eigen/test.c, err/ChangeLog, err/Makefile.am, err/Makefile.in, err/TODO, err/error.c, err/gsl_errno.h, err/gsl_message.h, err/message.c, err/stream.c, err/strerror.c, err/test.c, fft/ChangeLog, fft/Makefile.am, fft/Makefile.in, fft/TODO, fft/bitreverse.c, fft/bitreverse.h, fft/c_init.c, fft/c_main.c, fft/c_pass.h, fft/c_pass_2.c, fft/c_pass_3.c, fft/c_pass_4.c, fft/c_pass_5.c, fft/c_pass_6.c, fft/c_pass_7.c, fft/c_pass_n.c, fft/c_radix2.c, fft/compare.h, fft/compare_source.c, fft/complex_internal.h, fft/dft.c, fft/dft_source.c, fft/factorize.c, fft/factorize.h, fft/fft.c, fft/gsl_dft_complex.h, fft/gsl_dft_complex_float.h, fft/gsl_fft.h, fft/gsl_fft_complex.h, fft/gsl_fft_complex_float.h, fft/gsl_fft_halfcomplex.h, fft/gsl_fft_halfcomplex_float.h, fft/gsl_fft_real.h, fft/gsl_fft_real_float.h, fft/hc_init.c, fft/hc_main.c, fft/hc_pass.h, fft/hc_pass_2.c, fft/hc_pass_3.c, fft/hc_pass_4.c, fft/hc_pass_5.c, fft/hc_pass_n.c, fft/hc_radix2.c, fft/hc_unpack.c, fft/real_init.c, fft/real_main.c, fft/real_pass.h, fft/real_pass_2.c, fft/real_pass_3.c, fft/real_pass_4.c, fft/real_pass_5.c, fft/real_pass_n.c, fft/real_radix2.c, fft/real_unpack.c, fft/signals.c, fft/signals.h, fft/signals_source.c, fft/test.c, fft/test_complex_source.c, fft/test_real_source.c, fft/test_trap_source.c, fft/urand.c, fit/ChangeLog, fit/Makefile.am, fit/Makefile.in, fit/gsl_fit.h, fit/linear.c, fit/test.c, gsl/Makefile.am, gsl/Makefile.in, histogram/ChangeLog, histogram/Makefile.am, histogram/Makefile.in, histogram/TODO, histogram/add.c, histogram/add2d.c, histogram/calloc_range.c, histogram/calloc_range2d.c, histogram/copy.c, histogram/copy2d.c, histogram/file.c, histogram/file2d.c, histogram/find.c, histogram/find2d.c, histogram/get.c, histogram/get2d.c, histogram/gsl_histogram.h, histogram/gsl_histogram2d.h, histogram/init.c, histogram/init2d.c, histogram/maxval.c, histogram/maxval2d.c, histogram/oper.c, histogram/oper2d.c, histogram/params.c, histogram/params2d.c, histogram/pdf.c, histogram/pdf2d.c, histogram/reset.c, histogram/reset2d.c, histogram/stat.c, histogram/stat2d.c, histogram/test.c, histogram/test1d.c, histogram/test1d_resample.c, histogram/test1d_trap.c, histogram/test2d.c, histogram/test2d_resample.c, histogram/test2d_trap.c, histogram/urand.c, ieee-utils/ChangeLog, ieee-utils/Makefile.am, ieee-utils/Makefile.in, ieee-utils/TODO, ieee-utils/endian.c, ieee-utils/env.c, ieee-utils/fp-aix.c, ieee-utils/fp-darwin.c, ieee-utils/fp-darwin86.c, ieee-utils/fp-freebsd.c, ieee-utils/fp-gnuc99.c, ieee-utils/fp-gnum68k.c, ieee-utils/fp-gnuppc.c, ieee-utils/fp-gnusparc.c, ieee-utils/fp-gnux86.c, ieee-utils/fp-hpux.c, ieee-utils/fp-hpux11.c, ieee-utils/fp-irix.c, ieee-utils/fp-netbsd.c, ieee-utils/fp-openbsd.c, ieee-utils/fp-os2emx.c, ieee-utils/fp-solaris.c, ieee-utils/fp-sunos4.c, ieee-utils/fp-tru64.c, ieee-utils/fp-unknown.c, ieee-utils/fp.c, ieee-utils/gsl_ieee_utils.h, ieee-utils/make_rep.c, ieee-utils/print.c, ieee-utils/read.c, ieee-utils/standardize.c, ieee-utils/test.c, integration/ChangeLog, integration/Makefile.am, integration/Makefile.in, integration/TODO, integration/append.c, integration/err.c, integration/gsl_integration.h, integration/initialise.c, integration/positivity.c, integration/ptsort.c, integration/qag.c, integration/qagp.c, integration/qags.c, integration/qawc.c, integration/qawf.c, integration/qawo.c, integration/qaws.c, integration/qc25c.c, integration/qc25f.c, integration/qc25s.c, integration/qcheb.c, integration/qelg.c, integration/qk.c, integration/qk15.c, integration/qk21.c, integration/qk31.c, integration/qk41.c, integration/qk51.c, integration/qk61.c, integration/qmomo.c, integration/qmomof.c, integration/qng.c, integration/qng.h, integration/qpsrt.c, integration/qpsrt2.c, integration/reset.c, integration/set_initial.c, integration/test.c, integration/tests.c, integration/tests.h, integration/util.c, integration/workspace.c, interpolation/ChangeLog, interpolation/Makefile.am, interpolation/Makefile.in, interpolation/TODO, interpolation/accel.c, interpolation/akima.c, interpolation/bsearch.c, interpolation/bsearch.h, interpolation/cspline.c, interpolation/gsl_interp.h, interpolation/gsl_spline.h, interpolation/integ_eval.h, interpolation/interp.c, interpolation/linear.c, interpolation/poly.c, interpolation/spline.c, interpolation/test.c, linalg/ChangeLog, linalg/Makefile.am, linalg/Makefile.in, linalg/TODO, linalg/apply_givens.c, linalg/balance.c, linalg/balancemat.c, linalg/bidiag.c, linalg/cholesky.c, linalg/exponential.c, linalg/givens.c, linalg/gsl_linalg.h, linalg/hermtd.c, linalg/hessenberg.c, linalg/hh.c, linalg/householder.c, linalg/householdercomplex.c, linalg/lq.c, linalg/lu.c, linalg/luc.c, linalg/multiply.c, linalg/ptlq.c, linalg/qr.c, linalg/qrpt.c, linalg/svd.c, linalg/svdstep.c, linalg/symmtd.c, linalg/test.c, linalg/tridiag.c, linalg/tridiag.h, matrix/ChangeLog, matrix/Makefile.am, matrix/Makefile.in, matrix/TODO, matrix/copy.c, matrix/copy_source.c, matrix/file.c, matrix/file_source.c, matrix/getset.c, matrix/getset_source.c, matrix/gsl_matrix.h, matrix/gsl_matrix_char.h, matrix/gsl_matrix_complex_double.h, matrix/gsl_matrix_complex_float.h, matrix/gsl_matrix_complex_long_double.h, matrix/gsl_matrix_double.h, matrix/gsl_matrix_float.h, matrix/gsl_matrix_int.h, matrix/gsl_matrix_long.h, matrix/gsl_matrix_long_double.h, matrix/gsl_matrix_short.h, matrix/gsl_matrix_uchar.h, matrix/gsl_matrix_uint.h, matrix/gsl_matrix_ulong.h, matrix/gsl_matrix_ushort.h, matrix/init.c, matrix/init_source.c, matrix/matrix.c, matrix/matrix_source.c, matrix/minmax.c, matrix/minmax_source.c, matrix/oper.c, matrix/oper_complex_source.c, matrix/oper_source.c, matrix/prop.c, matrix/prop_source.c, matrix/rowcol.c, matrix/rowcol_source.c, matrix/submatrix.c, matrix/submatrix_source.c, matrix/swap.c, matrix/swap_source.c, matrix/test.c, matrix/test_complex_source.c, matrix/test_source.c, matrix/test_static.c, matrix/view.c, matrix/view.h, matrix/view_source.c, min/ChangeLog, min/Makefile.am, min/Makefile.in, min/bracketing.c, min/brent.c, min/convergence.c, min/fsolver.c, min/golden.c, min/gsl_min.h, min/min.h, min/test.c, min/test.h, min/test_funcs.c, monte/ChangeLog, monte/Makefile.am, monte/Makefile.in, monte/README, monte/TODO, monte/gsl_monte.h, monte/gsl_monte_miser.h, monte/gsl_monte_plain.h, monte/gsl_monte_vegas.h, monte/miser.c, monte/plain.c, monte/test.c, monte/test_main.c, monte/vegas.c, multifit/ChangeLog, multifit/Makefile.am, multifit/Makefile.in, multifit/TODO, multifit/convergence.c, multifit/covar.c, multifit/fdfsolver.c, multifit/fsolver.c, multifit/gradient.c, multifit/gsl_multifit.h, multifit/gsl_multifit_nlin.h, multifit/lmder.c, multifit/lmiterate.c, multifit/lmpar.c, multifit/lmset.c, multifit/lmutil.c, multifit/multilinear.c, multifit/qrsolv.c, multifit/test.c, multifit/test_brown.c, multifit/test_enso.c, multifit/test_estimator.c, multifit/test_filip.c, multifit/test_fn.c, multifit/test_hahn1.c, multifit/test_kirby2.c, multifit/test_longley.c, multifit/test_nelson.c, multifit/test_pontius.c, multifit/work.c, multimin/ChangeLog, multimin/Makefile.am, multimin/Makefile.in, multimin/TODO, multimin/conjugate_fr.c, multimin/conjugate_pr.c, multimin/convergence.c, multimin/diff.c, multimin/directional_minimize.c, multimin/fdfminimizer.c, multimin/fminimizer.c, multimin/gsl_multimin.h, multimin/linear_minimize.c, multimin/linear_wrapper.c, multimin/simplex.c, multimin/steepest_descent.c, multimin/test.c, multimin/test_funcs.c, multimin/test_funcs.h, multimin/vector_bfgs.c, multimin/vector_bfgs2.c, multiroots/ChangeLog, multiroots/Makefile.am, multiroots/Makefile.in, multiroots/broyden.c, multiroots/convergence.c, multiroots/dnewton.c, multiroots/dogleg.c, multiroots/enorm.c, multiroots/fdfsolver.c, multiroots/fdjac.c, multiroots/fsolver.c, multiroots/gnewton.c, multiroots/gsl_multiroots.h, multiroots/hybrid.c, multiroots/hybridj.c, multiroots/newton.c, multiroots/test.c, multiroots/test_funcs.c, multiroots/test_funcs.h, ntuple/ChangeLog, ntuple/Makefile.am, ntuple/Makefile.in, ntuple/gsl_ntuple.h, ntuple/ntuple.c, ntuple/test.c, ode-initval/ChangeLog, ode-initval/Makefile.am, ode-initval/Makefile.in, ode-initval/TODO, ode-initval/bsimp.c, ode-initval/control.c, ode-initval/cscal.c, ode-initval/cstd.c, ode-initval/evolve.c, ode-initval/gear1.c, ode-initval/gear2.c, ode-initval/gsl_odeiv.h, ode-initval/odeiv_util.h, ode-initval/rk2.c, ode-initval/rk2imp.c, ode-initval/rk2simp.c, ode-initval/rk4.c, ode-initval/rk4imp.c, ode-initval/rk8pd.c, ode-initval/rkck.c, ode-initval/rkf45.c, ode-initval/step.c, ode-initval/test.c, permutation/ChangeLog, permutation/Makefile.am, permutation/Makefile.in, permutation/canonical.c, permutation/file.c, permutation/gsl_permutation.h, permutation/gsl_permute.h, permutation/gsl_permute_char.h, permutation/gsl_permute_complex_double.h, permutation/gsl_permute_complex_float.h, permutation/gsl_permute_complex_long_double.h, permutation/gsl_permute_double.h, permutation/gsl_permute_float.h, permutation/gsl_permute_int.h, permutation/gsl_permute_long.h, permutation/gsl_permute_long_double.h, permutation/gsl_permute_short.h, permutation/gsl_permute_uchar.h, permutation/gsl_permute_uint.h, permutation/gsl_permute_ulong.h, permutation/gsl_permute_ushort.h, permutation/gsl_permute_vector.h, permutation/gsl_permute_vector_char.h, permutation/gsl_permute_vector_complex_double.h, permutation/gsl_permute_vector_complex_float.h, permutation/gsl_permute_vector_complex_long_double.h, permutation/gsl_permute_vector_double.h, permutation/gsl_permute_vector_float.h, permutation/gsl_permute_vector_int.h, permutation/gsl_permute_vector_long.h, permutation/gsl_permute_vector_long_double.h, permutation/gsl_permute_vector_short.h, permutation/gsl_permute_vector_uchar.h, permutation/gsl_permute_vector_uint.h, permutation/gsl_permute_vector_ulong.h, permutation/gsl_permute_vector_ushort.h, permutation/init.c, permutation/permutation.c, permutation/permute.c, permutation/permute_source.c, permutation/test.c, poly/ChangeLog, poly/Makefile.am, poly/Makefile.in, poly/TODO, poly/balance.c, poly/companion.c, poly/dd.c, poly/eval.c, poly/gsl_poly.h, poly/qr.c, poly/solve_cubic.c, poly/solve_quadratic.c, poly/test.c, poly/zsolve.c, poly/zsolve_cubic.c, poly/zsolve_init.c, poly/zsolve_quadratic.c, qrng/ChangeLog, qrng/Makefile.am, qrng/Makefile.in, qrng/TODO, qrng/gsl_qrng.h, qrng/niederreiter-2.c, qrng/qrng.c, qrng/sobol.c, qrng/test.c, randist/ChangeLog, randist/Makefile.am, randist/Makefile.in, randist/TODO, randist/bernoulli.c, randist/beta.c, randist/bigauss.c, randist/binomial.c, randist/binomial_tpe.c, randist/cauchy.c, randist/chisq.c, randist/dirichlet.c, randist/discrete.c, randist/erlang.c, randist/exponential.c, randist/exppow.c, randist/fdist.c, randist/flat.c, randist/gamma.c, randist/gauss.c, randist/gausstail.c, randist/gausszig.c, randist/geometric.c, randist/gsl_randist.h, randist/gumbel.c, randist/hyperg.c, randist/landau.c, randist/laplace.c, randist/levy.c, randist/logarithmic.c, randist/logistic.c, randist/lognormal.c, randist/multinomial.c, randist/nbinomial.c, randist/pareto.c, randist/pascal.c, randist/poisson.c, randist/rayleigh.c, randist/shuffle.c, randist/sphere.c, randist/tdist.c, randist/test.c, randist/weibull.c, rng/ChangeLog, rng/Makefile.am, rng/Makefile.in, rng/TODO, rng/borosh13.c, rng/cmrg.c, rng/coveyou.c, rng/default.c, rng/file.c, rng/fishman18.c, rng/fishman20.c, rng/fishman2x.c, rng/gfsr4.c, rng/gsl_rng.h, rng/knuthran.c, rng/knuthran2.c, rng/knuthran2002.c, rng/lecuyer21.c, rng/minstd.c, rng/mrg.c, rng/mt.c, rng/r250.c, rng/ran0.c, rng/ran1.c, rng/ran2.c, rng/ran3.c, rng/rand.c, rng/rand48.c, rng/random.c, rng/randu.c, rng/ranf.c, rng/ranlux.c, rng/ranlxd.c, rng/ranlxs.c, rng/ranmar.c, rng/rng.c, rng/schrage.c, rng/slatec.c, rng/taus.c, rng/taus113.c, rng/test.c, rng/transputer.c, rng/tt.c, rng/types.c, rng/uni.c, rng/uni32.c, rng/vax.c, rng/waterman14.c, rng/zuf.c, roots/ChangeLog, roots/Makefile.am, roots/Makefile.in, roots/TODO, roots/bisection.c, roots/brent.c, roots/convergence.c, roots/falsepos.c, roots/fdfsolver.c, roots/fsolver.c, roots/gsl_roots.h, roots/newton.c, roots/roots.h, roots/secant.c, roots/steffenson.c, roots/test.c, roots/test.h, roots/test_funcs.c, siman/ChangeLog, siman/Makefile.am, siman/Makefile.in, siman/TODO, siman/gsl_siman.h, siman/siman.c, siman/siman_test_driver.sh, siman/siman_tsp.c, siman/test.c, sort/ChangeLog, sort/Makefile.am, sort/Makefile.in, sort/TODO, sort/gsl_heapsort.h, sort/gsl_sort.h, sort/gsl_sort_char.h, sort/gsl_sort_double.h, sort/gsl_sort_float.h, sort/gsl_sort_int.h, sort/gsl_sort_long.h, sort/gsl_sort_long_double.h, sort/gsl_sort_short.h, sort/gsl_sort_uchar.h, sort/gsl_sort_uint.h, sort/gsl_sort_ulong.h, sort/gsl_sort_ushort.h, sort/gsl_sort_vector.h, sort/gsl_sort_vector_char.h, sort/gsl_sort_vector_double.h, sort/gsl_sort_vector_float.h, sort/gsl_sort_vector_int.h, sort/gsl_sort_vector_long.h, sort/gsl_sort_vector_long_double.h, sort/gsl_sort_vector_short.h, sort/gsl_sort_vector_uchar.h, sort/gsl_sort_vector_uint.h, sort/gsl_sort_vector_ulong.h, sort/gsl_sort_vector_ushort.h, sort/sort.c, sort/sortind.c, sort/sortvec.c, sort/sortvec_source.c, sort/sortvecind.c, sort/sortvecind_source.c, sort/subset.c, sort/subset_source.c, sort/subsetind.c, sort/subsetind_source.c, sort/test.c, sort/test_heapsort.c, sort/test_source.c, specfunc/ChangeLog, specfunc/Makefile.am, specfunc/Makefile.in, specfunc/TODO, specfunc/airy.c, specfunc/airy_der.c, specfunc/airy_zero.c, specfunc/atanint.c, specfunc/bessel.c, specfunc/bessel.h, specfunc/bessel_I0.c, specfunc/bessel_I1.c, specfunc/bessel_In.c, specfunc/bessel_Inu.c, specfunc/bessel_J0.c, specfunc/bessel_J1.c, specfunc/bessel_Jn.c, specfunc/bessel_Jnu.c, specfunc/bessel_K0.c, specfunc/bessel_K1.c, specfunc/bessel_Kn.c, specfunc/bessel_Knu.c, specfunc/bessel_Y0.c, specfunc/bessel_Y1.c, specfunc/bessel_Yn.c, specfunc/bessel_Ynu.c, specfunc/bessel_amp_phase.c, specfunc/bessel_amp_phase.h, specfunc/bessel_i.c, specfunc/bessel_j.c, specfunc/bessel_k.c, specfunc/bessel_olver.c, specfunc/bessel_olver.h, specfunc/bessel_sequence.c, specfunc/bessel_temme.c, specfunc/bessel_temme.h, specfunc/bessel_y.c, specfunc/bessel_zero.c, specfunc/beta.c, specfunc/beta_inc.c, specfunc/cheb_eval.c, specfunc/cheb_eval_mode.c, specfunc/chebyshev.h, specfunc/check.h, specfunc/clausen.c, specfunc/coulomb.c, specfunc/coulomb_bound.c, specfunc/coupling.c, specfunc/dawson.c, specfunc/debye.c, specfunc/dilog.c, specfunc/elementary.c, specfunc/ellint.c, specfunc/elljac.c, specfunc/erfc.c, specfunc/error.h, specfunc/eval.h, specfunc/exp.c, specfunc/expint.c, specfunc/expint3.c, specfunc/fermi_dirac.c, specfunc/gamma.c, specfunc/gamma_inc.c, specfunc/gegenbauer.c, specfunc/gsl_sf.h, specfunc/gsl_sf_airy.h, specfunc/gsl_sf_bessel.h, specfunc/gsl_sf_clausen.h, specfunc/gsl_sf_coulomb.h, specfunc/gsl_sf_coupling.h, specfunc/gsl_sf_dawson.h, specfunc/gsl_sf_debye.h, specfunc/gsl_sf_dilog.h, specfunc/gsl_sf_elementary.h, specfunc/gsl_sf_ellint.h, specfunc/gsl_sf_elljac.h, specfunc/gsl_sf_erf.h, specfunc/gsl_sf_exp.h, specfunc/gsl_sf_expint.h, specfunc/gsl_sf_fermi_dirac.h, specfunc/gsl_sf_gamma.h, specfunc/gsl_sf_gegenbauer.h, specfunc/gsl_sf_hyperg.h, specfunc/gsl_sf_laguerre.h, specfunc/gsl_sf_lambert.h, specfunc/gsl_sf_legendre.h, specfunc/gsl_sf_log.h, specfunc/gsl_sf_mathieu.h, specfunc/gsl_sf_pow_int.h, specfunc/gsl_sf_psi.h, specfunc/gsl_sf_result.h, specfunc/gsl_sf_synchrotron.h, specfunc/gsl_sf_transport.h, specfunc/gsl_sf_trig.h, specfunc/gsl_sf_zeta.h, specfunc/gsl_specfunc.h, specfunc/hyperg.c, specfunc/hyperg.h, specfunc/hyperg_0F1.c, specfunc/hyperg_1F1.c, specfunc/hyperg_2F0.c, specfunc/hyperg_2F1.c, specfunc/hyperg_U.c, specfunc/laguerre.c, specfunc/lambert.c, specfunc/legendre.h, specfunc/legendre_H3d.c, specfunc/legendre_Qn.c, specfunc/legendre_con.c, specfunc/legendre_poly.c, specfunc/log.c, specfunc/mathieu_angfunc.c, specfunc/mathieu_charv.c, specfunc/mathieu_coeff.c, specfunc/mathieu_radfunc.c, specfunc/mathieu_workspace.c, specfunc/poch.c, specfunc/pow_int.c, specfunc/psi.c, specfunc/recurse.h, specfunc/result.c, specfunc/shint.c, specfunc/sinint.c, specfunc/synchrotron.c, specfunc/test_airy.c, specfunc/test_bessel.c, specfunc/test_coulomb.c, specfunc/test_dilog.c, specfunc/test_gamma.c, specfunc/test_hyperg.c, specfunc/test_legendre.c, specfunc/test_mathieu.c, specfunc/test_sf.c, specfunc/test_sf.h, specfunc/transport.c, specfunc/trig.c, specfunc/zeta.c, statistics/ChangeLog, statistics/Makefile.am, statistics/Makefile.in, statistics/TODO, statistics/absdev.c, statistics/absdev_source.c, statistics/covariance.c, statistics/covariance_source.c, statistics/gsl_statistics.h, statistics/gsl_statistics_char.h, statistics/gsl_statistics_double.h, statistics/gsl_statistics_float.h, statistics/gsl_statistics_int.h, statistics/gsl_statistics_long.h, statistics/gsl_statistics_long_double.h, statistics/gsl_statistics_short.h, statistics/gsl_statistics_uchar.h, statistics/gsl_statistics_uint.h, statistics/gsl_statistics_ulong.h, statistics/gsl_statistics_ushort.h, statistics/kurtosis.c, statistics/kurtosis_source.c, statistics/lag1.c, statistics/lag1_source.c, statistics/mean.c, statistics/mean_source.c, statistics/median.c, statistics/median_source.c, statistics/minmax.c, statistics/minmax_source.c, statistics/p_variance.c, statistics/p_variance_source.c, statistics/quantiles.c, statistics/quantiles_source.c, statistics/skew.c, statistics/skew_source.c, statistics/test.c, statistics/test_float_source.c, statistics/test_int_source.c, statistics/test_nist.c, statistics/ttest.c, statistics/ttest_source.c, statistics/variance.c, statistics/variance_source.c, statistics/wabsdev.c, statistics/wabsdev_source.c, statistics/wkurtosis.c, statistics/wkurtosis_source.c, statistics/wmean.c, statistics/wmean_source.c, statistics/wskew.c, statistics/wskew_source.c, statistics/wvariance.c, statistics/wvariance_source.c, sum/ChangeLog, sum/Makefile.am, sum/Makefile.in, sum/gsl_sum.h, sum/levin_u.c, sum/levin_utrunc.c, sum/test.c, sum/work_u.c, sum/work_utrunc.c, sys/ChangeLog, sys/Makefile.am, sys/Makefile.in, sys/coerce.c, sys/expm1.c, sys/fcmp.c, sys/fdiv.c, sys/gsl_sys.h, sys/hypot.c, sys/infnan.c, sys/invhyp.c, sys/ldfrexp.c, sys/log1p.c, sys/minmax.c, sys/pow_int.c, sys/prec.c, sys/test.c, test/ChangeLog, test/Makefile.am, test/Makefile.in, test/gsl_test.h, test/results.c, utils/Makefile.am, utils/Makefile.in, utils/README, utils/memcpy.c, utils/memmove.c, utils/placeholder.c, utils/strdup.c, utils/strtol.c, utils/strtoul.c, utils/system.h, vector/ChangeLog, vector/Makefile.am, vector/Makefile.in, vector/TODO, vector/copy.c, vector/copy_source.c, vector/file.c, vector/file_source.c, vector/gsl_vector.h, vector/gsl_vector_char.h, vector/gsl_vector_complex.h, vector/gsl_vector_complex_double.h, vector/gsl_vector_complex_float.h, vector/gsl_vector_complex_long_double.h, vector/gsl_vector_double.h, vector/gsl_vector_float.h, vector/gsl_vector_int.h, vector/gsl_vector_long.h, vector/gsl_vector_long_double.h, vector/gsl_vector_short.h, vector/gsl_vector_uchar.h, vector/gsl_vector_uint.h, vector/gsl_vector_ulong.h, vector/gsl_vector_ushort.h, vector/init.c, vector/init_source.c, vector/minmax.c, vector/minmax_source.c, vector/oper.c, vector/oper_source.c, vector/prop.c, vector/prop_source.c, vector/reim.c, vector/reim_source.c, vector/subvector.c, vector/subvector_source.c, vector/swap.c, vector/swap_source.c, vector/test.c, vector/test_complex_source.c, vector/test_source.c, vector/test_static.c, vector/vector.c, vector/vector_source.c, vector/view.c, vector/view.h, vector/view_source.c, wavelet/ChangeLog, wavelet/Makefile.am, wavelet/Makefile.in, wavelet/TODO, wavelet/bspline.c, wavelet/daubechies.c, wavelet/dwt.c, wavelet/gsl_wavelet.h, wavelet/gsl_wavelet2d.h, wavelet/haar.c, wavelet/test.c, wavelet/wavelet.c: New files.
Diffstat (limited to 'gsl-1.9/specfunc/psi.c')
-rw-r--r--gsl-1.9/specfunc/psi.c857
1 files changed, 857 insertions, 0 deletions
diff --git a/gsl-1.9/specfunc/psi.c b/gsl-1.9/specfunc/psi.c
new file mode 100644
index 0000000..638d021
--- /dev/null
+++ b/gsl-1.9/specfunc/psi.c
@@ -0,0 +1,857 @@
+/* specfunc/psi.c
+ *
+ * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004, 2005, 2006 Gerard Jungman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* Author: G. Jungman */
+
+#include <config.h>
+#include <gsl/gsl_math.h>
+#include <gsl/gsl_errno.h>
+#include <gsl/gsl_sf_exp.h>
+#include <gsl/gsl_sf_gamma.h>
+#include <gsl/gsl_sf_zeta.h>
+#include <gsl/gsl_sf_psi.h>
+#include <gsl/gsl_complex_math.h>
+
+#include <stdio.h>
+
+#include "error.h"
+
+#include "chebyshev.h"
+#include "cheb_eval.c"
+
+/*-*-*-*-*-*-*-*-*-*-*-* Private Section *-*-*-*-*-*-*-*-*-*-*-*/
+
+
+/* Chebyshev fit for f(y) = Re(Psi(1+Iy)) + M_EULER - y^2/(1+y^2) - y^2/(2(4+y^2))
+ * 1 < y < 10
+ * ==>
+ * y(x) = (9x + 11)/2, -1 < x < 1
+ * x(y) = (2y - 11)/9
+ *
+ * g(x) := f(y(x))
+ */
+static double r1py_data[] = {
+ 1.59888328244976954803168395603,
+ 0.67905625353213463845115658455,
+ -0.068485802980122530009506482524,
+ -0.005788184183095866792008831182,
+ 0.008511258167108615980419855648,
+ -0.004042656134699693434334556409,
+ 0.001352328406159402601778462956,
+ -0.000311646563930660566674525382,
+ 0.000018507563785249135437219139,
+ 0.000028348705427529850296492146,
+ -0.000019487536014574535567541960,
+ 8.0709788710834469408621587335e-06,
+ -2.2983564321340518037060346561e-06,
+ 3.0506629599604749843855962658e-07,
+ 1.3042238632418364610774284846e-07,
+ -1.2308657181048950589464690208e-07,
+ 5.7710855710682427240667414345e-08,
+ -1.8275559342450963966092636354e-08,
+ 3.1020471300626589420759518930e-09,
+ 6.8989327480593812470039430640e-10,
+ -8.7182290258923059852334818997e-10,
+ 4.4069147710243611798213548777e-10,
+ -1.4727311099198535963467200277e-10,
+ 2.7589682523262644748825844248e-11,
+ 4.1871826756975856411554363568e-12,
+ -6.5673460487260087541400767340e-12,
+ 3.4487900886723214020103638000e-12,
+ -1.1807251417448690607973794078e-12,
+ 2.3798314343969589258709315574e-13,
+ 2.1663630410818831824259465821e-15
+};
+static cheb_series r1py_cs = {
+ r1py_data,
+ 29,
+ -1,1,
+ 18
+};
+
+
+/* Chebyshev fits from SLATEC code for psi(x)
+
+ Series for PSI on the interval 0. to 1.00000D+00
+ with weighted error 2.03E-17
+ log weighted error 16.69
+ significant figures required 16.39
+ decimal places required 17.37
+
+ Series for APSI on the interval 0. to 2.50000D-01
+ with weighted error 5.54E-17
+ log weighted error 16.26
+ significant figures required 14.42
+ decimal places required 16.86
+
+*/
+
+static double psics_data[23] = {
+ -.038057080835217922,
+ .491415393029387130,
+ -.056815747821244730,
+ .008357821225914313,
+ -.001333232857994342,
+ .000220313287069308,
+ -.000037040238178456,
+ .000006283793654854,
+ -.000001071263908506,
+ .000000183128394654,
+ -.000000031353509361,
+ .000000005372808776,
+ -.000000000921168141,
+ .000000000157981265,
+ -.000000000027098646,
+ .000000000004648722,
+ -.000000000000797527,
+ .000000000000136827,
+ -.000000000000023475,
+ .000000000000004027,
+ -.000000000000000691,
+ .000000000000000118,
+ -.000000000000000020
+};
+static cheb_series psi_cs = {
+ psics_data,
+ 22,
+ -1, 1,
+ 17
+};
+
+static double apsics_data[16] = {
+ -.0204749044678185,
+ -.0101801271534859,
+ .0000559718725387,
+ -.0000012917176570,
+ .0000000572858606,
+ -.0000000038213539,
+ .0000000003397434,
+ -.0000000000374838,
+ .0000000000048990,
+ -.0000000000007344,
+ .0000000000001233,
+ -.0000000000000228,
+ .0000000000000045,
+ -.0000000000000009,
+ .0000000000000002,
+ -.0000000000000000
+};
+static cheb_series apsi_cs = {
+ apsics_data,
+ 15,
+ -1, 1,
+ 9
+};
+
+#define PSI_TABLE_NMAX 100
+static double psi_table[PSI_TABLE_NMAX+1] = {
+ 0.0, /* Infinity */ /* psi(0) */
+ -M_EULER, /* psi(1) */
+ 0.42278433509846713939348790992, /* ... */
+ 0.92278433509846713939348790992,
+ 1.25611766843180047272682124325,
+ 1.50611766843180047272682124325,
+ 1.70611766843180047272682124325,
+ 1.87278433509846713939348790992,
+ 2.01564147795560999653634505277,
+ 2.14064147795560999653634505277,
+ 2.25175258906672110764745616389,
+ 2.35175258906672110764745616389,
+ 2.44266167997581201673836525479,
+ 2.52599501330914535007169858813,
+ 2.60291809023222227314862166505,
+ 2.67434666166079370172005023648,
+ 2.74101332832746036838671690315,
+ 2.80351332832746036838671690315,
+ 2.86233685773922507426906984432,
+ 2.91789241329478062982462539988,
+ 2.97052399224214905087725697883,
+ 3.02052399224214905087725697883,
+ 3.06814303986119666992487602645,
+ 3.11359758531574212447033057190,
+ 3.15707584618530734186163491973,
+ 3.1987425128519740085283015864,
+ 3.2387425128519740085283015864,
+ 3.2772040513135124700667631249,
+ 3.3142410883505495071038001619,
+ 3.3499553740648352213895144476,
+ 3.3844381326855248765619282407,
+ 3.4177714660188582098952615740,
+ 3.4500295305349872421533260902,
+ 3.4812795305349872421533260902,
+ 3.5115825608380175451836291205,
+ 3.5409943255438998981248055911,
+ 3.5695657541153284695533770196,
+ 3.5973435318931062473311547974,
+ 3.6243705589201332743581818244,
+ 3.6506863483938174848844976139,
+ 3.6763273740348431259101386396,
+ 3.7013273740348431259101386396,
+ 3.7257176179372821503003825420,
+ 3.7495271417468059598241920658,
+ 3.7727829557002943319172153216,
+ 3.7955102284275670591899425943,
+ 3.8177324506497892814121648166,
+ 3.8394715810845718901078169905,
+ 3.8607481768292527411716467777,
+ 3.8815815101625860745049801110,
+ 3.9019896734278921969539597029,
+ 3.9219896734278921969539597029,
+ 3.9415975165651470989147440166,
+ 3.9608282857959163296839747858,
+ 3.9796962103242182164764276160,
+ 3.9982147288427367349949461345,
+ 4.0163965470245549168131279527,
+ 4.0342536898816977739559850956,
+ 4.0517975495308205809735289552,
+ 4.0690389288411654085597358518,
+ 4.0859880813835382899156680552,
+ 4.1026547480502049565823347218,
+ 4.1190481906731557762544658694,
+ 4.1351772229312202923834981274,
+ 4.1510502388042361653993711433,
+ 4.1666752388042361653993711433,
+ 4.1820598541888515500147557587,
+ 4.1972113693403667015299072739,
+ 4.2121367424746950597388624977,
+ 4.2268426248276362362094507330,
+ 4.2413353784508246420065521823,
+ 4.2556210927365389277208378966,
+ 4.2697055997787924488475984600,
+ 4.2835944886676813377364873489,
+ 4.2972931188046676391063503626,
+ 4.3108066323181811526198638761,
+ 4.3241399656515144859531972094,
+ 4.3372978603883565912163551041,
+ 4.3502848733753695782293421171,
+ 4.3631053861958823987421626300,
+ 4.3757636140439836645649474401,
+ 4.3882636140439836645649474401,
+ 4.4006092930563293435772931191,
+ 4.4128044150075488557724150703,
+ 4.4248526077786331931218126607,
+ 4.4367573696833950978837174226,
+ 4.4485220755657480390601880108,
+ 4.4601499825424922251066996387,
+ 4.4716442354160554434975042364,
+ 4.4830078717796918071338678728,
+ 4.4942438268358715824147667492,
+ 4.5053549379469826935258778603,
+ 4.5163439489359936825368668713,
+ 4.5272135141533849868846929582,
+ 4.5379662023254279976373811303,
+ 4.5486045001977684231692960239,
+ 4.5591308159872421073798223397,
+ 4.5695474826539087740464890064,
+ 4.5798567610044242379640147796,
+ 4.5900608426370772991885045755,
+ 4.6001618527380874001986055856
+};
+
+
+#define PSI_1_TABLE_NMAX 100
+static double psi_1_table[PSI_1_TABLE_NMAX+1] = {
+ 0.0, /* Infinity */ /* psi(1,0) */
+ M_PI*M_PI/6.0, /* psi(1,1) */
+ 0.644934066848226436472415, /* ... */
+ 0.394934066848226436472415,
+ 0.2838229557371153253613041,
+ 0.2213229557371153253613041,
+ 0.1813229557371153253613041,
+ 0.1535451779593375475835263,
+ 0.1331370146940314251345467,
+ 0.1175120146940314251345467,
+ 0.1051663356816857461222010,
+ 0.0951663356816857461222010,
+ 0.0869018728717683907503002,
+ 0.0799574284273239463058557,
+ 0.0740402686640103368384001,
+ 0.0689382278476838062261552,
+ 0.0644937834032393617817108,
+ 0.0605875334032393617817108,
+ 0.0571273257907826143768665,
+ 0.0540409060376961946237801,
+ 0.0512708229352031198315363,
+ 0.0487708229352031198315363,
+ 0.0465032492390579951149830,
+ 0.0444371335365786562720078,
+ 0.0425467743683366902984728,
+ 0.0408106632572255791873617,
+ 0.0392106632572255791873617,
+ 0.0377313733163971768204978,
+ 0.0363596312039143235969038,
+ 0.0350841209998326909438426,
+ 0.0338950603577399442137594,
+ 0.0327839492466288331026483,
+ 0.0317433665203020901265817,
+ 0.03076680402030209012658168,
+ 0.02984853037475571730748159,
+ 0.02898347847164153045627052,
+ 0.02816715194102928555831133,
+ 0.02739554700275768062003973,
+ 0.02666508681283803124093089,
+ 0.02597256603721476254286995,
+ 0.02531510384129102815759710,
+ 0.02469010384129102815759710,
+ 0.02409521984367056414807896,
+ 0.02352832641963428296894063,
+ 0.02298749353699501850166102,
+ 0.02247096461137518379091722,
+ 0.02197713745088135663042339,
+ 0.02150454765882086513703965,
+ 0.02105185413233829383780923,
+ 0.02061782635456051606003145,
+ 0.02020133322669712580597065,
+ 0.01980133322669712580597065,
+ 0.01941686571420193164987683,
+ 0.01904704322899483105816086,
+ 0.01869104465298913508094477,
+ 0.01834810912486842177504628,
+ 0.01801753061247172756017024,
+ 0.01769865306145131939690494,
+ 0.01739086605006319997554452,
+ 0.01709360088954001329302371,
+ 0.01680632711763538818529605,
+ 0.01652854933985761040751827,
+ 0.01625980437882562975715546,
+ 0.01599965869724394401313881,
+ 0.01574770606433893015574400,
+ 0.01550356543933893015574400,
+ 0.01526687904880638577704578,
+ 0.01503731063741979257227076,
+ 0.01481454387422086185273411,
+ 0.01459828089844231513993134,
+ 0.01438824099085987447620523,
+ 0.01418415935820681325171544,
+ 0.01398578601958352422176106,
+ 0.01379288478501562298719316,
+ 0.01360523231738567365335942,
+ 0.01342261726990576130858221,
+ 0.01324483949212798353080444,
+ 0.01307170929822216635628920,
+ 0.01290304679189732236910755,
+ 0.01273868124291638877278934,
+ 0.01257845051066194236996928,
+ 0.01242220051066194236996928,
+ 0.01226978472038606978956995,
+ 0.01212106372098095378719041,
+ 0.01197590477193174490346273,
+ 0.01183418141592267460867815,
+ 0.01169577311142440471248438,
+ 0.01156056489076458859566448,
+ 0.01142844704164317229232189,
+ 0.01129931481023821361463594,
+ 0.01117306812421372175754719,
+ 0.01104961133409026496742374,
+ 0.01092885297157366069257770,
+ 0.01081070552355853781923177,
+ 0.01069508522063334415522437,
+ 0.01058191183901270133041676,
+ 0.01047110851491297833872701,
+ 0.01036260157046853389428257,
+ 0.01025632035036012704977199, /* ... */
+ 0.01015219706839427948625679, /* psi(1,99) */
+ 0.01005016666333357139524567 /* psi(1,100) */
+};
+
+
+/* digamma for x both positive and negative; we do both
+ * cases here because of the way we use even/odd parts
+ * of the function
+ */
+static int
+psi_x(const double x, gsl_sf_result * result)
+{
+ const double y = fabs(x);
+
+ if(x == 0.0 || x == -1.0 || x == -2.0) {
+ DOMAIN_ERROR(result);
+ }
+ else if(y >= 2.0) {
+ const double t = 8.0/(y*y)-1.0;
+ gsl_sf_result result_c;
+ cheb_eval_e(&apsi_cs, t, &result_c);
+ if(x < 0.0) {
+ const double s = sin(M_PI*x);
+ const double c = cos(M_PI*x);
+ if(fabs(s) < 2.0*GSL_SQRT_DBL_MIN) {
+ DOMAIN_ERROR(result);
+ }
+ else {
+ result->val = log(y) - 0.5/x + result_c.val - M_PI * c/s;
+ result->err = M_PI*fabs(x)*GSL_DBL_EPSILON/(s*s);
+ result->err += result_c.err;
+ result->err += GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+ }
+ else {
+ result->val = log(y) - 0.5/x + result_c.val;
+ result->err = result_c.err;
+ result->err += GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+ }
+ else { /* -2 < x < 2 */
+ gsl_sf_result result_c;
+
+ if(x < -1.0) { /* x = -2 + v */
+ const double v = x + 2.0;
+ const double t1 = 1.0/x;
+ const double t2 = 1.0/(x+1.0);
+ const double t3 = 1.0/v;
+ cheb_eval_e(&psi_cs, 2.0*v-1.0, &result_c);
+
+ result->val = -(t1 + t2 + t3) + result_c.val;
+ result->err = GSL_DBL_EPSILON * (fabs(t1) + fabs(x/(t2*t2)) + fabs(x/(t3*t3)));
+ result->err += result_c.err;
+ result->err += GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+ else if(x < 0.0) { /* x = -1 + v */
+ const double v = x + 1.0;
+ const double t1 = 1.0/x;
+ const double t2 = 1.0/v;
+ cheb_eval_e(&psi_cs, 2.0*v-1.0, &result_c);
+
+ result->val = -(t1 + t2) + result_c.val;
+ result->err = GSL_DBL_EPSILON * (fabs(t1) + fabs(x/(t2*t2)));
+ result->err += result_c.err;
+ result->err += GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+ else if(x < 1.0) { /* x = v */
+ const double t1 = 1.0/x;
+ cheb_eval_e(&psi_cs, 2.0*x-1.0, &result_c);
+
+ result->val = -t1 + result_c.val;
+ result->err = GSL_DBL_EPSILON * t1;
+ result->err += result_c.err;
+ result->err += GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+ else { /* x = 1 + v */
+ const double v = x - 1.0;
+ return cheb_eval_e(&psi_cs, 2.0*v-1.0, result);
+ }
+ }
+}
+
+
+/* psi(z) for large |z| in the right half-plane; [Abramowitz + Stegun, 6.3.18] */
+static
+gsl_complex
+psi_complex_asymp(gsl_complex z)
+{
+ /* coefficients in the asymptotic expansion for large z;
+ * let w = z^(-2) and write the expression in the form
+ *
+ * ln(z) - 1/(2z) - 1/12 w (1 + c1 w + c2 w + c3 w + ... )
+ */
+ static const double c1 = -0.1;
+ static const double c2 = 1.0/21.0;
+ static const double c3 = -0.05;
+
+ gsl_complex zi = gsl_complex_inverse(z);
+ gsl_complex w = gsl_complex_mul(zi, zi);
+ gsl_complex cs;
+
+ /* Horner method evaluation of term in parentheses */
+ gsl_complex sum;
+ sum = gsl_complex_mul_real(w, c3/c2);
+ sum = gsl_complex_add_real(sum, 1.0);
+ sum = gsl_complex_mul_real(sum, c2/c1);
+ sum = gsl_complex_mul(sum, w);
+ sum = gsl_complex_add_real(sum, 1.0);
+ sum = gsl_complex_mul_real(sum, c1);
+ sum = gsl_complex_mul(sum, w);
+ sum = gsl_complex_add_real(sum, 1.0);
+
+ /* correction added to log(z) */
+ cs = gsl_complex_mul(sum, w);
+ cs = gsl_complex_mul_real(cs, -1.0/12.0);
+ cs = gsl_complex_add(cs, gsl_complex_mul_real(zi, -0.5));
+
+ return gsl_complex_add(gsl_complex_log(z), cs);
+}
+
+
+
+/* psi(z) for complex z in the right half-plane */
+static int
+psi_complex_rhp(
+ gsl_complex z,
+ gsl_sf_result * result_re,
+ gsl_sf_result * result_im
+ )
+{
+ int n_recurse = 0;
+ int i;
+ gsl_complex a;
+
+ if(GSL_REAL(z) == 0.0 && GSL_IMAG(z) == 0.0)
+ {
+ result_re->val = 0.0;
+ result_im->val = 0.0;
+ result_re->err = 0.0;
+ result_im->err = 0.0;
+ return GSL_EDOM;
+ }
+
+ /* compute the number of recurrences to apply */
+ if(GSL_REAL(z) < 20.0 && fabs(GSL_IMAG(z)) < 20.0)
+ {
+ const double sp = sqrt(20.0 + GSL_IMAG(z));
+ const double sn = sqrt(20.0 - GSL_IMAG(z));
+ const double rhs = sp*sn - GSL_REAL(z);
+ if(rhs > 0.0) n_recurse = ceil(rhs);
+ }
+
+ /* compute asymptotic at the large value z + n_recurse */
+ a = psi_complex_asymp(gsl_complex_add_real(z, n_recurse));
+
+ /* descend recursively, if necessary */
+ for(i = n_recurse; i >= 1; --i)
+ {
+ gsl_complex zn = gsl_complex_add_real(z, i - 1.0);
+ gsl_complex zn_inverse = gsl_complex_inverse(zn);
+ a = gsl_complex_sub(a, zn_inverse);
+ }
+
+ result_re->val = GSL_REAL(a);
+ result_im->val = GSL_IMAG(a);
+ result_re->err = 2.0 * (1.0 + n_recurse) * GSL_DBL_EPSILON * fabs(result_re->val);
+ result_im->err = 2.0 * (1.0 + n_recurse) * GSL_DBL_EPSILON * fabs(result_im->val);
+
+ return GSL_SUCCESS;
+}
+
+
+
+/* generic polygamma; assumes n >= 0 and x > 0
+ */
+static int
+psi_n_xg0(const int n, const double x, gsl_sf_result * result)
+{
+ if(n == 0) {
+ return gsl_sf_psi_e(x, result);
+ }
+ else {
+ /* Abramowitz + Stegun 6.4.10 */
+ gsl_sf_result ln_nf;
+ gsl_sf_result hzeta;
+ int stat_hz = gsl_sf_hzeta_e(n+1.0, x, &hzeta);
+ int stat_nf = gsl_sf_lnfact_e((unsigned int) n, &ln_nf);
+ int stat_e = gsl_sf_exp_mult_err_e(ln_nf.val, ln_nf.err,
+ hzeta.val, hzeta.err,
+ result);
+ if(GSL_IS_EVEN(n)) result->val = -result->val;
+ return GSL_ERROR_SELECT_3(stat_e, stat_nf, stat_hz);
+ }
+}
+
+
+
+/*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/
+
+int gsl_sf_psi_int_e(const int n, gsl_sf_result * result)
+{
+ /* CHECK_POINTER(result) */
+
+ if(n <= 0) {
+ DOMAIN_ERROR(result);
+ }
+ else if(n <= PSI_TABLE_NMAX) {
+ result->val = psi_table[n];
+ result->err = GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+ else {
+ /* Abramowitz+Stegun 6.3.18 */
+ const double c2 = -1.0/12.0;
+ const double c3 = 1.0/120.0;
+ const double c4 = -1.0/252.0;
+ const double c5 = 1.0/240.0;
+ const double ni2 = (1.0/n)*(1.0/n);
+ const double ser = ni2 * (c2 + ni2 * (c3 + ni2 * (c4 + ni2*c5)));
+ result->val = log(n) - 0.5/n + ser;
+ result->err = GSL_DBL_EPSILON * (fabs(log(n)) + fabs(0.5/n) + fabs(ser));
+ result->err += GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+}
+
+
+int gsl_sf_psi_e(const double x, gsl_sf_result * result)
+{
+ /* CHECK_POINTER(result) */
+ return psi_x(x, result);
+}
+
+
+int
+gsl_sf_psi_1piy_e(const double y, gsl_sf_result * result)
+{
+ const double ay = fabs(y);
+
+ /* CHECK_POINTER(result) */
+
+ if(ay > 1000.0) {
+ /* [Abramowitz+Stegun, 6.3.19] */
+ const double yi2 = 1.0/(ay*ay);
+ const double lny = log(ay);
+ const double sum = yi2 * (1.0/12.0 + 1.0/120.0 * yi2 + 1.0/252.0 * yi2*yi2);
+ result->val = lny + sum;
+ result->err = 2.0 * GSL_DBL_EPSILON * (fabs(lny) + fabs(sum));
+ return GSL_SUCCESS;
+ }
+ else if(ay > 10.0) {
+ /* [Abramowitz+Stegun, 6.3.19] */
+ const double yi2 = 1.0/(ay*ay);
+ const double lny = log(ay);
+ const double sum = yi2 * (1.0/12.0 +
+ yi2 * (1.0/120.0 +
+ yi2 * (1.0/252.0 +
+ yi2 * (1.0/240.0 +
+ yi2 * (1.0/132.0 + 691.0/32760.0 * yi2)))));
+ result->val = lny + sum;
+ result->err = 2.0 * GSL_DBL_EPSILON * (fabs(lny) + fabs(sum));
+ return GSL_SUCCESS;
+ }
+ else if(ay > 1.0){
+ const double y2 = ay*ay;
+ const double x = (2.0*ay - 11.0)/9.0;
+ const double v = y2*(1.0/(1.0+y2) + 0.5/(4.0+y2));
+ gsl_sf_result result_c;
+ cheb_eval_e(&r1py_cs, x, &result_c);
+ result->val = result_c.val - M_EULER + v;
+ result->err = result_c.err;
+ result->err += 2.0 * GSL_DBL_EPSILON * (fabs(v) + M_EULER + fabs(result_c.val));
+ result->err += 2.0 * GSL_DBL_EPSILON * fabs(result->val);
+ result->err *= 5.0; /* FIXME: losing a digit somewhere... maybe at x=... ? */
+ return GSL_SUCCESS;
+ }
+ else {
+ /* [Abramowitz+Stegun, 6.3.17]
+ *
+ * -M_EULER + y^2 Sum[1/n 1/(n^2 + y^2), {n,1,M}]
+ * + Sum[1/n^3, {n,M+1,Infinity}]
+ * - y^2 Sum[1/n^5, {n,M+1,Infinity}]
+ * + y^4 Sum[1/n^7, {n,M+1,Infinity}]
+ * - y^6 Sum[1/n^9, {n,M+1,Infinity}]
+ * + O(y^8)
+ *
+ * We take M=50 for at least 15 digit precision.
+ */
+ const int M = 50;
+ const double y2 = y*y;
+ const double c0 = 0.00019603999466879846570;
+ const double c2 = 3.8426659205114376860e-08;
+ const double c4 = 1.0041592839497643554e-11;
+ const double c6 = 2.9516743763500191289e-15;
+ const double p = c0 + y2 *(-c2 + y2*(c4 - y2*c6));
+ double sum = 0.0;
+ double v;
+
+ int n;
+ for(n=1; n<=M; n++) {
+ sum += 1.0/(n * (n*n + y*y));
+ }
+
+ v = y2 * (sum + p);
+ result->val = -M_EULER + v;
+ result->err = GSL_DBL_EPSILON * (M_EULER + fabs(v));
+ result->err += 2.0 * GSL_DBL_EPSILON * fabs(result->val);
+ return GSL_SUCCESS;
+ }
+}
+
+
+int gsl_sf_psi_1_int_e(const int n, gsl_sf_result * result)
+{
+ /* CHECK_POINTER(result) */
+ if(n <= 0) {
+ DOMAIN_ERROR(result);
+ }
+ else if(n <= PSI_1_TABLE_NMAX) {
+ result->val = psi_1_table[n];
+ result->err = GSL_DBL_EPSILON * result->val;
+ return GSL_SUCCESS;
+ }
+ else {
+ /* Abramowitz+Stegun 6.4.12
+ * double-precision for n > 100
+ */
+ const double c0 = -1.0/30.0;
+ const double c1 = 1.0/42.0;
+ const double c2 = -1.0/30.0;
+ const double ni2 = (1.0/n)*(1.0/n);
+ const double ser = ni2*ni2 * (c0 + ni2*(c1 + c2*ni2));
+ result->val = (1.0 + 0.5/n + 1.0/(6.0*n*n) + ser) / n;
+ result->err = GSL_DBL_EPSILON * result->val;
+ return GSL_SUCCESS;
+ }
+}
+
+
+int gsl_sf_psi_1_e(const double x, gsl_sf_result * result)
+{
+ /* CHECK_POINTER(result) */
+
+ if(x == 0.0 || x == -1.0 || x == -2.0) {
+ DOMAIN_ERROR(result);
+ }
+ else if(x > 0.0)
+ {
+ return psi_n_xg0(1, x, result);
+ }
+ else if(x > -5.0)
+ {
+ /* Abramowitz + Stegun 6.4.6 */
+ int M = -floor(x);
+ double fx = x + M;
+ double sum = 0.0;
+ int m;
+
+ if(fx == 0.0)
+ DOMAIN_ERROR(result);
+
+ for(m = 0; m < M; ++m)
+ sum += 1.0/((x+m)*(x+m));
+
+ {
+ int stat_psi = psi_n_xg0(1, fx, result);
+ result->val += sum;
+ result->err += M * GSL_DBL_EPSILON * sum;
+ return stat_psi;
+ }
+ }
+ else
+ {
+ /* Abramowitz + Stegun 6.4.7 */
+ const double sin_px = sin(M_PI * x);
+ const double d = M_PI*M_PI/(sin_px*sin_px);
+ gsl_sf_result r;
+ int stat_psi = psi_n_xg0(1, 1.0-x, &r);
+ result->val = d - r.val;
+ result->err = r.err + 2.0*GSL_DBL_EPSILON*d;
+ return stat_psi;
+ }
+}
+
+
+int gsl_sf_psi_n_e(const int n, const double x, gsl_sf_result * result)
+{
+ /* CHECK_POINTER(result) */
+
+ if(n == 0)
+ {
+ return gsl_sf_psi_e(x, result);
+ }
+ else if(n == 1)
+ {
+ return gsl_sf_psi_1_e(x, result);
+ }
+ else if(n < 0 || x <= 0.0) {
+ DOMAIN_ERROR(result);
+ }
+ else {
+ gsl_sf_result ln_nf;
+ gsl_sf_result hzeta;
+ int stat_hz = gsl_sf_hzeta_e(n+1.0, x, &hzeta);
+ int stat_nf = gsl_sf_lnfact_e((unsigned int) n, &ln_nf);
+ int stat_e = gsl_sf_exp_mult_err_e(ln_nf.val, ln_nf.err,
+ hzeta.val, hzeta.err,
+ result);
+ if(GSL_IS_EVEN(n)) result->val = -result->val;
+ return GSL_ERROR_SELECT_3(stat_e, stat_nf, stat_hz);
+ }
+}
+
+
+int
+gsl_sf_complex_psi_e(
+ const double x,
+ const double y,
+ gsl_sf_result * result_re,
+ gsl_sf_result * result_im
+ )
+{
+ if(x >= 0.0)
+ {
+ gsl_complex z = gsl_complex_rect(x, y);
+ return psi_complex_rhp(z, result_re, result_im);
+ }
+ else
+ {
+ /* reflection formula [Abramowitz+Stegun, 6.3.7] */
+ gsl_complex z = gsl_complex_rect(x, y);
+ gsl_complex omz = gsl_complex_rect(1.0 - x, -y);
+ gsl_complex zpi = gsl_complex_mul_real(z, M_PI);
+ gsl_complex cotzpi = gsl_complex_cot(zpi);
+ int ret_val = psi_complex_rhp(omz, result_re, result_im);
+
+ if(GSL_IS_REAL(GSL_REAL(cotzpi)) && GSL_IS_REAL(GSL_IMAG(cotzpi)))
+ {
+ result_re->val -= M_PI * GSL_REAL(cotzpi);
+ result_im->val -= M_PI * GSL_IMAG(cotzpi);
+ return ret_val;
+ }
+ else
+ {
+ GSL_ERROR("singularity", GSL_EDOM);
+ }
+ }
+}
+
+
+
+/*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/
+
+#include "eval.h"
+
+double gsl_sf_psi_int(const int n)
+{
+ EVAL_RESULT(gsl_sf_psi_int_e(n, &result));
+}
+
+double gsl_sf_psi(const double x)
+{
+ EVAL_RESULT(gsl_sf_psi_e(x, &result));
+}
+
+double gsl_sf_psi_1piy(const double x)
+{
+ EVAL_RESULT(gsl_sf_psi_1piy_e(x, &result));
+}
+
+double gsl_sf_psi_1_int(const int n)
+{
+ EVAL_RESULT(gsl_sf_psi_1_int_e(n, &result));
+}
+
+double gsl_sf_psi_1(const double x)
+{
+ EVAL_RESULT(gsl_sf_psi_1_e(x, &result));
+}
+
+double gsl_sf_psi_n(const int n, const double x)
+{
+ EVAL_RESULT(gsl_sf_psi_n_e(n, x, &result));
+}