cat <<C-END-OF-FILE > README

This is a package of routines, called ORTHPOL, for generating 
orthogonal polynomials and Gauss-type quadrature rules developed
by Walter Gautschi. A description of the underlying methods can be
found in a companion paper published in ``ACM Transactions on
Mathematical Software'', vol. 20 (1994), pp.21-62.

There are files of four kinds in this package: the fortran netlib
programs  r1mach,d1mach,  generating single- and double-precision
machine constants for a variety of computers (Chapter 0); driver
programs in fortran, called  test1.f, test2.f, ... (Chapter 1); files 
called test1.out, test2.out, ...  containing the output of the 
respective drivers when run on the Cyber 205 (Chapter 1); the  fortran 
subroutines making up the core of the package (Chapters 2 - 6).

The machine constants highlighted in the netlib programs are those for
the Sun 4/670 MP workstation. If the package is to be run on a different
computer, the Sun machine constants have to be commented out and the
constants appropriate for the particular machine uncommented.

Structurally, the package is one single UNIX file, which, when given a
name, say ``package'', can be broken up into its individual component
files by the command

                     sh < package

At the same time, this will create a  Makefile  which allows the user
to compile and run (on a variety of computers) all test programs by
typing

                          make

or the N-th test by typing

                  make testN.out.local

The output of testN in either case is placed into a file called
testN.out.local.

On computers which do not support UNIX, the individual files can be
recovered by noting that they each start with a line of the form

               cat <<C-END-OF-FILE > filename

and end with the line

                      C-END-OF-FILE

To see which files must be assembled to run each test, refer to the
lines starting with 'TESTn = ' in Makefile.

The following is a brief description of the individual files of the
package.

   r1mach.f   a netlib program generating single-precision machine
              constants for a variety of computers

   d1mach.f   a netlib program generating double-precision machine
              constants for a variety of computers

   test1.f    relates to Example 3.1 of the companion paper, where
              orthogonal polynomials are generated relative to a weight
              function on (-1,1) having square root singularities at 
              1, -1, 1/omega, -1/omega, with  omega  between 0 and 1
   test1.out  contains the output of  test1.f

   test2.f    relates to Example 3.2, where orthogonal polynomials are
              generated relative to a weight function on (0,1) having 
              a logarithmic singularity at the origin as well as an
              algebraic singularity with degree  sigma  greater than -1
   test2.out  contains the output of  test2.f

   test3.f    relates to Example 4.1, implementing Stieltjes's
              procedure and the Lanczos algorithm to generate discrete
              Legendre polynomials
   test3.out  contains the output of  test3.f

   test4.f    relates to Example 4.2, where a discretization procedure
              is applied to generate orthogonal polynomials relative
              to the Chebyshev weight function plus a constant
   test4.out  contains the output of  test4.f

   test5.f    relates to Example 4.3 illustrating the use of a
              discretization procedure to generate orthogonal
              polynomials relative to the Jacobi weight function with
              a mass point of given strength placed at the left end 
              point
   test5.out  contains the output of  test5.f

   test6.f    relates to Example 4.4 implementing a discretization
              procedure to generate orthogonal polynomials for the
              logistics density function
   test6.out  contains the output of  test6.f

   test7.f    relates to Example 4.5 employing a general-purpose
              discretization procedure to generate the half-range
              Hermite polynomials
   test7.out  contains the output of  test7.f

   test8.f    relates to Example 4.6, where Example 3.1 is redone by
              means of a discretized modified Chebyshev algorithm
   test8.out  contains the output of  test8.f

   test9.f    relates to Example 5.1, redoing Example 3.2 for sigma=1/2,
              using a modification algorithm
   test9.out  contains the output of  test9.f

   test10.f   relates to Example 5.2, generating induced Legendre
              polynomials
   test10.out contains the output of  test10.f

   test11.f   relates to Example 5.3, illustrating the performance of
              the routines  chri.f  and  gchri.f  (see below) in the
              case of the Jacobi weight function multiplied or divided
              by a linear and quadratic factor
   test11.out contains the output of  test11.f

   recur.f    a subroutine generating the recursion coefficients of
              classical orthogonal polynomials
   drecur.f   a double-precision version of  recur.f

   cheb.f     a subroutine implementing the modified Chebyshev 
              algorithm
   dcheb.f    a double-precision version of  cheb.f

   sti.f      a subroutine generating the recursion coefficients of
              discrete orthogonal polynomials by Stieltjes's procedure
   dsti.f     a double-precision version of  sti.f

   lancz.f    a subroutine generating the recursion coefficients of
              discrete orthogonal polynomials by Lanczos's algorithm
   dlancz.f   a double-precision version of  lancz.f 

   mcdis.f    a subroutine computing the recursion coefficients (to
              a given degree of approximation) of continuous and
              mixed-type orthogonal polynomials by means of a multi-
              component discretization procedure
   dmcdis.f   a double-precision version of  mcdis.f

   qgp.f      a general-purpose quadrature routine for use in  mcdis.f
              or in mccheb.f

   dqgp.f     a general-purpose quadrature routine for use in  dmcdis.f
              or in dmcheb.f

   mccheb.f   a subroutine implementing the discretized modified
              Chebyshev algorithm whereby modified moments are
              approximated by discrete modified moments
   dmcheb.f   a double-precision version of  mccheb.f

   chri.f     a subroutine for computing the recursion coefficients of
              polynomials orthogonal with respect to a weight function
              obtained by a linear or quadratic modification of a given
              weight function
   dchri.f    a double-precision version of  chri.f

   knum.f     a subroutine which applies a backward recurrence algorithm
              to generate weighted integrals of orthogonal polynomials 
              multiplied by a Cauchy kernel
   nu0jac.f   auxiliary routines providing an estimate for the starting
   nu0lag.f   index in the backward recurrence algorithm of  knum.f  for
   nu0her.f   respectively the Jacobi, Laguerre and Hermite weights
   dknum.f    a double-precision version of  knum.f           

   kern.f     a subroutine generating the kernels in the remainder term
              of Gauss quadrature rules applied to analytic functions
   dkern.f    a double-precision version of  kern.f

   gchri.f    an alternative subroutine (to chri.f) for computing the
              recursion coefficients of polynomials orthogonal with 
              with respect to a weight function obtained by dividing a
              given weight function by a linear or quadratic factor
   dgchri.f   a double-precision version of  gchri.f

   gauss.f    a subroutine generating Gauss quadrature rules relative
              to a given integration measure
   dgauss.f   a double-precision version of  gauss.f

   radau.f    a subroutine generating Gauss-Radau quadrature rules
              relative to a given integration measure
   dradau.f   a double-precision version of  radau.f

   lob.f      a subroutine generating Gauss-Lobatto quadrature rules
              relative to a given integration measure
   dlob.f     a double-precision version of  lob.f

C-END-OF-FILE

cat <<C-END-OF-FILE > Makefile

#######################################################################
#                                                                     #
#             Makefile for ORTHPOL                                    #
#                                                                     #
#  Usage:                                                             #
#                                                                     #
#  Type  make                  to compile and run all test programs   #
#  Type  make testN.out.local  to compile and run the test program    #
#                              number N                               #
#  Type  make clean            to remove all but the generated output #
#                                                                     #
#######################################################################

#----------------------------------------------------------------------
# This section specifies the name of the linker and compilation options
# for various systems. All but one are commented out.
#----------------------------------------------------------------------

# ... For the Sun
LD = f77
FFLAGS =  #Do not use -O2; it may introduce errors

# ... For the Cray
#LD = cf77
#FFLAGS =

# ... For the Convex
#LD = fc
#FFLAGS = -O2

# ... For the RS/6000
#LD = xlf
#FFLAGS = -O

# ... For the HP 9000 series
#LD = f77
#FFLAGS = -O -K -w

# ... For Silicon Graphics
#LD = f77
#FFLAGS = -O2

#-------------------------------------------------------------------
# This section specifies which object files are needed for each test
# program.
#-------------------------------------------------------------------

TEST1 = test1.o r1mach.o d1mach.o recur.o drecur.o cheb.o dcheb.o
TEST2 = test2.o r1mach.o d1mach.o recur.o drecur.o cheb.o dcheb.o
TEST3 = test3.o r1mach.o sti.o lancz.o
TEST4 = test4.o r1mach.o mcdis.o qgp.o sti.o lancz.o recur.o gauss.o
TEST5 = test5.o r1mach.o d1mach.o recur.o drecur.o mcdis.o qgp.o sti.o lancz.o gauss.o
TEST6 = test6.o r1mach.o d1mach.o mcdis.o dmcdis.o qgp.o dqgp.o sti.o dsti.o lancz.o dlancz.o recur.o drecur.o gauss.o dgauss.o
TEST7 = test7.o r1mach.o d1mach.o mcdis.o dmcdis.o qgp.o dqgp.o sti.o dsti.o lancz.o dlancz.o
TEST8 = test8.o r1mach.o recur.o mccheb.o qgp.o cheb.o
TEST9 = test9.o r1mach.o d1mach.o recur.o drecur.o cheb.o dcheb.o chri.o dchri.o
TEST10= test10.o r1mach.o d1mach.o recur.o drecur.o gauss.o dgauss.o chri.o dchri.o
TEST11= test11.o r1mach.o d1mach.o recur.o drecur.o knum.o nu0jac.o dknum.o gchri.o dgchri.o cheb.o dcheb.o chri.o dchri.o

#--------------------------------------------------------------
# This is the default target. It will cause all the tests to be
# generated and run, saving their outputs in files.
#--------------------------------------------------------------

all :   test1.out.local test2.out.local test3.out.local test4.out.local test5.out.local test6.out.local test7.out.local test8.out.local test9.out.local test10.out.local test11.out.local

#----------------------------------------------------------------------
# This section shows how to run each test program. The output for testN
# is put in testN.out.local.
#----------------------------------------------------------------------

test1.out.local  : test1  ; test1  > \$@
test2.out.local  : test2  ; test2  > \$@
test3.out.local  : test3  ; test3  > \$@
test4.out.local  : test4  ; test4  > \$@
test5.out.local  : test5  ; test5  > \$@
test6.out.local  : test6  ; test6  > \$@
test7.out.local  : test7  ; test7  > \$@
test8.out.local  : test8  ; test8  > \$@
test9.out.local  : test9  ; test9  > \$@
test10.out.local : test10 ; test10 > \$@
test11.out.local : test11 ; test11 > \$@

#--------------------------------------------------
# This section shows how to link each test program.
#--------------------------------------------------

test1  : $(TEST1)  ; $(LD) -o \$@ $(TEST1)
test2  : $(TEST2)  ; $(LD) -o \$@ $(TEST2)
test3  : $(TEST3)  ; $(LD) -o \$@ $(TEST3)
test4  : $(TEST4)  ; $(LD) -o \$@ $(TEST4)
test5  : $(TEST5)  ; $(LD) -o \$@ $(TEST5)
test6  : $(TEST6)  ; $(LD) -o \$@ $(TEST6)
test7  : $(TEST7)  ; $(LD) -o \$@ $(TEST7)
test8  : $(TEST8)  ; $(LD) -o \$@ $(TEST8)
test9  : $(TEST9)  ; $(LD) -o \$@ $(TEST9)
test10 : $(TEST10) ; $(LD) -o \$@ $(TEST10)
test11 : $(TEST11) ; $(LD) -o \$@ $(TEST11)

#----------------------------------------------
# This section shows how to clean up afterward.
#----------------------------------------------

clean :
	rm -f core test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 *.o

C-END-OF-FILE

#########################
#                       #
# 0. MACHINE CONSTANTS  #
#                       #
#########################

cat <<C-END-OF-FILE > r1mach.f
c
c
      real function r1mach(i)
c
c  Single-precision machine constants
c
c  r1mach(1) = b**(emin-1), the smallest positive magnitude.
c
c  r1mach(2) = b**emax*(1 - b**(-t)), the largest magnitude.
c
c  r1mach(3) = b**(-t), the smallest relative spacing.
c
c  r1mach(4) = b**(1-t), the largest relative spacing.
c
c  r1mach(5) = log10(b)
c
c  To alter this function for a particular environment,
c  the desired set of data statements should be activated by
c  removing the c from column 1.
c  On rare machines a static statement may need to be added.
c  (But probably more systems prohibit it than require it.)
c
c  For IEEE-arithmetic machines (binary standard), the second
c  set of constants below should be appropriate.
c
c  Where possible, decimal, octal or hexadecimal constants are used
c  to specify the constants exactly.  Sometimes this requires using
c  equivalent integer arrays.  If your compiler uses half-word
c  integers by default (sometimes called integer*2), you may need to
c  change integer to integer*4 or otherwise instruct your compiler
c  to use full-word integers in the next 5 declarations.
c
      integer small(2)
      integer large(2)
      integer right(2)
      integer diver(2)
      integer log10(2)
      integer sc
c
      real rmach(5)
c
      equivalence (rmach(1),small(1))
      equivalence (rmach(2),large(1))
      equivalence (rmach(3),right(1))
      equivalence (rmach(4),diver(1))
      equivalence (rmach(5),log10(1))
c
c     machine constants for cdc cyber 205 and eta-10.
c
c     data small(1) / x'9000400000000000' /
c     data large(1) / x'6FFF7FFFFFFFFFFF' /
c     data right(1) / x'FFA3400000000000' /
c     data diver(1) / x'FFA4400000000000' /
c     data log10(1) / x'FFD04D104D427DE8' /, sc/987/
c
c     machine constants for ieee arithmetic machines, such as the at&t
c     3b series, motorola 68000 based machines (e.g. sun 3 and at&t
c     pc 7300), and 8087 based micros (e.g. ibm pc and at&t 6300).
c
       data small(1) /     8388608 /
       data large(1) /  2139095039 /
       data right(1) /   864026624 /
       data diver(1) /   872415232 /
       data log10(1) /  1050288283 /, sc/987/
c
c     machine constants for amdahl machines.
c
c      data small(1) /    1048576 /
c      data large(1) / 2147483647 /
c      data right(1) /  990904320 /
c      data diver(1) / 1007681536 /
c      data log10(1) / 1091781651 /, sc/987/
c
c     machine constants for the burroughs 1700 system.
c
c      data rmach(1) / z400800000 /
c      data rmach(2) / z5ffffffff /
c      data rmach(3) / z4e9800000 /
c      data rmach(4) / z4ea800000 /
c      data rmach(5) / z500e730e8 /, sc/987/
c
c     machine constants for the burroughs 5700/6700/7700 systems.
c
c      data rmach(1) / o1771000000000000 /
c      data rmach(2) / o0777777777777777 /
c      data rmach(3) / o1311000000000000 /
c      data rmach(4) / o1301000000000000 /
c      data rmach(5) / o1157163034761675 /, sc/987/
c
c     machine constants for ftn4 on the cdc 6000/7000 series.
c
c      data rmach(1) / 00564000000000000000b /
c      data rmach(2) / 37767777777777777776b /
c      data rmach(3) / 16414000000000000000b /
c      data rmach(4) / 16424000000000000000b /
c      data rmach(5) / 17164642023241175720b /, sc/987/
c
c     machine constants for ftn5 on the cdc 6000/7000 series.
c
c      data rmach(1) / o"00564000000000000000" /
c      data rmach(2) / o"37767777777777777776" /
c      data rmach(3) / o"16414000000000000000" /
c      data rmach(4) / o"16424000000000000000" /
c      data rmach(5) / o"17164642023241175720" /, sc/987/
c
c     machine constants for convex c-1.
c
c      data rmach(1) / '00800000'x /
c      data rmach(2) / '7fffffff'x /
c      data rmach(3) / '34800000'x /
c      data rmach(4) / '35000000'x /
c      data rmach(5) / '3f9a209b'x /, sc/987/
c
c     machine constants for the cray 1, xmp, 2, and 3.
c
c      data rmach(1) / 200034000000000000000b /
c      data rmach(2) / 577767777777777777776b /
c      data rmach(3) / 377224000000000000000b /
c      data rmach(4) / 377234000000000000000b /
c      data rmach(5) / 377774642023241175720b /, sc/987/
c
c     machine constants for the data general eclipse s/200.
c
c     note - it may be appropriate to include the following line -
c     static rmach(5)
c
c      data small/20k,0/,large/77777k,177777k/
c      data right/35420k,0/,diver/36020k,0/
c      data log10/40423k,42023k/, sc/987/
c
c     machine constants for the harris slash 6 and slash 7.
c
c      data small(1),small(2) / '20000000, '00000201 /
c      data large(1),large(2) / '37777777, '00000177 /
c      data right(1),right(2) / '20000000, '00000352 /
c      data diver(1),diver(2) / '20000000, '00000353 /
c      data log10(1),log10(2) / '23210115, '00000377 /, sc/987/
c
c     machine constants for the honeywell dps 8/70 series.
c
c      data rmach(1) / o402400000000 /
c      data rmach(2) / o376777777777 /
c      data rmach(3) / o714400000000 /
c      data rmach(4) / o716400000000 /
c      data rmach(5) / o776464202324 /, sc/987/
c
c     machine constants for the ibm 360/370 series,
c     the xerox sigma 5/7/9 and the sel systems 85/86.
c
c      data rmach(1) / z00100000 /
c      data rmach(2) / z7fffffff /
c      data rmach(3) / z3b100000 /
c      data rmach(4) / z3c100000 /
c      data rmach(5) / z41134413 /, sc/987/
c
c     machine constants for the interdata 8/32
c     with the unix system fortran 77 compiler.
c
c     for the interdata fortran vii compiler replace
c     the z's specifying hex constants with y's.
c
c      data rmach(1) / z'00100000' /
c      data rmach(2) / z'7effffff' /
c      data rmach(3) / z'3b100000' /
c      data rmach(4) / z'3c100000' /
c      data rmach(5) / z'41134413' /, sc/987/
c
c     machine constants for the pdp-10 (ka or ki processor).
c
c      data rmach(1) / "000400000000 /
c      data rmach(2) / "377777777777 /
c      data rmach(3) / "146400000000 /
c      data rmach(4) / "147400000000 /
c      data rmach(5) / "177464202324 /, sc/987/
c
c     machine constants for pdp-11 fortrans supporting
c     32-bit integers (expressed in integer and octal).
c
c      data small(1) /    8388608 /
c      data large(1) / 2147483647 /
c      data right(1) /  880803840 /
c      data diver(1) /  889192448 /
c      data log10(1) / 1067065499 /, sc/987/
c
c      data rmach(1) / o00040000000 /
c      data rmach(2) / o17777777777 /
c      data rmach(3) / o06440000000 /
c      data rmach(4) / o06500000000 /
c      data rmach(5) / o07746420233 /, sc/987/
c
c     machine constants for pdp-11 fortrans supporting
c     16-bit integers  (expressed in integer and octal).
c
c      data small(1),small(2) /   128,     0 /
c      data large(1),large(2) / 32767,    -1 /
c      data right(1),right(2) / 13440,     0 /
c      data diver(1),diver(2) / 13568,     0 /
c      data log10(1),log10(2) / 16282,  8347 /, sc/987/
c
c      data small(1),small(2) / o000200, o000000 /
c      data large(1),large(2) / o077777, o177777 /
c      data right(1),right(2) / o032200, o000000 /
c      data diver(1),diver(2) / o032400, o000000 /
c      data log10(1),log10(2) / o037632, o020233 /, sc/987/
c
c     machine constants for the sequent balance 8000.
c
c      data small(1) / $00800000 /
c      data large(1) / $7f7fffff /
c      data right(1) / $33800000 /
c      data diver(1) / $34000000 /
c      data log10(1) / $3e9a209b /, sc/987/
c
c     machine constants for the univac 1100 series.
c
c      data rmach(1) / o000400000000 /
c      data rmach(2) / o377777777777 /
c      data rmach(3) / o146400000000 /
c      data rmach(4) / o147400000000 /
c      data rmach(5) / o177464202324 /, sc/987/
c
c     machine constants for the vax unix f77 compiler.
c
c      data small(1) /       128 /
c      data large(1) /    -32769 /
c      data right(1) /     13440 /
c      data diver(1) /     13568 /
c      data log10(1) / 547045274 /, sc/987/
c
c     machine constants for the vax-11 with
c     fortran iv-plus compiler.
c
c      data rmach(1) / z00000080 /
c      data rmach(2) / zffff7fff /
c      data rmach(3) / z00003480 /
c      data rmach(4) / z00003500 /
c      data rmach(5) / z209b3f9a /, sc/987/
c
c     machine constants for vax/vms version 2.2.
c
c      data rmach(1) /       '80'x /
c      data rmach(2) / 'ffff7fff'x /
c      data rmach(3) /     '3480'x /
c      data rmach(4) /     '3500'x /
c      data rmach(5) / '209b3f9a'x /, sc/987/
c
c  ***  issue stop 778 if all data statements are commented...
      if (sc .ne. 987) stop 778
      if (i .lt. 1  .or.  i .gt. 5) goto 999
      r1mach = rmach(i)
      return
  999 write(*,1999) i
 1999 format(' r1mach - i out of bounds',i10)
      stop
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > d1mach.f
c
c
      double precision function d1mach(i)
c
c  Double-precision machine constants
c
c  d1mach( 1) = b**(emin-1), the smallest positive magnitude.
c
c  d1mach( 2) = b**emax*(1 - b**(-t)), the largest magnitude.
c
c  d1mach( 3) = b**(-t), the smallest relative spacing.
c
c  d1mach( 4) = b**(1-t), the largest relative spacing.
c
c  d1mach( 5) = log10(b)
c
c  To alter this function for a particular environment,
c  the desired set of data statements should be activated by
c  removing the c from column 1.
c  On rare machines a static statement may need to be added.
c  (But probably more systems prohibit it than require it.)
c
c  For IEEE-arithmetic machines (binary standard), one of the second
c  two sets of constants below should be appropriate.
c
c  Where possible, decimal, octal or hexadecimal constants are used
c  to specify the constants exactly.  Sometimes this requires using
c  equivalent integer arrays.  If your compiler uses half-word
c  integers by default (sometimes called integer*2), you may need to
c  change integer to integer*4 or otherwise instruct your compiler
c  to use full-word integers in the next 5 declarations.
c
      integer small(2)
      integer large(2)
      integer right(2)
      integer diver(2)
      integer log10(2)
      integer sc
c
      double precision dmach(5)
c
      equivalence (dmach(1),small(1))
      equivalence (dmach(2),large(1))
      equivalence (dmach(3),right(1))
      equivalence (dmach(4),diver(1))
      equivalence (dmach(5),log10(1))
c
c     machine constants for cdc cyber 205 and eta-10.
c
c     data small(1) / x'9000400000000000' /
c     data small(2) / x'8000000000000000' /
c
c     data large(1) / x'6FFF7FFFFFFFFFFF' /
c     data large(2) / x'6FD07FFFFFFFFFFF' /
c
c     data right(1) / x'FF74400000000000' /
c     data right(2) / x'8000000000000000' /
c
c     data diver(1) / x'FF75400000000000' /
c     data diver(2) / x'8000000000000000' /
c
c     data log10(1) / x'FFD04D104D427DE7' /
c     data log10(2) / x'FFA17DE623E2566B' /, sc/987/
c     
c     machine constants for ieee arithmetic machines, such as the at&t
c     3b series and motorola 68000 based machines (e.g. sun 3 and at&t
c     pc 7300), in which the most significant byte is stored first.
c
       data small(1),small(2) /    1048576,          0 /
       data large(1),large(2) / 2146435071,         -1 /
       data right(1),right(2) / 1017118720,          0 /
       data diver(1),diver(2) / 1018167296,          0 /
       data log10(1),log10(2) / 1070810131, 1352628735 /, sc/987/
c
c     machine constants for ieee arithmetic machines and 8087-based
c     micros, such as the ibm pc and at&t 6300, in which the least
c     significant byte is stored first.
c
c      data small(1),small(2) /          0,    1048576 /
c      data large(1),large(2) /         -1, 2146435071 /
c      data right(1),right(2) /          0, 1017118720 /
c      data diver(1),diver(2) /          0, 1018167296 /
c      data log10(1),log10(2) / 1352628735, 1070810131 /, sc/987/
c
c     machine constants for amdahl machines.
c
c      data small(1),small(2) /    1048576,          0 /
c      data large(1),large(2) / 2147483647,         -1 /
c      data right(1),right(2) /  856686592,          0 /
c      data diver(1),diver(2) /  873463808,          0 /
c      data log10(1),log10(2) / 1091781651, 1352628735 /, sc/987/
c
c     machine constants for the burroughs 1700 system.
c
c      data small(1) / zc00800000 /
c      data small(2) / z000000000 /
c
c      data large(1) / zdffffffff /
c      data large(2) / zfffffffff /
c
c      data right(1) / zcc5800000 /
c      data right(2) / z000000000 /
c
c      data diver(1) / zcc6800000 /
c      data diver(2) / z000000000 /
c
c      data log10(1) / zd00e730e7 /
c      data log10(2) / zc77800dc0 /, sc/987/
c
c     machine constants for the burroughs 5700 system.
c
c      data small(1) / o1771000000000000 /
c      data small(2) / o0000000000000000 /
c
c      data large(1) / o0777777777777777 /
c      data large(2) / o0007777777777777 /
c
c      data right(1) / o1461000000000000 /
c      data right(2) / o0000000000000000 /
c
c      data diver(1) / o1451000000000000 /
c      data diver(2) / o0000000000000000 /
c
c      data log10(1) / o1157163034761674 /
c      data log10(2) / o0006677466732724 /, sc/987/
c
c     machine constants for the burroughs 6700/7700 systems.
c
c      data small(1) / o1771000000000000 /
c      data small(2) / o7770000000000000 /
c
c      data large(1) / o0777777777777777 /
c      data large(2) / o7777777777777777 /
c
c      data right(1) / o1461000000000000 /
c      data right(2) / o0000000000000000 /
c
c      data diver(1) / o1451000000000000 /
c      data diver(2) / o0000000000000000 /
c
c      data log10(1) / o1157163034761674 /
c      data log10(2) / o0006677466732724 /, sc/987/
c
c     machine constants for ftn4 on the cdc 6000/7000 series.
c
c      data small(1) / 00564000000000000000b /
c      data small(2) / 00000000000000000000b /
c
c      data large(1) / 37757777777777777777b /
c      data large(2) / 37157777777777777774b /
c
c      data right(1) / 15624000000000000000b /
c      data right(2) / 00000000000000000000b /
c
c      data diver(1) / 15634000000000000000b /
c      data diver(2) / 00000000000000000000b /
c
c      data log10(1) / 17164642023241175717b /
c      data log10(2) / 16367571421742254654b /, sc/987/
c
c     machine constants for ftn5 on the cdc 6000/7000 series.
c
c      data small(1) / o"00564000000000000000" /
c      data small(2) / o"00000000000000000000" /
c
c      data large(1) / o"37757777777777777777" /
c      data large(2) / o"37157777777777777774" /
c
c      data right(1) / o"15624000000000000000" /
c      data right(2) / o"00000000000000000000" /
c
c      data diver(1) / o"15634000000000000000" /
c      data diver(2) / o"00000000000000000000" /
c
c      data log10(1) / o"17164642023241175717" /
c      data log10(2) / o"16367571421742254654" /, sc/987/
c
c     machine constants for convex c-1
c
c      data small(1),small(2) / '00100000'x, '00000000'x /
c      data large(1),large(2) / '7fffffff'x, 'ffffffff'x /
c      data right(1),right(2) / '3cc00000'x, '00000000'x /
c      data diver(1),diver(2) / '3cd00000'x, '00000000'x /
c      data log10(1),log10(2) / '3ff34413'x, '509f79ff'x /, sc/987/
c
c     machine constants for the cray 1, xmp, 2, and 3.
c
c      data small(1) / 201354000000000000000b /
c      data small(2) / 000000000000000000000b /
c
c      data large(1) / 577767777777777777777b /
c      data large(2) / 000007777777777777776b /
c
c      data right(1) / 376434000000000000000b /
c      data right(2) / 000000000000000000000b /
c
c      data diver(1) / 376444000000000000000b /
c      data diver(2) / 000000000000000000000b /
c
c      data log10(1) / 377774642023241175717b /
c      data log10(2) / 000007571421742254654b /, sc/987/
c
c     machine constants for the data general eclipse s/200
c
c     small, large, right, diver, log10 should be declared
c     integer small(4), large(4), right(4), diver(4), log10(4)
c
c     note - it may be appropriate to include the following line -
c     static dmach(5)
c
c      data small/20k,3*0/,large/77777k,3*177777k/
c      data right/31420k,3*0/,diver/32020k,3*0/
c      data log10/40423k,42023k,50237k,74776k/, sc/987/
c
c     machine constants for the harris slash 6 and slash 7
c
c      data small(1),small(2) / '20000000, '00000201 /
c      data large(1),large(2) / '37777777, '37777577 /
c      data right(1),right(2) / '20000000, '00000333 /
c      data diver(1),diver(2) / '20000000, '00000334 /
c      data log10(1),log10(2) / '23210115, '10237777 /, sc/987/
c
c     machine constants for the honeywell dps 8/70 series.
c
c      data small(1),small(2) / o402400000000, o000000000000 /
c      data large(1),large(2) / o376777777777, o777777777777 /
c      data right(1),right(2) / o604400000000, o000000000000 /
c      data diver(1),diver(2) / o606400000000, o000000000000 /
c      data log10(1),log10(2) / o776464202324, o117571775714 /, sc/987/
c
c     machine constants for the ibm 360/370 series,
c     the xerox sigma 5/7/9 and the sel systems 85/86.
c
c      data small(1),small(2) / z00100000, z00000000 /
c      data large(1),large(2) / z7fffffff, zffffffff /
c      data right(1),right(2) / z33100000, z00000000 /
c      data diver(1),diver(2) / z34100000, z00000000 /
c      data log10(1),log10(2) / z41134413, z509f79ff /, sc/987/
c
c     machine constants for the interdata 8/32
c     with the unix system fortran 77 compiler.
c
c     for the interdata fortran vii compiler replace
c     the z's specifying hex constants with y's.
c
c      data small(1),small(2) / z'00100000', z'00000000' /
c      data large(1),large(2) / z'7effffff', z'ffffffff' /
c      data right(1),right(2) / z'33100000', z'00000000' /
c      data diver(1),diver(2) / z'34100000', z'00000000' /
c      data log10(1),log10(2) / z'41134413', z'509f79ff' /, sc/987/
c
c     machine constants for the pdp-10 (ka processor).
c
c      data small(1),small(2) / "033400000000, "000000000000 /
c      data large(1),large(2) / "377777777777, "344777777777 /
c      data right(1),right(2) / "113400000000, "000000000000 /
c      data diver(1),diver(2) / "114400000000, "000000000000 /
c      data log10(1),log10(2) / "177464202324, "144117571776 /, sc/987/
c
c     machine constants for the pdp-10 (ki processor).
c
c      data small(1),small(2) / "000400000000, "000000000000 /
c      data large(1),large(2) / "377777777777, "377777777777 /
c      data right(1),right(2) / "103400000000, "000000000000 /
c      data diver(1),diver(2) / "104400000000, "000000000000 /
c      data log10(1),log10(2) / "177464202324, "047674776746 /, sc/987/
c
c     machine constants for pdp-11 fortrans supporting
c     32-bit integers (expressed in integer and octal).
c
c      data small(1),small(2) /    8388608,           0 /
c      data large(1),large(2) / 2147483647,          -1 /
c      data right(1),right(2) /  612368384,           0 /
c      data diver(1),diver(2) /  620756992,           0 /
c      data log10(1),log10(2) / 1067065498, -2063872008 /, sc/987/
c
c      data small(1),small(2) / o00040000000, o00000000000 /
c      data large(1),large(2) / o17777777777, o37777777777 /
c      data right(1),right(2) / o04440000000, o00000000000 /
c      data diver(1),diver(2) / o04500000000, o00000000000 /
c      data log10(1),log10(2) / o07746420232, o20476747770 /, sc/987/
c
c     machine constants for pdp-11 fortrans supporting
c     16-bit integers (expressed in integer and octal).
c
c     small, large, right, diver, log10 should be declared
c     integer small(4), large(4), right(4), diver(4), log10(4)
c
c      data small(1),small(2) /    128,      0 /
c      data small(3),small(4) /      0,      0 /
c
c      data large(1),large(2) /  32767,     -1 /
c      data large(3),large(4) /     -1,     -1 /
c
c      data right(1),right(2) /   9344,      0 /
c      data right(3),right(4) /      0,      0 /
c
c      data diver(1),diver(2) /   9472,      0 /
c      data diver(3),diver(4) /      0,      0 /
c
c      data log10(1),log10(2) /  16282,   8346 /
c      data log10(3),log10(4) / -31493, -12296 /, sc/987/
c
c      data small(1),small(2) / o000200, o000000 /
c      data small(3),small(4) / o000000, o000000 /
c
c      data large(1),large(2) / o077777, o177777 /
c      data large(3),large(4) / o177777, o177777 /
c
c      data right(1),right(2) / o022200, o000000 /
c      data right(3),right(4) / o000000, o000000 /
c
c      data diver(1),diver(2) / o022400, o000000 /
c      data diver(3),diver(4) / o000000, o000000 /
c
c      data log10(1),log10(2) / o037632, o020232 /
c      data log10(3),log10(4) / o102373, o147770 /, sc/987/
c
c     machine constants for the prime 50 series systems
c     with 32-bit integers and 64v mode instructions,
c     supplied by igor bray.
c
c      data small(1),small(2) / :10000000000, :00000100001 /
c      data large(1),large(2) / :17777777777, :37777677775 /
c      data right(1),right(2) / :10000000000, :00000000122 /
c      data diver(1),diver(2) / :10000000000, :00000000123 /
c      data log10(1),log10(2) / :11504046501, :07674600177 /, sc/987/
c
c     machine constants for the sequent balance 8000
c
c      data small(1),small(2) / $00000000,  $00100000 /
c      data large(1),large(2) / $ffffffff,  $7fefffff /
c      data right(1),right(2) / $00000000,  $3ca00000 /
c      data diver(1),diver(2) / $00000000,  $3cb00000 /
c      data log10(1),log10(2) / $509f79ff,  $3fd34413 /, sc/987/
c
c     machine constants for the univac 1100 series.
c
c      data small(1),small(2) / o000040000000, o000000000000 /
c      data large(1),large(2) / o377777777777, o777777777777 /
c      data right(1),right(2) / o170540000000, o000000000000 /
c      data diver(1),diver(2) / o170640000000, o000000000000 /
c      data log10(1),log10(2) / o177746420232, o411757177572 /, sc/987/
c
c     machine constants for the vax unix f77 compiler
c
c      data small(1),small(2) /        128,           0 /
c      data large(1),large(2) /     -32769,          -1 /
c      data right(1),right(2) /       9344,           0 /
c      data diver(1),diver(2) /       9472,           0 /
c      data log10(1),log10(2) /  546979738,  -805796613 /, sc/987/
c
c     machine constants for the vax-11 with
c     fortran iv-plus compiler
c
c      data small(1),small(2) / z00000080, z00000000 /
c      data large(1),large(2) / zffff7fff, zffffffff /
c      data right(1),right(2) / z00002480, z00000000 /
c      data diver(1),diver(2) / z00002500, z00000000 /
c      data log10(1),log10(2) / z209a3f9a, zcff884fb /, sc/987/
c
c     machine constants for vax/vms version 2.2
c
c      data small(1),small(2) /       '80'x,        '0'x /
c      data large(1),large(2) / 'ffff7fff'x, 'ffffffff'x /
c      data right(1),right(2) /     '2480'x,        '0'x /
c      data diver(1),diver(2) /     '2500'x,        '0'x /
c      data log10(1),log10(2) / '209a3f9a'x, 'cff884fb'x /, sc/987/
c
c  ***  issue stop 779 if all data statements are commented...
      if (sc .ne. 987) stop 779
c  ***  issue stop 778 if all data statements are obviously wrong...
      if (dmach(4) .ge. 1.0d0) stop 778
      if (i .lt. 1  .or.  i .gt. 5) goto 999
      d1mach = dmach(i)
      return
  999 write(*,1999) i
 1999 format(' d1mach - i out of bounds',i10)
      stop
      end

C-END-OF-FILE

#############
#           #
# 1. TESTS  #
#           #
#############

cat <<C-END-OF-FILE > test1.f
c
c
      program test1
c
c
      dimension fnu(160),f(80),f0(80),rr(80),a(159),b(159),
     *alpha(80),beta(80),s(80),s0(160),s1(160),s2(160)
      double precision doom2(7),deps,d1mach,dom2,dnu(160),d(80),
     *d0(80),drr(80),da(159),db(159),dalpha(80),dbeta(80),ds(80),
     *ds0(160),ds1(160),ds2(160)
      logical modmom
      data doom2/.1d0,.3d0,.5d0,.7d0,.9d0,.99d0,.999d0/
c
c This test generates the first n beta-coefficients in the recurrence
c relation for the orthogonal polynomials relative to the weight
c function
c
c         ((1-om2*x**2)*(1-x**2))**(-1/2)  on (-1,1)
c
c for om2=.1(.2).9,.99,.999, both in single and double precision,
c using modified moments if  modmom=.true.  and ordinary moments
c otherwise. In the former case, n=80, in the latter, n=20. Printed
c are the double-precision values of the coefficients along with the
c relative errors of the single-precision values.
c
      write(*,1)
    1 format(/)
      modmom=.true.
      eps=r1mach(3)
      deps=d1mach(3)
      if(modmom) then
        n=80
      else
        n=20
      end if
      ndm1=2*n-1
      do 30 iom=1,7
        dom2=doom2(iom)
        om2=sngl(dom2)
c
c Compute the modified resp. ordinary moments using Eqs. (3.7) and (3.9)
c of the companion paper. On machines with limited exponent range, some
c of the high-order modified moments may underflow, without this having
c any deteriorating effect on the accuracy.
c
        call fmm(n,eps,modmom,om2,fnu,ierr,f,f0,rr) 
        call dmm(n,deps,modmom,dom2,dnu,iderr,d,d0,drr)
        if(ierr.ne.0 .or. iderr.ne.0) then
          write(*,2) ierr,iderr,om2
    2     format(/5x,'ierr in fmm = ',i1,'  iderr in dmm = ',i1,
     *      '  for om2 = ',f8.4/)
          goto 30
        end if 
c
c Generate the recursion coefficients for the polynomials defining the
c modified resp. ordinary moments.
c
        if(modmom) then
          call recur(ndm1,3,0.,0.,a,b,ierr)
          call drecur(ndm1,3,0.d0,0.d0,da,db,iderr)
        else
          do 10 k=1,ndm1
            a(k)=0.
            b(k)=0.
            da(k)=0.d0
            db(k)=0.d0    
   10     continue
        end if
c
c Compute the desired recursion coefficients by means of the modified
c Chebyshev algorithm; for the latter, see, e.g., Section 2.4 of
c W. Gautschi, ``On generating orthogonal polynomials'', SIAM J. Sci.
c Statist. Comput. 3, 1982, 289-317.
c
        call cheb(n,a,b,fnu,alpha,beta,s,ierr,s0,s1,s2)
c
c On machines with limited single-precision exponent range, the routine
c cheb  may generate an underflow exception, which however is harmless
c and can be ignored.
c
        call dcheb(n,da,db,dnu,dalpha,dbeta,ds,iderr,ds0,ds1,ds2)
        write(*,3) ierr,iderr
    3   format(/5x,'ierr in cheb = ',i3,'  iderr in dcheb = ',i3/)
        write(*,4)
    4   format(/5x,'k',9x,'dbeta(k)'/)
        do 20 k=1,n
          km1=k-1
          if(iderr.eq.0 .or. km1.lt.abs(iderr)) then
            if(ierr.eq.0 .or. km1.lt.abs(ierr)) then
              errb=sngl(dabs(dble(beta(k))-dbeta(k))/dbeta(k))
              if(k.eq.1) then
                write(*,5) km1,dbeta(k),errb,om2
    5           format(1x,i5,d24.16,e12.4,'   om2 =',f6.3)
              else
                write(*,6) km1,dbeta(k),errb
    6           format(1x,i5,d24.16,e12.4)
              end if
            else
              write(*,7) km1,dbeta(k)
    7         format(1x,i5,d24.16)
            end if
          end if
   20   continue
        write(*,1)
   30 continue
      stop
      end

      subroutine fmm(n,eps,modmom,om2,fnu,ierr,f,f0,rr)
c
c This routine generates the modified (Chebyshev) resp. ordinary
c moments of the weight function
c
c          ((1-om2*x**2)*(1-x**2))**(-1/2)  on (-1,1)
c
c using Eqs. (3.7) resp. (3.9) of the companion paper.
c
      dimension fnu(*),f(n),f0(n),rr(n)
      logical modmom
c
c The array  fnu  is assumed to have dimension  2*n.
c
      ierr=0
      nd=2*n
      ndm1=nd-1
      pi=4.*atan(1.)
c
c Compute the Fourier coefficients of ((1-om2*sin(theta)**2))**(-1/2)
c as minimal solution of a three-term recurrence relation as described
c on pp.310-311 of W. Gautschi,``On generating orthogonal polynomials'',
c SIAM J. Sci. Statist. Comput. 3, 1982, 289-317.
c
      q=om2/(2.-om2+2.*sqrt(1.-om2))
      q1=(1.+q*q)/q
      do 10 k=1,n
        f(k)=0.
   10 continue
      nu=nd
   20 nu=nu+10
      do 30 k=1,n
        f0(k)=f(k) 
   30 continue
      if(nu.gt.500) then
        ierr=1
        return
      end if
      r=0.
      s=0.
      do 40 k=1,nu
        n1=nu-k+1
        fn1=real(n1)
        r=-(fn1-.5)/(fn1*q1+(fn1+.5)*r)
        s=r*(2.+s)
        if(n1.le.n) rr(n1)=r
   40 continue
      c0=1./(1.+s)
      f(1)=rr(1)*c0
      if(n.gt.1) then
        do 50 k=2,n
          f(k)=rr(k)*f(k-1)
   50   continue
      end if
      do 60 k=1,n
        if(abs(f(k)-f0(k)).gt.eps*abs(f(k))) goto 20
   60 continue
c
c Compute the desired modified resp. ordinary moments in term of
c the above Fourier coefficients.
c
      fnu(1)=pi*c0
      if(n.eq.1) return
      fnu(2)=0.
      if(n.eq.2) return
      if(modmom) then
        c=2.*pi
        do 70 k=3,ndm1,2
          k1=(k-1)/2
          c=-.25*c
          fnu(k)=c*f(k1)
          fnu(k+1)=0.
   70   continue
      else
        c=.5*pi
        fnu(3)=c*(c0-f(1))
        fnu(4)=0.
        c=-c
        do 90 k=5,ndm1,2
          k1=(k-1)/2
          k1m1=k1-1
          c=-.25*c
          c1=1.
          sum=f(k1)
          do 80 i=1,k1m1
            c1=-c1*real(2*k1-i+1)/real(i)
            sum=sum+c1*f(k1-i)
   80     continue
          c1=-c1*real(k1+1)/real(2*k1)
          sum=sum+c1*c0
          fnu(k)=c*sum
          fnu(k+1)=0.
   90   continue
      end if
      end

      subroutine dmm(n,deps,modmom,dom2,dnu,ierrd,d,d0,drr)
c
c This is a double-precision version of the routine  fmm.
c
      double precision deps,dom2,dnu(*),d(n),d0(n),drr(n),dpi,dq,
     *dq1,dr,ds,dn1,dc0,dc,dc1,dsum
      logical modmom
c
c The array  dnu  is assumed to have dimension  2*n.
c
      ierrd=0
      nd=2*n
      ndm1=nd-1
      dpi=4.d0*datan(1.d0)
      dq=dom2/(2.d0-dom2+2.d0*dsqrt(1.d0-dom2))
      dq1=(1.d0+dq*dq)/dq
      do 10 k=1,n
        d(k)=0.d0
   10 continue
      nud=nd
   20 nud=nud+10
      do 30 k=1,n
        d0(k)=d(k)
   30 continue
      if(nud.gt.1000) then
        ierrd=1
        return
      end if
      dr=0.d0
      ds=0.d0
      do 40 k=1,nud
        n1=nud-k+1
        dn1=dble(n1)
        dr=-(dn1-.5d0)/(dn1*dq1+(dn1+.5d0)*dr)
        ds=dr*(2.d0+ds)
        if(n1.le.n) drr(n1)=dr
   40 continue
      dc0=1.d0/(1.d0+ds)
      d(1)=drr(1)*dc0
      if(n.gt.1) then
        do 50 k=2,n
          d(k)=drr(k)*d(k-1)
   50   continue
      end if
      do 60 k=1,n
        if(dabs(d(k)-d0(k)).gt.deps*dabs(d(k))) goto 20
   60 continue
      dnu(1)=dpi*dc0
      if(n.eq.1) return
      dnu(2)=0.d0
      if(n.eq.2) return
      if(modmom) then
        dc=2.d0*dpi
        do 70 k=3,ndm1,2
          k1=(k-1)/2
          dc=-.25d0*dc
          dnu(k)=dc*d(k1)
          dnu(k+1)=0.d0
   70   continue
      else
        dc=.5d0*dpi
        dnu(3)=dc*(dc0-d(1))
        dnu(4)=0.d0
        dc=-dc
        do 90 k=5,ndm1,2
          k1=(k-1)/2
          k1m1=k1-1
          dc=-.25d0*dc
          dc1=1.d0
          dsum=d(k1)
          do 80 i=1,k1m1
            dc1=-dc1*dble(2*k1-i+1)/dble(i)
            dsum=dsum+dc1*d(k1-i)
   80     continue
          dc1=-dc1*dble(k1+1)/dble(2*k1)
          dsum=dsum+dc1*dc0
          dnu(k)=dc*dsum
          dnu(k+1)=0.d0
   90   continue
      end if
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test1.out


 output of test1 with modmom=.true.:


     ierr in cheb = -63  iderr in dcheb =   0


     k         dbeta(k)

     0  0.3224882697440439D+01  0.4455E-07   om2 = 0.100
     1  0.5065840806382684D+00  0.6389E-07
     2  0.2467293493188786D+00  0.3936E-07
     3  0.2499786103248682D+00  0.2604E-07
     4  0.2499997192892933D+00  0.9645E-08
     5  0.2499999953890032D+00  0.1844E-07
     6  0.2499999999151142D+00  0.3395E-09
     7  0.2499999999983251D+00  0.6700E-11
     8  0.2499999999999654D+00  0.1386E-12
     9  0.2499999999999993D+00  0.2998E-14
    10  0.2500000000000000D+00  0.0000E+00
    11  0.2500000000000000D+00  0.0000E+00
    12  0.2500000000000000D+00  0.0000E+00
    13  0.2500000000000000D+00  0.0000E+00
    14  0.2500000000000000D+00  0.0000E+00
    15  0.2500000000000000D+00  0.0000E+00
    16  0.2500000000000000D+00  0.0000E+00
    17  0.2500000000000000D+00  0.0000E+00
    18  0.2500000000000000D+00  0.0000E+00
    19  0.2500000000000000D+00  0.0000E+00
    20  0.2500000000000000D+00  0.0000E+00
    21  0.2500000000000000D+00  0.0000E+00
    22  0.2500000000000000D+00  0.0000E+00
    23  0.2500000000000000D+00  0.0000E+00
    24  0.2500000000000000D+00  0.0000E+00
    25  0.2500000000000000D+00  0.0000E+00
    26  0.2500000000000000D+00  0.0000E+00
    27  0.2500000000000000D+00  0.0000E+00
    28  0.2500000000000000D+00  0.0000E+00
    29  0.2500000000000000D+00  0.0000E+00
    30  0.2500000000000000D+00  0.0000E+00
    31  0.2500000000000000D+00  0.0000E+00
    32  0.2500000000000000D+00  0.0000E+00
    33  0.2500000000000000D+00  0.0000E+00
    34  0.2500000000000000D+00  0.0000E+00
    35  0.2500000000000000D+00  0.0000E+00
    36  0.2500000000000000D+00  0.0000E+00
    37  0.2500000000000000D+00  0.0000E+00
    38  0.2500000000000000D+00  0.0000E+00
    39  0.2500000000000000D+00  0.0000E+00
    40  0.2500000000000000D+00  0.0000E+00
    41  0.2500000000000000D+00  0.0000E+00
    42  0.2500000000000000D+00  0.0000E+00
    43  0.2500000000000000D+00  0.0000E+00
    44  0.2500000000000000D+00  0.0000E+00
    45  0.2500000000000000D+00  0.0000E+00
    46  0.2500000000000000D+00  0.0000E+00
    47  0.2500000000000000D+00  0.0000E+00
    48  0.2500000000000000D+00  0.0000E+00
    49  0.2500000000000000D+00  0.0000E+00
    50  0.2500000000000000D+00  0.0000E+00
    51  0.2500000000000000D+00  0.0000E+00
    52  0.2500000000000000D+00  0.0000E+00
    53  0.2500000000000000D+00  0.0000E+00
    54  0.2500000000000000D+00  0.0000E+00
    55  0.2500000000000000D+00  0.0000E+00
    56  0.2500000000000000D+00  0.0000E+00
    57  0.2500000000000000D+00  0.0000E+00
    58  0.2500000000000000D+00  0.0000E+00
    59  0.2500000000000000D+00  0.0000E+00
    60  0.2500000000000000D+00  0.0000E+00
    61  0.2500000000000000D+00  0.0000E+00
    62  0.2500000000000000D+00  0.0000E+00
    63  0.2500000000000000D+00
    64  0.2500000000000000D+00
    65  0.2500000000000000D+00
    66  0.2500000000000000D+00
    67  0.2500000000000000D+00
    68  0.2500000000000000D+00
    69  0.2500000000000000D+00
    70  0.2500000000000000D+00
    71  0.2500000000000000D+00
    72  0.2500000000000000D+00
    73  0.2500000000000000D+00
    74  0.2500000000000000D+00
    75  0.2500000000000000D+00
    76  0.2500000000000000D+00
    77  0.2500000000000000D+00
    78  0.2500000000000000D+00
    79  0.2500000000000000D+00



     ierr in cheb = -63  iderr in dcheb =   0


     k         dbeta(k)

     0  0.3427778896357582D+01  0.1835E-07   om2 = 0.300
     1  0.5222553571575005D+00  0.7511E-08
     2  0.2391089484344383D+00  0.6128E-08
     3  0.2497633566075744D+00  0.7801E-08
     4  0.2499895949326481D+00  0.1623E-07
     5  0.2499994255652457D+00  0.2684E-07
     6  0.2499999644019889D+00  0.2318E-07
     7  0.2499999976333568D+00  0.9467E-08
     8  0.2499999998350340D+00  0.6599E-09
     9  0.2499999999881027D+00  0.4759E-10
    10  0.2499999999991196D+00  0.3521E-11
    11  0.2499999999999335D+00  0.2659E-12
    12  0.2499999999999949D+00  0.2043E-13
    13  0.2499999999999996D+00  0.1554E-14
    14  0.2500000000000000D+00  0.1110E-15
    15  0.2500000000000000D+00  0.0000E+00
    16  0.2500000000000000D+00  0.0000E+00
    17  0.2500000000000000D+00  0.0000E+00
    18  0.2500000000000000D+00  0.0000E+00
    19  0.2500000000000000D+00  0.0000E+00
    20  0.2500000000000000D+00  0.0000E+00
    21  0.2500000000000000D+00  0.0000E+00
    22  0.2500000000000000D+00  0.0000E+00
    23  0.2500000000000000D+00  0.0000E+00
    24  0.2500000000000000D+00  0.0000E+00
    25  0.2500000000000000D+00  0.0000E+00
    26  0.2500000000000000D+00  0.0000E+00
    27  0.2500000000000000D+00  0.0000E+00
    28  0.2500000000000000D+00  0.0000E+00
    29  0.2500000000000000D+00  0.0000E+00
    30  0.2500000000000000D+00  0.0000E+00
    31  0.2500000000000000D+00  0.0000E+00
    32  0.2500000000000000D+00  0.0000E+00
    33  0.2500000000000000D+00  0.0000E+00
    34  0.2500000000000000D+00  0.0000E+00
    35  0.2500000000000000D+00  0.0000E+00
    36  0.2500000000000000D+00  0.0000E+00
    37  0.2500000000000000D+00  0.0000E+00
    38  0.2500000000000000D+00  0.0000E+00
    39  0.2500000000000000D+00  0.0000E+00
    40  0.2500000000000000D+00  0.0000E+00
    41  0.2500000000000000D+00  0.0000E+00
    42  0.2500000000000000D+00  0.0000E+00
    43  0.2500000000000000D+00  0.0000E+00
    44  0.2500000000000000D+00  0.0000E+00
    45  0.2500000000000000D+00  0.0000E+00
    46  0.2500000000000000D+00  0.0000E+00
    47  0.2500000000000000D+00  0.0000E+00
    48  0.2500000000000000D+00  0.0000E+00
    49  0.2500000000000000D+00  0.0000E+00
    50  0.2500000000000000D+00  0.0000E+00
    51  0.2500000000000000D+00  0.0000E+00
    52  0.2500000000000000D+00  0.0000E+00
    53  0.2500000000000000D+00  0.0000E+00
    54  0.2500000000000000D+00  0.0000E+00
    55  0.2500000000000000D+00  0.0000E+00
    56  0.2500000000000000D+00  0.0000E+00
    57  0.2500000000000000D+00  0.0000E+00
    58  0.2500000000000000D+00  0.0000E+00
    59  0.2500000000000000D+00  0.0000E+00
    60  0.2500000000000000D+00  0.0000E+00
    61  0.2500000000000000D+00  0.0000E+00
    62  0.2500000000000000D+00  0.0000E+00
    63  0.2500000000000000D+00
    64  0.2500000000000000D+00
    65  0.2500000000000000D+00
    66  0.2500000000000000D+00
    67  0.2500000000000000D+00
    68  0.2500000000000000D+00
    69  0.2500000000000000D+00
    70  0.2500000000000000D+00
    71  0.2500000000000000D+00
    72  0.2500000000000000D+00
    73  0.2500000000000000D+00
    74  0.2500000000000000D+00
    75  0.2500000000000000D+00
    76  0.2500000000000000D+00
    77  0.2500000000000000D+00
    78  0.2500000000000000D+00
    79  0.2500000000000000D+00



     ierr in cheb = -63  iderr in dcheb =   0


     k         dbeta(k)

     0  0.3708149354602744D+01  0.8547E-07   om2 = 0.500
     1  0.5430534189555363D+00  0.5385E-07
     2  0.2293202676904704D+00  0.2230E-07
     3  0.2491525790663758D+00  0.2728E-07
     4  0.2499288948105139D+00  0.1261E-07
     5  0.2499924766475490D+00  0.6936E-08
     6  0.2499991045593935D+00  0.5484E-08
     7  0.2499998855221811D+00  0.1893E-07
     8  0.2499999846431723D+00  0.1823E-08
     9  0.2499999978674175D+00  0.8530E-08
    10  0.2499999996960280D+00  0.1216E-08
    11  0.2499999999557818D+00  0.1769E-09
    12  0.2499999999934617D+00  0.2615E-10
    13  0.2499999999990202D+00  0.3919E-11
    14  0.2499999999998515D+00  0.5939E-12
    15  0.2499999999999773D+00  0.9082E-13
    16  0.2499999999999965D+00  0.1399E-13
    17  0.2499999999999994D+00  0.2220E-14
    18  0.2499999999999999D+00  0.3331E-15
    19  0.2500000000000000D+00  0.0000E+00
    20  0.2500000000000000D+00  0.0000E+00
    21  0.2500000000000000D+00  0.0000E+00
    22  0.2500000000000000D+00  0.0000E+00
    23  0.2500000000000000D+00  0.0000E+00
    24  0.2500000000000000D+00  0.0000E+00
    25  0.2500000000000000D+00  0.0000E+00
    26  0.2500000000000000D+00  0.0000E+00
    27  0.2500000000000000D+00  0.0000E+00
    28  0.2500000000000000D+00  0.0000E+00
    29  0.2500000000000000D+00  0.0000E+00
    30  0.2500000000000000D+00  0.0000E+00
    31  0.2500000000000000D+00  0.0000E+00
    32  0.2500000000000000D+00  0.0000E+00
    33  0.2500000000000000D+00  0.0000E+00
    34  0.2500000000000000D+00  0.0000E+00
    35  0.2500000000000000D+00  0.0000E+00
    36  0.2500000000000000D+00  0.0000E+00
    37  0.2500000000000000D+00  0.0000E+00
    38  0.2500000000000000D+00  0.0000E+00
    39  0.2500000000000000D+00  0.0000E+00
    40  0.2500000000000000D+00  0.0000E+00
    41  0.2500000000000000D+00  0.0000E+00
    42  0.2500000000000000D+00  0.0000E+00
    43  0.2500000000000000D+00  0.0000E+00
    44  0.2500000000000000D+00  0.0000E+00
    45  0.2500000000000000D+00  0.0000E+00
    46  0.2500000000000000D+00  0.0000E+00
    47  0.2500000000000000D+00  0.0000E+00
    48  0.2500000000000000D+00  0.0000E+00
    49  0.2500000000000000D+00  0.0000E+00
    50  0.2500000000000000D+00  0.0000E+00
    51  0.2500000000000000D+00  0.0000E+00
    52  0.2500000000000000D+00  0.0000E+00
    53  0.2500000000000000D+00  0.0000E+00
    54  0.2500000000000000D+00  0.0000E+00
    55  0.2500000000000000D+00  0.0000E+00
    56  0.2500000000000000D+00  0.0000E+00
    57  0.2500000000000000D+00  0.0000E+00
    58  0.2500000000000000D+00  0.0000E+00
    59  0.2500000000000000D+00  0.0000E+00
    60  0.2500000000000000D+00  0.0000E+00
    61  0.2500000000000000D+00  0.0000E+00
    62  0.2500000000000000D+00  0.0000E+00
    63  0.2500000000000000D+00
    64  0.2500000000000000D+00
    65  0.2500000000000000D+00
    66  0.2500000000000000D+00
    67  0.2500000000000000D+00
    68  0.2500000000000000D+00
    69  0.2500000000000000D+00
    70  0.2500000000000000D+00
    71  0.2500000000000000D+00
    72  0.2500000000000000D+00
    73  0.2500000000000000D+00
    74  0.2500000000000000D+00
    75  0.2500000000000000D+00
    76  0.2500000000000000D+00
    77  0.2500000000000000D+00
    78  0.2500000000000000D+00
    79  0.2500000000000000D+00



     ierr in cheb = -63  iderr in dcheb =   0


     k         dbeta(k)

     0  0.4150726270584937D+01  0.1151E-07   om2 = 0.700
     1  0.5738703563104108D+00  0.7913E-08
     2  0.2153897141137676D+00  0.2176E-08
     3  0.2476685096417082D+00  0.4027E-07
     4  0.2496725302864942D+00  0.5249E-07
     5  0.2499416058341949D+00  0.4568E-07
     6  0.2499882473788614D+00  0.4203E-07
     7  0.2499974543472129D+00  0.9783E-08
     8  0.2499994207099762D+00  0.7421E-08
     9  0.2499998634212174D+00  0.4973E-07
    10  0.2499999669283869D+00  0.1308E-07
    11  0.2499999918236198D+00  0.3271E-07
    12  0.2499999979445509D+00  0.8222E-08
    13  0.2499999994761780D+00  0.2095E-08
    14  0.2499999998649768D+00  0.5401E-09
    15  0.2499999999648584D+00  0.1406E-09
    16  0.2499999999907779D+00  0.3689E-10
    17  0.2499999999975625D+00  0.9750E-11
    18  0.2499999999993517D+00  0.2593E-11
    19  0.2499999999998266D+00  0.6936E-12
    20  0.2499999999999534D+00  0.1864E-12
    21  0.2499999999999874D+00  0.5029E-13
    22  0.2499999999999966D+00  0.1354E-13
    23  0.2499999999999991D+00  0.3775E-14
    24  0.2499999999999997D+00  0.1110E-14
    25  0.2499999999999999D+00  0.2220E-15
    26  0.2500000000000000D+00  0.0000E+00
    27  0.2500000000000000D+00  0.0000E+00
    28  0.2500000000000000D+00  0.0000E+00
    29  0.2500000000000000D+00  0.0000E+00
    30  0.2500000000000000D+00  0.0000E+00
    31  0.2500000000000000D+00  0.0000E+00
    32  0.2500000000000000D+00  0.0000E+00
    33  0.2500000000000000D+00  0.0000E+00
    34  0.2500000000000000D+00  0.0000E+00
    35  0.2500000000000000D+00  0.0000E+00
    36  0.2500000000000000D+00  0.0000E+00
    37  0.2500000000000000D+00  0.0000E+00
    38  0.2500000000000000D+00  0.0000E+00
    39  0.2500000000000000D+00  0.0000E+00
    40  0.2500000000000000D+00  0.0000E+00
    41  0.2500000000000000D+00  0.0000E+00
    42  0.2500000000000000D+00  0.0000E+00
    43  0.2500000000000000D+00  0.0000E+00
    44  0.2500000000000000D+00  0.0000E+00
    45  0.2500000000000000D+00  0.0000E+00
    46  0.2500000000000000D+00  0.0000E+00
    47  0.2500000000000000D+00  0.0000E+00
    48  0.2500000000000000D+00  0.0000E+00
    49  0.2500000000000000D+00  0.0000E+00
    50  0.2500000000000000D+00  0.0000E+00
    51  0.2500000000000000D+00  0.0000E+00
    52  0.2500000000000000D+00  0.0000E+00
    53  0.2500000000000000D+00  0.0000E+00
    54  0.2500000000000000D+00  0.0000E+00
    55  0.2500000000000000D+00  0.0000E+00
    56  0.2500000000000000D+00  0.0000E+00
    57  0.2500000000000000D+00  0.0000E+00
    58  0.2500000000000000D+00  0.0000E+00
    59  0.2500000000000000D+00  0.0000E+00
    60  0.2500000000000000D+00  0.0000E+00
    61  0.2500000000000000D+00  0.0000E+00
    62  0.2500000000000000D+00  0.0000E+00
    63  0.2500000000000000D+00
    64  0.2500000000000000D+00
    65  0.2500000000000000D+00
    66  0.2500000000000000D+00
    67  0.2500000000000000D+00
    68  0.2500000000000000D+00
    69  0.2500000000000000D+00
    70  0.2500000000000000D+00
    71  0.2500000000000000D+00
    72  0.2500000000000000D+00
    73  0.2500000000000000D+00
    74  0.2500000000000000D+00
    75  0.2500000000000000D+00
    76  0.2500000000000000D+00
    77  0.2500000000000000D+00
    78  0.2500000000000000D+00
    79  0.2500000000000000D+00



     ierr in cheb = -63  iderr in dcheb =   0


     k         dbeta(k)

     0  0.5156184226696345D+01  0.9834E-07   om2 = 0.900
     1  0.6349731661452458D+00  0.9036E-07
     2  0.1891491669986444D+00  0.1005E-06
     3  0.2432300686739867D+00  0.3672E-07
     4  0.2483762717470557D+00  0.3351E-07
     5  0.2494981460742502D+00  0.9147E-08
     6  0.2498235644120524D+00  0.2337E-07
     7  0.2499329382129534D+00  0.3337E-07
     8  0.2499731424622582D+00  0.8219E-07
     9  0.2499888334872044D+00  0.9704E-07
    10  0.2499952249211057D+00  0.2683E-07
    11  0.2499979128874325D+00  0.5581E-07
    12  0.2499990716489163D+00  0.1792E-07
    13  0.2499995811151635D+00  0.6609E-08
    14  0.2499998087271980D+00  0.9769E-08
    15  0.2499999117758036D+00  0.5487E-07
    16  0.2499999589541523D+00  0.1463E-07
    17  0.2499999807604576D+00  0.4225E-07
    18  0.2499999909227214D+00  0.3631E-07
    19  0.2499999956925950D+00  0.1723E-07
    20  0.2499999979455537D+00  0.8218E-08
    21  0.2499999990156326D+00  0.3937E-08
    22  0.2499999995264097D+00  0.1894E-08
    23  0.2499999997713032D+00  0.9148E-09
    24  0.2499999998891894D+00  0.4432E-09
    25  0.2499999999461436D+00  0.2154E-09
    26  0.2499999999737507D+00  0.1050E-09
    27  0.2499999999871732D+00  0.5131E-10
    28  0.2499999999937171D+00  0.2513E-10
    29  0.2499999999969157D+00  0.1234E-10
    30  0.2499999999984828D+00  0.6069E-11
    31  0.2499999999992522D+00  0.2991E-11
    32  0.2499999999996308D+00  0.1477E-11
    33  0.2499999999998174D+00  0.7303E-12
    34  0.2499999999999096D+00  0.3617E-12
    35  0.2499999999999551D+00  0.1794E-12
    36  0.2499999999999777D+00  0.8915E-13
    37  0.2499999999999889D+00  0.4430E-13
    38  0.2499999999999945D+00  0.2209E-13
    39  0.2499999999999973D+00  0.1099E-13
    40  0.2499999999999986D+00  0.5440E-14
    41  0.2499999999999993D+00  0.2776E-14
    42  0.2499999999999997D+00  0.1332E-14
    43  0.2499999999999998D+00  0.7772E-15
    44  0.2499999999999999D+00  0.3331E-15
    45  0.2499999999999999D+00  0.2220E-15
    46  0.2499999999999999D+00  0.2220E-15
    47  0.2500000000000000D+00  0.0000E+00
    48  0.2500000000000000D+00  0.0000E+00
    49  0.2500000000000000D+00  0.0000E+00
    50  0.2500000000000000D+00  0.0000E+00
    51  0.2500000000000000D+00  0.0000E+00
    52  0.2500000000000000D+00  0.0000E+00
    53  0.2500000000000000D+00  0.0000E+00
    54  0.2500000000000000D+00  0.0000E+00
    55  0.2500000000000000D+00  0.0000E+00
    56  0.2500000000000000D+00  0.0000E+00
    57  0.2500000000000000D+00  0.0000E+00
    58  0.2500000000000000D+00  0.0000E+00
    59  0.2500000000000000D+00  0.0000E+00
    60  0.2500000000000000D+00  0.0000E+00
    61  0.2500000000000000D+00  0.0000E+00
    62  0.2500000000000000D+00  0.0000E+00
    63  0.2500000000000000D+00
    64  0.2500000000000000D+00
    65  0.2500000000000000D+00
    66  0.2500000000000000D+00
    67  0.2500000000000000D+00
    68  0.2500000000000000D+00
    69  0.2500000000000000D+00
    70  0.2500000000000000D+00
    71  0.2500000000000000D+00
    72  0.2500000000000000D+00
    73  0.2500000000000000D+00
    74  0.2500000000000000D+00
    75  0.2500000000000000D+00
    76  0.2500000000000000D+00
    77  0.2500000000000000D+00
    78  0.2500000000000000D+00
    79  0.2500000000000000D+00



     ierr in cheb = -64  iderr in dcheb =   0


     k         dbeta(k)

     0  0.7391274725979743D+01  0.3704E-07   om2 = 0.990
     1  0.7324070684920273D+00  0.3353E-07
     2  0.1479427849683387D+00  0.2379E-07
     3  0.2338554949163392D+00  0.3849E-07
     4  0.2443419680995167D+00  0.5529E-07
     5  0.2473968641083465D+00  0.2967E-07
     6  0.2486202548943184D+00  0.7591E-08
     7  0.2492022455253280D+00  0.2371E-07
     8  0.2495108348820873D+00  0.1883E-07
     9  0.2496871092764910D+00  0.1546E-07
    10  0.2497933988931582D+00  0.1398E-07
    11  0.2498601662192156D+00  0.5139E-08
    12  0.2499034676221020D+00  0.1063E-07
    13  0.2499322763973436D+00  0.6832E-07
    14  0.2499518462973810D+00  0.9183E-07
    15  0.2499653717034653D+00  0.8009E-08
    16  0.2499748562994608D+00  0.2177E-07
    17  0.2499815900555124D+00  0.3157E-07
    18  0.2499864219462822D+00  0.7199E-07
    19  0.2499899213248305D+00  0.9725E-07
    20  0.2499924762634408D+00  0.5421E-07
    21  0.2499943550268148D+00  0.4934E-07
    22  0.2499957453603630D+00  0.2837E-07
    23  0.2499967800924363D+00  0.5027E-08
    24  0.2499975541062352D+00  0.5119E-07
    25  0.2499981357626615D+00  0.6369E-08
    26  0.2499985746929870D+00  0.8042E-07
    27  0.2499989071796164D+00  0.2014E-07
    28  0.2499991599119596D+00  0.2249E-07
    29  0.2499993526338357D+00  0.2647E-07
    30  0.2499995000261038D+00  0.2666E-07
    31  0.2499996130562137D+00  0.5766E-07
    32  0.2499996999526960D+00  0.5151E-07
    33  0.2499997669135220D+00  0.3828E-07
    34  0.2499998186241540D+00  0.4936E-07
    35  0.2499998586385341D+00  0.8861E-07
    36  0.2499998896607162D+00  0.3548E-07
    37  0.2499999137540386D+00  0.1264E-07
    38  0.2499999324971600D+00  0.3159E-07
    39  0.2499999471009278D+00  0.2682E-07
    40  0.2499999584962413D+00  0.1280E-07
    41  0.2499999674003378D+00  0.7079E-07
    42  0.2499999743669626D+00  0.4293E-07
    43  0.2499999798244580D+00  0.2110E-07
    44  0.2499999841047608D+00  0.3976E-08
    45  0.2499999874655373D+00  0.5014E-07
    46  0.2499999901071225D+00  0.2003E-07
    47  0.2499999921855119D+00  0.2835E-07
    48  0.2499999938223503D+00  0.2471E-07
    49  0.2499999951126235D+00  0.1955E-07
    50  0.2499999961305969D+00  0.1548E-07
    51  0.2499999969344065D+00  0.1226E-07
    52  0.2499999975696146D+00  0.9722E-08
    53  0.2499999980719688D+00  0.7712E-08
    54  0.2499999984695460D+00  0.6122E-08
    55  0.2499999987844202D+00  0.4862E-08
    56  0.2499999990339629D+00  0.3864E-08
    57  0.2499999992318568D+00  0.3073E-08
    58  0.2499999993888895D+00  0.2444E-08
    59  0.2499999995135723D+00  0.1946E-08
    60  0.2499999996126265D+00  0.1549E-08
    61  0.2499999996913634D+00  0.1235E-08
    62  0.2499999997539839D+00  0.9841E-09
    63  0.2499999998038123D+00  0.7848E-09
    64  0.2499999998434816D+00
    65  0.2499999998750779D+00
    66  0.2499999999002561D+00
    67  0.2499999999203286D+00
    68  0.2499999999363379D+00
    69  0.2499999999491117D+00
    70  0.2499999999593081D+00
    71  0.2499999999674503D+00
    72  0.2499999999739546D+00
    73  0.2499999999791525D+00
    74  0.2499999999833077D+00
    75  0.2499999999866307D+00
    76  0.2499999999892890D+00
    77  0.2499999999914163D+00
    78  0.2499999999931191D+00
    79  0.2499999999944826D+00



     ierr in cheb = -64  iderr in dcheb =   0


     k         dbeta(k)

     0  0.9682265121100620D+01  0.5091E-06   om2 = 0.999
     1  0.7937821421385184D+00  0.4088E-07
     2  0.1198676724605757D+00  0.1031E-06
     3  0.2270401183698990D+00  0.2797E-07
     4  0.2410608787266061D+00  0.7874E-07
     5  0.2454285325203698D+00  0.1208E-06
     6  0.2473016530297635D+00  0.1205E-06
     7  0.2482587060199245D+00  0.7568E-07
     8  0.2488056563182398D+00  0.5703E-07
     9  0.2491436516500236D+00  0.2602E-07
    10  0.2493649425541733D+00  0.9702E-09
    11  0.2495164122910211D+00  0.5842E-07
    12  0.2496238132093984D+00  0.2795E-07
    13  0.2497021807830056D+00  0.1009E-06
    14  0.2497607367186781D+00  0.1867E-07
    15  0.2498053715523733D+00  0.1754E-07
    16  0.2498399785559650D+00  0.5113E-07
    17  0.2498672067961906D+00  0.9548E-07
    18  0.2498889044665883D+00  0.8974E-07
    19  0.2499063894398209D+00  0.6549E-07
    20  0.2499206196165232D+00  0.7594E-08
    21  0.2499323031609509D+00  0.5616E-07
    22  0.2499419715850828D+00  0.1318E-07
    23  0.2499500292585915D+00  0.2860E-07
    24  0.2499567876037904D+00  0.3886E-08
    25  0.2499624891284641D+00  0.1860E-07
    26  0.2499673245856653D+00  0.7094E-07
    27  0.2499714454036621D+00  0.1589E-07
    28  0.2499749728090034D+00  0.2704E-07
    29  0.2499780046038181D+00  0.6474E-07
    30  0.2499806202568039D+00  0.2667E-07
    31  0.2499828847669806D+00  0.2481E-07
    32  0.2499848516240894D+00  0.3519E-07
    33  0.2499865650969887D+00  0.3583E-07
    34  0.2499880620172149D+00  0.8611E-08
    35  0.2499893731797996D+00  0.5044E-07
    36  0.2499905244514168D+00  0.5325E-07
    37  0.2499915376529289D+00  0.6566E-07
    38  0.2499924312667191D+00  0.4227E-08
    39  0.2499932210069769D+00  0.5546E-07
    40  0.2499939202820711D+00  0.5978E-07
    41  0.2499945405714168D+00  0.9680E-07
    42  0.2499950917341831D+00  0.8274E-07
    43  0.2499955822633681D+00  0.3163E-07
    44  0.2499960194958428D+00  0.5203E-07
    45  0.2499964097867342D+00  0.5574E-07
    46  0.2499967586547835D+00  0.3117E-07
    47  0.2499970709039761D+00  0.2573E-07
    48  0.2499973507256852D+00  0.7213E-07
    49  0.2499976017847489D+00  0.5612E-07
    50  0.2499978272922483D+00  0.7105E-07
    51  0.2499980300672327D+00  0.7152E-07
    52  0.2499982125892303D+00  0.2914E-08
    53  0.2499983770430456D+00  0.5078E-08
    54  0.2499985253570834D+00  0.6189E-07
    55  0.2499986592362184D+00  0.5824E-07
    56  0.2499987801900603D+00  0.5126E-07
    57  0.2499988895573149D+00  0.3103E-07
    58  0.2499989885268306D+00  0.7223E-08
    59  0.2499990781558206D+00  0.8111E-08
    60  0.2499991593856739D+00  0.2460E-07
    61  0.2499992330557006D+00  0.9127E-07
    62  0.2499992999151069D+00  0.1079E-08
    63  0.2499993606334448D+00  0.5407E-07
    64  0.2499994158097500D+00
    65  0.2499994659805437D+00
    66  0.2499995116268533D+00
    67  0.2499995531803819D+00
    68  0.2499995910289366D+00
    69  0.2499996255212145D+00
    70  0.2499996569710255D+00
    71  0.2499996856610261D+00
    72  0.2499997118460227D+00
    73  0.2499997357559000D+00
    74  0.2499997575982187D+00
    75  0.2499997775605240D+00
    76  0.2499997958123975D+00
    77  0.2499998125072858D+00
    78  0.2499998277841293D+00
    79  0.2499998417688158D+00



     output of test1 with modmom=.false.:


     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.3224882697440439D+01  0.4455E-07   om2 = 0.100
     1  0.5065840806382684D+00  0.6389E-07
     2  0.2467293493188786D+00  0.1418E-06
     3  0.2499786103248682D+00  0.1874E-05
     4  0.2499997192892926D+00  0.9546E-05
     5  0.2499999953890083D+00  0.3256E-04
     6  0.2499999999150908D+00  0.3135E-04
     7  0.2499999999983260D+00  0.5129E-03
     8  0.2500000000009123D+00  0.4673E-02
     9  0.2499999999901079D+00  0.2438E-01
    10  0.2500000000685936D+00  0.9031E-01
    11  0.2499999996389498D+00  0.1991E+00
    12  0.2500000014513231D+00  0.2016E+00
    13  0.2499999957829707D+00  0.4280E+00
    14  0.2500000070877687D+00  0.2886E+02
    15  0.2500000009951773D+00  0.3742E+02
    16  0.2500000107210107D+00  0.4101E+00
    17  0.2499992469506712D+00  0.1742E+01
    18  0.2500065645269862D+00  0.1945E+01
    19  0.2499796634521028D+00  0.8013E+02



     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.3427778896357582D+01  0.1835E-07   om2 = 0.300
     1  0.5222553571575005D+00  0.7511E-08
     2  0.2391089484344384D+00  0.1185E-06
     3  0.2497633566075742D+00  0.3061E-06
     4  0.2499895949326472D+00  0.4844E-05
     5  0.2499994255652554D+00  0.2142E-04
     6  0.2499999644019470D+00  0.6487E-04
     7  0.2499999976333964D+00  0.2793E-03
     8  0.2499999998356886D+00  0.2492E-02
     9  0.2499999999831448D+00  0.2121E-01
    10  0.2500000000162770D+00  0.1476E+00
    11  0.2499999999978861D+00  0.7995E+00
    12  0.2499999996953833D+00  0.2113E+02
    13  0.2500000011755646D+00  0.2513E+02
    14  0.2500000062374606D+00  0.1138E+01
    15  0.2499998854913680D+00  0.6128E+01
    16  0.2500009042717911D+00  0.9670E+01
    17  0.2499948797421555D+00  0.1990E+01
    18  0.2500230685499816D+00  0.1611E+01
    19  0.2499150136736271D+00  0.1333E+02



     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.3708149354602744D+01  0.8547E-07   om2 = 0.500
     1  0.5430534189555363D+00  0.5591E-07
     2  0.2293202676904705D+00  0.3472E-06
     3  0.2491525790663762D+00  0.3252E-07
     4  0.2499288948105094D+00  0.4902E-05
     5  0.2499924766475720D+00  0.2282E-04
     6  0.2499991045593027D+00  0.3218E-04
     7  0.2499998855226142D+00  0.3094E-03
     8  0.2499999846406274D+00  0.3284E-02
     9  0.2499999978807380D+00  0.2188E-01
    10  0.2499999996461215D+00  0.1326E+00
    11  0.2500000000258533D+00  0.6666E+00
    12  0.2500000007328170D+00  0.9258E+01
    13  0.2499999916513320D+00  0.1209E+02
    14  0.2500000558108446D+00  0.1152E+01
    15  0.2499996948146759D+00  0.1738E+02
    16  0.2500015416717071D+00  0.2458E+02
    17  0.2499921777258300D+00  0.1270E+01
    18  0.2500414800210475D+00  0.6884E+01
    19  0.2497760126280253D+00  0.5304E+01



     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.4150726270584937D+01  0.1151E-07   om2 = 0.700
     1  0.5738703563104108D+00  0.7913E-08
     2  0.2153897141137676D+00  0.1362E-06
     3  0.2476685096417082D+00  0.1584E-05
     4  0.2496725302864924D+00  0.7468E-05
     5  0.2499416058342092D+00  0.3042E-04
     6  0.2499882473788146D+00  0.1753E-03
     7  0.2499974543472413D+00  0.1063E-02
     8  0.2499994207100795D+00  0.4757E-02
     9  0.2499998634262263D+00  0.1520E-01
    10  0.2499999668487462D+00  0.5062E-01
    11  0.2499999925266546D+00  0.3462E+00
    12  0.2499999932406109D+00  0.5056E+01
    13  0.2500000263274454D+00  0.1070E+02
    14  0.2499998582889955D+00  0.9180E+00
    15  0.2500007380120277D+00  0.8260E+02
    16  0.2499960088164379D+00  0.8147E+02
    17  0.2500225583809277D+00  0.1041E+01
    18  0.2498706464877776D+00  0.3860E+00
    19  0.2507223038714711D+00  0.2988E+02



     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.5156184226696345D+01  0.9834E-07   om2 = 0.900
     1  0.6349731661452459D+00  0.3509E-08
     2  0.1891491669986443D+00  0.1358E-06
     3  0.2432300686739877D+00  0.1446E-05
     4  0.2483762717470493D+00  0.1167E-04
     5  0.2494981460742808D+00  0.4749E-04
     6  0.2498235644119290D+00  0.1623E-03
     7  0.2499329382132737D+00  0.5401E-03
     8  0.2499731424624442D+00  0.1865E-02
     9  0.2499888334787964D+00  0.9540E-02
    10  0.2499952249992836D+00  0.8491E-01
    11  0.2499979122230124D+00  0.6933E+00
    12  0.2499990770089473D+00  0.1489E+02
    13  0.2499995426985118D+00  0.1886E+02
    14  0.2500000479452703D+00  0.9590E+00
    15  0.2499986057058711D+00  0.5634E+02
    16  0.2500063382724061D+00  0.5140E+02
    17  0.2499715478858709D+00  0.9021E+00
    18  0.2501167646658243D+00  0.2213E+01
    19  0.2495632114932664D+00  0.3497E+02



     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.7391274725979743D+01  0.2951E-06   om2 = 0.990
     1  0.7324070684920273D+00  0.1292E-06
     2  0.1479427849683387D+00  0.1185E-05
     3  0.2338554949163384D+00  0.3989E-05
     4  0.2443419680995219D+00  0.1897E-04
     5  0.2473968641083223D+00  0.1348E-03
     6  0.2486202548944126D+00  0.8854E-03
     7  0.2492022455251514D+00  0.5001E-02
     8  0.2495108348811709D+00  0.2685E-01
     9  0.2496871092895860D+00  0.1454E+00
    10  0.2497933987924980D+00  0.9548E+00
    11  0.2498601667998225D+00  0.3136E+01
    12  0.2499034652965560D+00  0.4361E+01
    13  0.2499322789059014D+00  0.2561E+01
    14  0.2499519068184984D+00  0.1500E+01
    15  0.2499646455128907D+00  0.1175E+02
    16  0.2499801914481738D+00  0.6091E+01
    17  0.2499533091026541D+00  0.1022E+01
    18  0.2500760248620497D+00  0.2795E+03
    19  0.2501789034841746D+00  0.2816E+03



     ierr in cheb =   0  iderr in dcheb =   0


     k         dbeta(k)

     0  0.9682265121100620D+01  0.5091E-06   om2 = 0.999
     1  0.7937821421385184D+00  0.4088E-07
     2  0.1198676724605758D+00  0.5382E-06
     3  0.2270401183698971D+00  0.2729E-05
     4  0.2410608787266184D+00  0.1111E-04
     5  0.2454285325203062D+00  0.7255E-04
     6  0.2473016530299629D+00  0.7048E-03
     7  0.2482587060203270D+00  0.5800E-02
     8  0.2488056563086521D+00  0.3512E-01
     9  0.2491436517175114D+00  0.1611E+00
    10  0.2493649422310504D+00  0.4443E+00
    11  0.2495164135934172D+00  0.1003E+01
    12  0.2496238075565044D+00  0.4482E+00
    13  0.2497022127940701D+00  0.1590E+01
    14  0.2497605235925688D+00  0.4506E+02
    15  0.2498067527544288D+00  0.3060E+02
    16  0.2498320547513738D+00  0.1102E+00
    17  0.2499059403317540D+00  0.2374E+01
    18  0.2497299173199733D+00  0.3083E+01
    19  0.2504688582556583D+00  0.1402E+01


C-END-OF-FILE

cat <<C-END-OF-FILE > test2.f
c
c
      program test2
c
c
      dimension a(199),b(199),fnu(200),alpha(100),beta(100),s(100),
     *s0(200),s1(200),s2(200)
      double precision dsigma,da(199),db(199),dnu(200),dalpha(100),
     *dbeta(100),ds(100),ds0(200),ds1(200),ds2(200)
      logical modmom,intexp
c
c This test generates the first n recursion coefficients for the
c orthogonal polynomials relative to the weight function
c
c        (x**sigma)*ln(1/x)  on (0,1],  sigma = -.5, 0, .5,
c
c where n=100 when using modified (Legendre) moments, and n=12 when
c using ordinary moments. It prints the double-precision values of the
c coefficients as well as the relative errors of the respective single-
c precision values and the maximum relative errors.
c
      modmom=.true.
c
c Generate the recursion coefficients for the polynomials defining the
c modified resp. ordinary moments.
c
      if(modmom) then
        n=100
        ndm1=2*n-1
        call recur(ndm1,2,0.,0.,a,b,ierr)
        call drecur(ndm1,2,0.d0,0.d0,da,db,iderr)
      else 
        n=12
        ndm1=2*n-1
        do 10 k=1,ndm1
          a(k)=0.
          b(k)=0.
          da(k)=0.d0
          db(k)=0.d0
   10   continue
      end if
      do 30 is=1,3
        dsigma=-.5d0+.5d0*dble(is-1)
        sigma=sngl(dsigma)
        if(is.eq.2) then
          intexp=.true.
        else
          intexp=.false.
        end if
c
c Compute the modified resp. ordinary moments using Eqs. (3.12) and
c (3.11) of the companion paper. On machines with limited exponent
c range, some of the high-order modified moments may underflow, without
c this having any deteriorating effect on the accuracy.
c
        call fmm(n,modmom,intexp,sigma,fnu)
        call dmm(n,modmom,intexp,dsigma,dnu)
c
c Compute the desired recursion coefficients by means of the modified
c Chebyshev algorithm; for the latter, see, e.g., Section 2.4 of
c W. Gautschi, ``On generating orthogonal polynomials'', SIAM J. Sci.
c Statist. Comput. 3, 1982, 289-317.
c
        call cheb(n,a,b,fnu,alpha,beta,s,ierr,s0,s1,s2)
c
c On machines with limited single-precision exponent range, the routine
c cheb  may generate an underflow exception, which however is harmless
c and can be ignored.
c
        call dcheb(n,da,db,dnu,dalpha,dbeta,ds,iderr,ds0,ds1,ds2)
        write(*,1) ierr,iderr
    1   format(/6x,'ierr in cheb = ',i4,' iderr in dcheb = ',i4/)
c
c Compute and print the relative errors and their maxima.
c
        eamax=0.
        ebmax=0.
        write(*,2) sigma
    2   format(/21x,'sigma =',f5.1)
        write(*,3)
    3   format(/3x,'k',9x,'dalpha(k)',15x,'dbeta(k)'/)
        do 20 k=1,n
          km1=k-1
          if(iderr.eq.0 .or. km1.lt.abs(iderr)) then
            write(*,4) km1,dalpha(k),dbeta(k)
    4       format(1x,i3,2d24.16)
            if(ierr.eq.0 .or. km1.lt.abs(ierr)) then
              erra=sngl(dabs(dble(alpha(k))-dalpha(k))/dalpha(k))
              errb=sngl(dabs(dble(beta(k))-dbeta(k))/dbeta(k))
              write(*,5) erra,errb
    5         format(4x,e12.4,21x,e12.4)
              if(erra.gt.eamax) then
                eamax=erra
                kamax=km1
              end if
              if(errb.gt.ebmax) then
                ebmax=errb
                kbmax=km1
              end if
            end if
          end if
   20   continue
        write(*,6) eamax,kamax,ebmax,kbmax
    6   format(/2x,'eamax =',e11.4,' at',i3,4x,'ebmax =',e11.4,
     *    ' at',i3//)
   30 continue
      stop
      end

      subroutine fmm(n,modmom,intexp,sigma,fnu)
c
c This generates the first  2*n  modified moments (if modmom=.true.)
c relative to shifted monic Legendre polynomials, using Eq. (3.12) of
c the companion paper, and the first  2*n  ordinary moments (if modmom
c =.false.) by Eq. (3.11), of the weight function
c
c          (x**sigma)*ln(1/x)  on (0,1],   sigma > -1,
c
c for sigma an integer (if intexp=.true.) or a real number (if intexp
c =.false.). In either case, the input variable  sigma  is of type real.
c
      dimension fnu(*)
      logical modmom,intexp
c
c The array  fnu  is assumed to have dimension  2*n.
c
      nd=2*n
      sigp1=sigma+1.
      if(modmom) then
        isigma=int(sigma)
        isigp1=isigma+1
        isigp2=isigma+2
        isigp3=isigma+3
        if(intexp .and. isigp1.lt.nd) then
          kmax=isigp1
        else
          kmax=nd
        end if
        c=1.
        do 20 k=1,kmax
          km1=k-1
          fk=real(k)
          p=1.
          s=1./sigp1
          if(kmax.gt.1) then
            do 10 i=1,km1
              fi=real(i)
              p=(sigp1-fi)*p/(sigp1+fi)
              s=s+1./(sigp1+fi)-1./(sigp1-fi)
   10       continue
          end if
          fnu(k)=c*s*p/sigp1
          c=fk*c/(4.*fk-2.)
   20   continue
        if(.not.intexp .or. isigp1.ge.nd) return
        q=-.5
        if(isigma.gt.0) then
          do 30 iq=1,isigma
            fiq=real(iq)
            q=fiq*fiq*q/((2.*fiq+1.)*(2.*fiq+2.))
   30     continue
        end if
        fnu(isigp2)=c*q
        if(isigp2.eq.nd) return
        do 40 k=isigp3,nd
          km1=k-1
          fkm1=real(km1)
          fnu(k)=-fkm1*(fkm1-sigp1)*fnu(km1)/((4.*fkm1-2.)*
     *      (fkm1+sigp1))
   40   continue
        return
      else
        do 50 k=1,nd
          fkm1=real(k-1)
          fnu(k)=(1./(sigp1+fkm1))**2
   50   continue
      end if
      end

      subroutine dmm(n,modmom,intexp,dsigma,dnu)
c
c This is a double-precision version of the routine  fmm.
c
      double precision dsigma,dnu(*),dsigp1,dc,dk,dp,ds,di,dq,diq,dkm1
      logical modmom,intexp
c
c The array  dnu  is assumed to have dimension  2*n.
c
      nd=2*n
      dsigp1=dsigma+1.d0
      if(modmom) then
        isigma=idint(dsigma)
        isigp1=isigma+1
        isigp2=isigma+2
        isigp3=isigma+3
        if(intexp .and. isigp1.lt.nd) then
          kmax=isigp1
        else
          kmax=nd
        end if
        dc=1.d0
        do 20 k=1,kmax
          km1=k-1
          dk=dble(k)
          dp=1.d0
          ds=1.d0/dsigp1
          if(kmax.gt.1) then
            do 10 i=1,km1
              di=dble(i)
              dp=(dsigp1-di)*dp/(dsigp1+di)
              ds=ds+1.d0/(dsigp1+di)-1.d0/(dsigp1-di)
   10       continue
          end if
          dnu(k)=dc*ds*dp/dsigp1
          dc=dk*dc/(4.d0*dk-2.d0)
   20   continue
        if(.not.intexp .or. isigp1.ge.nd) return
        dq=-.5d0
        if(isigma.gt.0) then
          do 30 iq=1,isigma
            diq=dble(iq)
            dq=diq*diq*dq/((2.d0*diq+1.d0)*(2.d0*diq+2.d0))
   30     continue
        end if
        dnu(isigp2)=dc*dq
        if(isigp2.eq.nd) return
        do 40 k=isigp3,nd
          km1=k-1
          dkm1=dble(km1)
          dnu(k)=-dkm1*(dkm1-dsigp1)*dnu(km1)/((4.d0*dkm1-2.d0)*
     *      (dkm1+dsigp1))
   40   continue
        return
      else
        do 50 k=1,nd
          dkm1=dble(k-1)
          dnu(k)=(1.d0/(dsigp1+dkm1))**2
   50   continue
      end if
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test2.out


   output of test2 with modmom=.true.:


      ierr in cheb =  -31 iderr in dcheb =    0


                     sigma = -0.5

   k         dalpha(k)               dbeta(k)

   0  0.1111111111111112D+00  0.4000000000000000D+01
      0.3278E-06                       0.0000E+00
   1  0.4661483641075485D+00  0.2765432098765437D-01
      0.4210E-06                       0.5745E-06
   2  0.4880690581976436D+00  0.5534292684170730D-01
      0.3068E-06                       0.7272E-06
   3  0.4938743419208074D+00  0.5940526298488894D-01
      0.3004E-06                       0.4301E-06
   4  0.4962639578613479D+00  0.6077714606674775D-01
      0.1338E-06                       0.3114E-06
   5  0.4974805136345499D+00  0.6140371143126473D-01
      0.3958E-08                       0.7754E-07
   6  0.4981846424539429D+00  0.6174167659202352D-01
      0.5808E-06                       0.1273E-06
   7  0.4986290336259888D+00  0.6194453627914812D-01
      0.2271E-05                       0.3058E-05
   8  0.4989276082849289D+00  0.6207576580933749D-01
      0.2957E-05                       0.5251E-05
   9  0.4991379564664915D+00  0.6216550244588560D-01
      0.3381E-05                       0.6592E-05
  10  0.4992917697450041D+00  0.6222955193631115D-01
      0.3506E-05                       0.6774E-05
  11  0.4994076708859170D+00  0.6227685326078739D-01
      0.3982E-05                       0.7507E-05
  12  0.4994971916094714D+00  0.6231277082877681D-01
      0.3971E-05                       0.7895E-05
  13  0.4995677851751443D+00  0.6234068199929645D-01
      0.4371E-05                       0.8270E-05
  14  0.4996244439462695D+00  0.6236279899520764D-01
      0.5334E-05                       0.9342E-05
  15  0.4996706145979917D+00  0.6238061988996053D-01
      0.6481E-05                       0.1201E-04
  16  0.4997087392464645D+00  0.6239518834725448D-01
      0.7688E-05                       0.1402E-04
  17  0.4997405876531822D+00  0.6240724948356220D-01
      0.8144E-05                       0.1632E-04
  18  0.4997674679011032D+00  0.6241734675384648D-01
      0.8200E-05                       0.1635E-04
  19  0.4997903638440777D+00  0.6242588405028093D-01
      0.7858E-05                       0.1597E-04
  20  0.4998100270509771D+00  0.6243316658847062D-01
      0.8262E-05                       0.1596E-04
  21  0.4998270396901978D+00  0.6243942847487945D-01
      0.8551E-05                       0.1697E-04
  22  0.4998418584011349D+00  0.6244485169209404D-01
      0.8207E-05                       0.1654E-04
  23  0.4998548454525862D+00  0.6244957942452618D-01
      0.8074E-05                       0.1636E-04
  24  0.4998662912324301D+00  0.6245372557342443D-01
      0.7541E-05                       0.1600E-04
  25  0.4998764307204509D+00  0.6245738165737395D-01
      0.7494E-05                       0.1418E-04
  26  0.4998854557169332D+00  0.6246062188808694D-01
      0.8319E-05                       0.1590E-04
  27  0.4998935240328305D+00  0.6246350695269912D-01
      0.8422E-05                       0.1741E-04
  28  0.4999007664750439D+00  0.6246608686595397D-01
      0.8005E-05                       0.1607E-04
  29  0.4999072922115456D+00  0.6246840314473048D-01
      0.7824E-05                       0.1582E-04
  30  0.4999131929321900D+00  0.6247049048283027D-01
      0.7764E-05                       0.1566E-04
  31  0.4999185461046693D+00  0.6247237805306899D-01
  32  0.4999234175438151D+00  0.6247409052851224D-01
  33  0.4999278634549521D+00  0.6247564888999885D-01
  34  0.4999319320708995D+00  0.6247707106956591D-01
  35  0.4999356649724602D+00  0.6247837246680096D-01
  36  0.4999390981604779D+00  0.6247956636600722D-01
  37  0.4999422629314982D+00  0.6248066427536948D-01
  38  0.4999451865971231D+00  0.6248167620434811D-01
  39  0.4999478930781596D+00  0.6248261089183171D-01
  40  0.4999504033978749D+00  0.6248347599478526D-01
  41  0.4999527360934811D+00  0.6248427824502266D-01
  42  0.4999549075609926D+00  0.6248502358011122D-01
  43  0.4999569323455021D+00  0.6248571725317256D-01
  44  0.4999588233865460D+00  0.6248636392537914D-01
  45  0.4999605922263174D+00  0.6248696774419497D-01
  46  0.4999622491870356D+00  0.6248753240981464D-01
  47  0.4999638035225754D+00  0.6248806123179342D-01
  48  0.4999652635485503D+00  0.6248855717748823D-01
  49  0.4999666367542719D+00  0.6248902291363489D-01
  50  0.4999679298994216D+00  0.6248946084215067D-01
  51  0.4999691490977738D+00  0.6248987313106132D-01
  52  0.4999702998899155D+00  0.6249026174129615D-01
  53  0.4999713873065853D+00  0.6249062844997030D-01
  54  0.4999724159239909D+00  0.6249097487067017D-01
  55  0.4999733899122461D+00  0.6249130247117560D-01
  56  0.4999743130778891D+00  0.6249161258898195D-01
  57  0.4999751889012908D+00  0.6249190644492869D-01
  58  0.4999760205696483D+00  0.6249218515519296D-01
  59  0.4999768110061491D+00  0.6249244974187076D-01
  60  0.4999775628958004D+00  0.6249270114233022D-01
  61  0.4999782787083592D+00  0.6249294021749806D-01
  62  0.4999789607187251D+00  0.6249316775921680D-01
  63  0.4999796110251152D+00  0.6249338449678853D-01
  64  0.4999802315652864D+00  0.6249359110280744D-01
  65  0.4999808241310492D+00  0.6249378819836718D-01
  66  0.4999813903812705D+00  0.6249397635771935D-01
  67  0.4999819318535453D+00  0.6249415611244808D-01
  68  0.4999824499746865D+00  0.6249432795521654D-01
  69  0.4999829460701733D+00  0.6249449234313523D-01
  70  0.4999834213726739D+00  0.6249464970079602D-01
  71  0.4999838770297383D+00  0.6249480042300781D-01
  72  0.4999843141107603D+00  0.6249494487726730D-01
  73  0.4999847336132829D+00  0.6249508340599427D-01
  74  0.4999851364687184D+00  0.6249521632855661D-01
  75  0.4999855235475439D+00  0.6249534394310687D-01
  76  0.4999858956640248D+00  0.6249546652825025D-01
  77  0.4999862535805198D+00  0.6249558434456221D-01
  78  0.4999865980114029D+00  0.6249569763596979D-01
  79  0.4999869296266428D+00  0.6249580663101142D-01
  80  0.4999872490550800D+00  0.6249591154398641D-01
  81  0.4999875568874200D+00  0.6249601257600690D-01
  82  0.4999878536789757D+00  0.6249610991595848D-01
  83  0.4999881399521851D+00  0.6249620374138123D-01
  84  0.4999884161989195D+00  0.6249629421927756D-01
  85  0.4999886828826078D+00  0.6249638150685363D-01
  86  0.4999889404401875D+00  0.6249646575220049D-01
  87  0.4999891892839013D+00  0.6249654709492078D-01
  88  0.4999894298029569D+00  0.6249662566670530D-01
  89  0.4999896623650525D+00  0.6249670159186568D-01
  90  0.4999898873177909D+00  0.6249677498782386D-01
  91  0.4999901049899824D+00  0.6249684596556569D-01
  92  0.4999903156928528D+00  0.6249691463005939D-01
  93  0.4999905197211598D+00  0.6249698108064262D-01
  94  0.4999907173542265D+00  0.6249704541138068D-01
  95  0.4999909088569067D+00  0.6249710771139879D-01
  96  0.4999910944804705D+00  0.6249716806519037D-01
  97  0.4999912744634357D+00  0.6249722655290239D-01
  98  0.4999914490323356D+00  0.6249728325060094D-01
  99  0.4999916184024339D+00  0.6249733823051787D-01

  eamax = 0.8551E-05 at 21    ebmax = 0.1741E-04 at 27



      ierr in cheb =  -31 iderr in dcheb =    0


                     sigma =  0.0

   k         dalpha(k)               dbeta(k)

   0  0.2500000000000000D+00  0.1000000000000000D+01
      0.0000E+00                       0.0000E+00
   1  0.4642857142857142D+00  0.4861111111111110D-01
      0.2751E-07                       0.1703E-07
   2  0.4854824464561713D+00  0.5868480725623582D-01
      0.4523E-07                       0.2476E-09
   3  0.4921030818713609D+00  0.6072858391891787D-01
      0.2408E-07                       0.6849E-07
   4  0.4950284987583539D+00  0.6148202019693696D-01
      0.5420E-07                       0.7717E-08
   5  0.4965795116435582D+00  0.6184080953188485D-01
      0.3265E-07                       0.5656E-08
   6  0.4975013013049583D+00  0.6203906295445600D-01
      0.8479E-07                       0.1108E-06
   7  0.4980940182042519D+00  0.6215991915828945D-01
      0.5166E-07                       0.1052E-06
   8  0.4984978019782528D+00  0.6223893767166676D-01
      0.2400E-07                       0.3680E-07
   9  0.4987853226556930D+00  0.6229338867990750D-01
      0.4830E-07                       0.1079E-06
  10  0.4989973531671537D+00  0.6233247750665636D-01
      0.7436E-07                       0.1181E-06
  11  0.4991582216780129D+00  0.6236147348381101D-01
      0.8320E-07                       0.2048E-06
  12  0.4992831802157361D+00  0.6238356835953569D-01
      0.8838E-07                       0.1422E-06
  13  0.4993821876708660D+00  0.6240078643427267D-01
      0.2040E-07                       0.1456E-06
  14  0.4994619720966187D+00  0.6241446153535191D-01
      0.7284E-07                       0.3323E-07
  15  0.4995272124267308D+00  0.6242550130298844D-01
      0.1264E-06                       0.2442E-06
  16  0.4995812447300376D+00  0.6243454062356626D-01
      0.1250E-06                       0.2158E-06
  17  0.4996264998058224D+00  0.6244203431425523D-01
      0.1543E-06                       0.3010E-06
  18  0.4996647829280138D+00  0.6244831505981952D-01
      0.1204E-06                       0.3025E-06
  19  0.4996974576412243D+00  0.6245363072435640D-01
      0.9763E-07                       0.2480E-06
  20  0.4997255694718122D+00  0.6245816901837448D-01
      0.1408E-06                       0.1741E-06
  21  0.4997499310067592D+00  0.6246207418964091D-01
      0.1147E-06                       0.2166E-06
  22  0.4997711815425515D+00  0.6246545855360315D-01
      0.1117E-06                       0.2474E-06
  23  0.4997898296374528D+00  0.6246841060865246D-01
      0.6840E-07                       0.1618E-06
  24  0.4998062839486146D+00  0.6247100084469110D-01
      0.6154E-07                       0.2028E-06
  25  0.4998208759015741D+00  0.6247328596467973D-01
      0.2429E-07                       0.1189E-06
  26  0.4998338765749832D+00  0.6247531199583130D-01
      0.7019E-07                       0.1273E-06
  27  0.4998455094286890D+00  0.6247711661195303D-01
      0.1099E-06                       0.1617E-06
  28  0.4998559600051913D+00  0.6247873088741343D-01
      0.7037E-07                       0.2018E-06
  29  0.4998653834001783D+00  0.6248018063625861D-01
      0.5864E-07                       0.1324E-06
  30  0.4998739100699456D+00  0.6248148744489222D-01
      0.1118E-06                       0.1447E-06
  31  0.4998816503859023D+00  0.6248266947588214D-01
  32  0.4998886982359269D+00  0.6248374209905707D-01
  33  0.4998951338939793D+00  0.6248471839101896D-01
  34  0.4999010263231366D+00  0.6248560953350395D-01
  35  0.4999064350364226D+00  0.6248642513333124D-01
  36  0.4999114116099005D+00  0.6248717348108804D-01
  37  0.4999160009203820D+00  0.6248786176159406D-01
  38  0.4999202421635932D+00  0.6248849622614661D-01
  39  0.4999241696962147D+00  0.6248908233427394D-01
  40  0.4999278137357828D+00  0.6248962487101083D-01
  41  0.4999312009452333D+00  0.6249012804440843D-01
  42  0.4999343549233236D+00  0.6249059556699411D-01
  43  0.4999372966178655D+00  0.6249103072413022D-01
  44  0.4999400446753544D+00  0.6249143643162414D-01
  45  0.4999426157379414D+00  0.6249181528447826D-01
  46  0.4999450246966258D+00  0.6249216959830271D-01
  47  0.4999472849078920D+00  0.6249250144462603D-01
  48  0.4999494083797023D+00  0.6249281268110964D-01
  49  0.4999514059317025D+00  0.6249310497748910D-01
  50  0.4999532873336487D+00  0.6249337983791939D-01
  51  0.4999550614253737D+00  0.6249363862028198D-01
  52  0.4999567362210553D+00  0.6249388255291721D-01
  53  0.4999583190000924D+00  0.6249411274916621D-01
  54  0.4999598163865177D+00  0.6249433022004471D-01
  55  0.4999612344185730D+00  0.6249453588531714D-01
  56  0.4999625786098143D+00  0.6249473058319831D-01
  57  0.4999638540029048D+00  0.6249491507887299D-01
  58  0.4999650652170817D+00  0.6249509007199565D-01
  59  0.4999662164901308D+00  0.6249525620330706D-01
  60  0.4999673117155845D+00  0.6249541406048485D-01
  61  0.4999683544757535D+00  0.6249556418332753D-01
  62  0.4999693480711199D+00  0.6249570706835746D-01
  63  0.4999702955465394D+00  0.6249584317291586D-01
  64  0.4999711997146450D+00  0.6249597291881319D-01
  65  0.4999720631767872D+00  0.6249609669558868D-01
  66  0.4999728883418041D+00  0.6249621486342680D-01
  67  0.4999736774428732D+00  0.6249632775577062D-01
  68  0.4999744325526670D+00  0.6249643568166801D-01
  69  0.4999751555970042D+00  0.6249653892788119D-01
  70  0.4999758483671652D+00  0.6249663776078658D-01
  71  0.4999765125310183D+00  0.6249673242808854D-01
  72  0.4999771496430876D+00  0.6249682316036718D-01
  73  0.4999777611536749D+00  0.6249691017247887D-01
  74  0.4999783484171361D+00  0.6249699366482483D-01
  75  0.4999789126994011D+00  0.6249707382450199D-01
  76  0.4999794551848141D+00  0.6249715082634830D-01
  77  0.4999799769823654D+00  0.6249722483389368D-01
  78  0.4999804791313734D+00  0.6249729600022592D-01
  79  0.4999809626066740D+00  0.6249736446878026D-01
  80  0.4999814283233635D+00  0.6249743037406028D-01
  81  0.4999818771411402D+00  0.6249749384229662D-01
  82  0.4999823098682816D+00  0.6249755499204988D-01
  83  0.4999827272652926D+00  0.6249761393476291D-01
  84  0.4999831300482551D+00  0.6249767077526709D-01
  85  0.4999835188919071D+00  0.6249772561224735D-01
  86  0.4999838944324745D+00  0.6249777853866934D-01
  87  0.4999842572702806D+00  0.6249782964217228D-01
  88  0.4999846079721506D+00  0.6249787900543109D-01
  89  0.4999849470736302D+00  0.6249792670648959D-01
  90  0.4999852750810355D+00  0.6249797281906837D-01
  91  0.4999855924733468D+00  0.6249801741284875D-01
  92  0.4999858997039610D+00  0.6249806055373548D-01
  93  0.4999861972023151D+00  0.6249810230409940D-01
  94  0.4999864853753896D+00  0.6249814272300246D-01
  95  0.4999867646091039D+00  0.6249818186640603D-01
  96  0.4999870352696105D+00  0.6249821978736398D-01
  97  0.4999872977044986D+00  0.6249825653620214D-01
  98  0.4999875522439120D+00  0.6249829216068473D-01
  99  0.4999877992015900D+00  0.6249832670616920D-01

  eamax = 0.1543E-06 at 17    ebmax = 0.3025E-06 at 18



      ierr in cheb =  -31 iderr in dcheb =    0


                     sigma =  0.5

   k         dalpha(k)               dbeta(k)

   0  0.3600000000000000D+00  0.4444444444444444D+00
      0.3974E-07                       0.7451E-08
   1  0.4719914117015566D+00  0.5407346938775509D-01
      0.1714E-07                       0.1094E-06
   2  0.4879269724351618D+00  0.5943841686774257D-01
      0.2550E-07                       0.9177E-07
   3  0.4932798327365417D+00  0.6091940289441790D-01
      0.3652E-07                       0.1864E-07
   4  0.4957216320837135D+00  0.6153509994700859D-01
      0.1234E-07                       0.8389E-07
   5  0.4970386426421355D+00  0.6184950526468488D-01
      0.2014E-07                       0.8981E-08
   6  0.4978294203847390D+00  0.6203162731630896D-01
      0.3389E-07                       0.6997E-07
   7  0.4983412074859196D+00  0.6214656330041469D-01
      0.9532E-08                       0.3499E-08
   8  0.4986913480145009D+00  0.6222375466280029D-01
      0.5534E-07                       0.2578E-08
   9  0.4989413835287816D+00  0.6227810665498394D-01
      0.4334E-07                       0.5735E-07
  10  0.4991261249443937D+00  0.6231782657996530D-01
      0.9666E-07                       0.1312E-06
  11  0.4992664682477056D+00  0.6234773797508453D-01
      0.4529E-07                       0.8807E-07
  12  0.4993755732917556D+00  0.6237082738280753D-01
      0.4276E-07                       0.8897E-07
  13  0.4994620627897157D+00  0.6238902459454284D-01
      0.4908E-07                       0.1353E-06
  14  0.4995317778015999D+00  0.6240362179255483D-01
      0.6384E-07                       0.7928E-07
  15  0.4995887889551456D+00  0.6241551074437726D-01
      0.2801E-08                       0.5261E-08
  16  0.4996360033773616D+00  0.6242532304911859D-01
      0.1790E-07                       0.5618E-07
  17  0.4996755420559209D+00  0.6243351622682347D-01
      0.1206E-09                       0.2375E-07
  18  0.4997089817666156D+00  0.6244042830417754D-01
      0.6253E-07                       0.5039E-07
  19  0.4997375143993142D+00  0.6244631341888403D-01
      0.2652E-07                       0.2278E-07
  20  0.4997620544096439D+00  0.6245136563006099D-01
      0.7700E-08                       0.4836E-07
  21  0.4997833128374761D+00  0.6245573519842513D-01
      0.1105E-07                       0.1445E-07
  22  0.4998018492728469D+00  0.6245953994072608D-01
      0.9833E-08                       0.6475E-07
  23  0.4998181089701916D+00  0.6246287329138700D-01
      0.4471E-07                       0.5219E-07
  24  0.4998324497706396D+00  0.6246581011945501D-01
      0.5648E-07                       0.1335E-07
  25  0.4998451619096539D+00  0.6246841098796683D-01
      0.2956E-07                       0.8284E-07
  26  0.4998564827801959D+00  0.6247072531490884D-01
      0.2154E-07                       0.2167E-07
  27  0.4998666080678058D+00  0.6247279374805513D-01
      0.6527E-08                       0.7314E-08
  28  0.4998757002418248D+00  0.6247464996949868D-01
      0.7108E-07                       0.9123E-08
  29  0.4998838950965002D+00  0.6247632208123857D-01
      0.1291E-06                       0.6005E-07
  30  0.4998913068374630D+00  0.6247783367943598D-01
      0.1110E-06                       0.2250E-06
  31  0.4998980320718155D+00  0.6247920469481741D-01
  32  0.4999041529637934D+00  0.6248045205566244D-01
  33  0.4999097397496046D+00  0.6248159021493702D-01
  34  0.4999148527559425D+00  0.6248263157248968D-01
  35  0.4999195440310306D+00  0.6248358681553028D-01
  36  0.4999238586709132D+00  0.6248446519498550D-01
  37  0.4999278359043647D+00  0.6248527475117416D-01
  38  0.4999315099853403D+00  0.6248602249915600D-01
  39  0.4999349109310142D+00  0.6248671458178577D-01
  40  0.4999380651351964D+00  0.6248735639674956D-01
  41  0.4999409958806054D+00  0.6248795270251865D-01
  42  0.4999437237686131D+00  0.6248850770712833D-01
  43  0.4999462670813127D+00  0.6248902514289206D-01
  44  0.4999486420878185D+00  0.6248950832954173D-01
  45  0.4999508633044016D+00  0.6248996022779914D-01
  46  0.4999529437162439D+00  0.6249038348500154D-01
  47  0.4999548949671462D+00  0.6249078047410022D-01
  48  0.4999567275223773D+00  0.6249115332711031D-01
  49  0.4999584508089201D+00  0.6249150396389636D-01
  50  0.4999600733366311D+00  0.6249183411702248D-01
  51  0.4999616028032255D+00  0.6249214535327045D-01
  52  0.4999630461855071D+00  0.6249243909232696D-01
  53  0.4999644098188650D+00  0.6249271662305769D-01
  54  0.4999656994667316D+00  0.6249297911771826D-01
  55  0.4999669203814219D+00  0.6249322764439543D-01
  56  0.4999680773575580D+00  0.6249346317792637D-01
  57  0.4999691747790910D+00  0.6249368660950492D-01
  58  0.4999702166607836D+00  0.6249389875515264D-01
  59  0.4999712066848866D+00  0.6249410036320497D-01
  60  0.4999721482336353D+00  0.6249429212094167D-01
  61  0.4999730444181000D+00  0.6249447466047135D-01
  62  0.4999738981038530D+00  0.6249464856396464D-01
  63  0.4999747119338454D+00  0.6249481436831698D-01
  64  0.4999754883488352D+00  0.6249497256931115D-01
  65  0.4999762296056631D+00  0.6249512362533981D-01
  66  0.4999769377936293D+00  0.6249526796074065D-01
  67  0.4999776148491942D+00  0.6249540596878940D-01
  68  0.4999782625691973D+00  0.6249553801439012D-01
  69  0.4999788826227607D+00  0.6249566443649768D-01
  70  0.4999794765620261D+00  0.6249578555030204D-01
  71  0.4999800458318531D+00  0.6249590164920099D-01
  72  0.4999805917785927D+00  0.6249601300658438D-01
  73  0.4999811156580355D+00  0.6249611987745015D-01
  74  0.4999816186426217D+00  0.6249622249987002D-01
  75  0.4999821018279894D+00  0.6249632109632074D-01
  76  0.4999825662389323D+00  0.6249641587489456D-01
  77  0.4999830128348246D+00  0.6249650703040165D-01
  78  0.4999834425145663D+00  0.6249659474537509D-01
  79  0.4999838561210999D+00  0.6249667919098804D-01
  80  0.4999842544455371D+00  0.6249676052789222D-01
  81  0.4999846382309350D+00  0.6249683890698485D-01
  82  0.4999850081757564D+00  0.6249691447011115D-01
  83  0.4999853649370409D+00  0.6249698735070858D-01
  84  0.4999857091333184D+00  0.6249705767439812D-01
  85  0.4999860413472842D+00  0.6249712555952758D-01
  86  0.4999863621282614D+00  0.6249719111767138D-01
  87  0.4999866719944675D+00  0.6249725445409068D-01
  88  0.4999869714351036D+00  0.6249731566815751D-01
  89  0.4999872609122817D+00  0.6249737485374586D-01
  90  0.4999875408628043D+00  0.6249743209959292D-01
  91  0.4999878116998094D+00  0.6249748748963293D-01
  92  0.4999880738142916D+00  0.6249754110330587D-01
  93  0.4999883275765107D+00  0.6249759301584332D-01
  94  0.4999885733372972D+00  0.6249764329853331D-01
  95  0.4999888114292624D+00  0.6249769201896598D-01
  96  0.4999890421679216D+00  0.6249773924126136D-01
  97  0.4999892658527375D+00  0.6249778502628124D-01
  98  0.4999894827680902D+00  0.6249782943182582D-01
  99  0.4999896931841791D+00  0.6249787251281685D-01

  eamax = 0.1291E-06 at 29    ebmax = 0.2250E-06 at 30



   output of test2 with modmom=.false.:


      ierr in cheb =    0 iderr in dcheb =    0


                     sigma = -0.5

   k         dalpha(k)               dbeta(k)

   0  0.1111111111111111D+00  0.4000000000000000D+01
      0.7451E-07                       0.0000E+00
   1  0.4661483641075475D+00  0.2765432098765433D-01
      0.2651E-07                       0.3170E-07
   2  0.4880690581976415D+00  0.5534292684170727D-01
      0.1586E-05                       0.5926E-06
   3  0.4938743419207881D+00  0.5940526298488941D-01
      0.1587E-04                       0.1097E-04
   4  0.4962639578607693D+00  0.6077714606677241D-01
      0.4286E-03                       0.1423E-03
   5  0.4974805136208555D+00  0.6140371143203073D-01
      0.8059E-02                       0.4378E-02
   6  0.4981846423424421D+00  0.6174167660326028D-01
      0.1424E-01                       0.3706E-01
   7  0.4986290307577836D+00  0.6194453636459993D-01
      0.1651E+01                       0.6074E-01
   8  0.4989273886148391D+00  0.6207577270058091D-01
      0.5250E+01                       0.4582E+02
   9  0.4991284123183695D+00  0.6216587864878489D-01
      0.2159E+00                       0.1028E+02
  10  0.4989494758096216D+00  0.6224397106084024D-01
      0.3977E+01                       0.3023E+01
  11  0.4880364783298132D+00  0.6277497075819935D-01
      0.1017E+00                       0.2413E+02

  eamax = 0.5250E+01 at  8    ebmax = 0.4582E+02 at  8



      ierr in cheb =    0 iderr in dcheb =    0


                     sigma =  0.0

   k         dalpha(k)               dbeta(k)

   0  0.2500000000000000D+00  0.1000000000000000D+01
      0.0000E+00                       0.0000E+00
   1  0.4642857142857144D+00  0.4861111111111110D-01
      0.3485E-06                       0.1703E-06
   2  0.4854824464561660D+00  0.5868480725623591D-01
      0.5509E-05                       0.2920E-05
   3  0.4921030818712884D+00  0.6072858391892424D-01
      0.6295E-04                       0.3484E-04
   4  0.4950284987592035D+00  0.6148202019695143D-01
      0.9871E-03                       0.5255E-03
   5  0.4965795116971190D+00  0.6184080952981792D-01
      0.2241E-02                       0.4623E-02
   6  0.4975013023043009D+00  0.6203906288771167D-01
      0.5326E+00                       0.1269E+00
   7  0.4980940109893779D+00  0.6215991866158676D-01
      0.3388E+01                       0.7001E+01
   8  0.4984969774321750D+00  0.6223896553595853D-01
      0.5988E+00                       0.1159E+02
   9  0.4987601214823556D+00  0.6229459726507641D-01
      0.1304E+01                       0.9112E+01
  10  0.4985055405450893D+00  0.6236221817631457D-01
      0.1672E+01                       0.5511E+01
  11  0.4991132599219252D+00  0.6273336492661273D-01
      0.1259E+00                       0.1380E+02

  eamax = 0.3388E+01 at  7    ebmax = 0.1380E+02 at 11



      ierr in cheb =    0 iderr in dcheb =    0


                     sigma =  0.5

   k         dalpha(k)               dbeta(k)

   0  0.3600000000000001D+00  0.4444444444444444D+00
      0.4305E-07                       0.7451E-07
   1  0.4719914117015573D+00  0.5407346938775503D-01
      0.1723E-06                       0.4047E-07
   2  0.4879269724351627D+00  0.5943841686774243D-01
      0.6133E-05                       0.3288E-05
   3  0.4932798327366439D+00  0.6091940289441427D-01
      0.7350E-04                       0.3059E-04
   4  0.4957216320864775D+00  0.6153509994687430D-01
      0.3737E-02                       0.1130E-02
   5  0.4970386427089628D+00  0.6184950526130048D-01
      0.8606E-01                       0.3965E-01
   6  0.4978294224141937D+00  0.6203162722812419D-01
      0.7251E+00                       0.6598E+00
   7  0.4983412690537179D+00  0.6214656042531451D-01
      0.7700E+00                       0.3258E+01
   8  0.4986929652150196D+00  0.6222367657592045D-01
      0.7810E+01                       0.6079E+01
   9  0.4989963775222535D+00  0.6227585217335156D-01
      0.3362E+01                       0.1211E+03
  10  0.5013306744567245D+00  0.6223073112752390D-01
      0.4228E+01                       0.2408E+01
  11  0.5826882560196065D+00  0.5898221346865129D-01
      0.2354E+01                       0.4641E+02

  eamax = 0.7810E+01 at  8    ebmax = 0.1211E+03 at  9

C-END-OF-FILE

cat <<C-END-OF-FILE > test3.f
c
c
      program test3
c
c
      dimension x(320),w(320),bexact(320),p0(320),p1(320),p2(320),
     *als(320),bes(320),all(320),bel(320)
c
c This test applies both the Stieltjes procedure (cf. Section 2.1 of
c W. Gautschi, ``On generating orthogonal polynomials'', SIAM J. Sci.
c Statist. Comput. 3, 1982, 289-317) and the Lanczos algorithm (cf.
c W.B. Gragg and W.J. Harrod, ``The numerically stable reconstruction of
c Jacobi matrices from spectral data'', Numer. Math. 44, 1984, 317-335)
c to generate the  N  recursion coefficients, N = 40, 80, 160, 320,
c for the (monic) orthogonal polynomials relative to the discrete inner
c product supported on  N  equally spaced points on [-1,1] (including
c the end points) and having equal weights 2/N. The routine prints the
c absolute errors in the alpha-coefficients and the relative errors in
c the beta-coefficients, these being computed using known formulae for
c the coefficients. The maxima of these errors are also printed.
c
      ncap=20
      do 30 incap=1,4
        ncap=2*ncap
        fncap=real(ncap)
        fncm1=real(ncap-1)
c
c Generate the abscissae and weights of the discrete inner product and
c the exact beta-coefficients.
c
        x(1)=-1.
        w(1)=2./fncap
        bexact(1)=2.
        do 10 k=2,ncap
          fkm1=real(k-1)
          x(k)=-1.+2.*fkm1/fncm1
          w(k)=w(1)
          bexact(k)=(1.+1./fncm1)**2*(1.-(fkm1/fncap)**2)/
     *      (4.-(1./fkm1)**2)
   10   continue
c
c Compute the desired coefficients, first by the Stieltjes procedure,
c and then by the Lanczos algorithm. Indicate via the error flag  ierrs
c whether a critical underflow condition has arisen in Stieltjes's
c procedure. (There may, in addition, occur harmless underflow, which
c the routine  sti  does not test for.)
c
        call sti(ncap,ncap,x,w,als,bes,ierrs,p0,p1,p2)
        call lancz(ncap,ncap,x,w,all,bel,ierrl,p0,p1)
        write(*,1) ierrs,ierrl
    1   format(/5x,'ierr in sti = ',i4,11x,'ierr in lancz = ',i3/)
c
c Compute and print the absolute errors of the alpha-coefficients and 
c the relative errors of the beta-coefficients as well as the maximum 
c respective errors.
c
        erralm=0.
        errblm=0.
        write(*,2)
    2   format(5x,'k',4x,'erra',8x,'errb',10x,'erra',8x,'errb'/)
        do 20 in=1,ncap
          inm1=in-1
          erras=abs(als(in))
          errbs=abs((bes(in)-bexact(in))/bexact(in))
          erral=abs(all(in))
          errbl=abs((bel(in)-bexact(in))/bexact(in))
          if(erral.gt.erralm) erralm=erral
          if(errbl.gt.errblm) errblm=errbl
          if(ierrs.eq.0 .or. inm1.lt.abs(ierrs)) then
            if(in.eq.1) then
              write(*,3) inm1,erras,errbs,erral,errbl,ncap
    3         format(1x,i5,2e12.4,2x,2e12.4,'   N =',i4)
            else
              write(*,4) inm1,erras,errbs,erral,errbl
    4         format(1x,i5,2e12.4,2x,2e12.4)
            end if
          else
            if(in.eq.1) then
              write(*,5) inm1,erral,errbl,ncap
    5         format(1x,i5,26x,2e12.4,'   N =',i4)
            else
              write(*,6) inm1,erral,errbl
    6         format(1x,i5,26x,2e12.4)
            end if
          end if
   20   continue
        write(*,7) erralm,errblm
    7   format(/32x,2e12.4//)
   30 continue
      stop
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > test3.out


     output of test3: 


     ierr in sti =    0           ierr in lancz =   0

     k    erra        errb          erra        errb

     0  0.4843E-07  0.4172E-06    0.7823E-07  0.4172E-06   N =  40
     1  0.1063E-06  0.3402E-06    0.2719E-06  0.4252E-06
     2  0.1805E-06  0.1065E-06    0.7451E-07  0.1065E-06
     3  0.2030E-06  0.0000E+00    0.9686E-07  0.2216E-06
     4  0.9179E-07  0.0000E+00    0.1490E-07  0.1127E-06
     5  0.3670E-06  0.0000E+00    0.2980E-07  0.2279E-06
     6  0.4854E-06  0.1151E-06    0.1639E-06  0.1151E-06
     7  0.5111E-06  0.0000E+00    0.1639E-06  0.1163E-06
     8  0.4893E-06  0.2352E-06    0.2086E-06  0.3528E-06
     9  0.4811E-06  0.2380E-06    0.1788E-06  0.1190E-06
    10  0.4042E-06  0.1809E-06    0.8941E-07  0.0000E+00
    11  0.3669E-06  0.1835E-06    0.8941E-07  0.2447E-06
    12  0.2964E-06  0.1865E-06    0.1490E-06  0.4351E-06
    13  0.2376E-06  0.6326E-07    0.2682E-06  0.0000E+00
    14  0.2976E-06  0.2580E-06    0.1490E-06  0.3224E-06
    15  0.1636E-06  0.0000E+00    0.2384E-06  0.5927E-06
    16  0.2910E-06  0.3369E-06    0.8941E-07  0.4717E-06
    17  0.2018E-06  0.2073E-06    0.2980E-07  0.1382E-06
    18  0.3769E-07  0.7099E-07    0.2980E-07  0.2840E-06
    19  0.6049E-07  0.2925E-06    0.1490E-06  0.1462E-06
    20  0.3711E-07  0.1510E-06    0.2384E-06  0.7550E-07
    21  0.1215E-06  0.0000E+00    0.4172E-06  0.7818E-07
    22  0.3692E-07  0.1624E-06    0.0000E+00  0.0000E+00
    23  0.5313E-07  0.0000E+00    0.1788E-06  0.1692E-06
    24  0.2101E-07  0.1770E-06    0.2384E-06  0.4425E-06
    25  0.1222E-06  0.1859E-06    0.5960E-07  0.1022E-05
    26  0.8409E-08  0.9808E-07    0.2384E-06  0.9808E-07
    27  0.6492E-06  0.1769E-05    0.5960E-07  0.1041E-06
    28  0.2389E-05  0.7552E-05    0.1788E-06  0.3332E-06
    29  0.1441E-04  0.4567E-04    0.2980E-06  0.4179E-06
    30  0.9427E-04  0.2919E-03    0.4768E-06  0.3884E-06
    31  0.6951E-03  0.2122E-02    0.5960E-07  0.1418E-05
    32  0.5740E-02  0.1761E-01    0.1788E-06  0.3934E-06
    33  0.4639E-01  0.1663E+00    0.1192E-06  0.6208E-06
    34  0.1448E+00  0.1568E+01    0.5960E-07  0.9186E-06
    35  0.8136E-01  0.6740E+01    0.2384E-06  0.1450E-05
    36  0.1031E+00  0.5565E+01    0.3576E-06  0.1789E-05
    37  0.1245E-01  0.1536E+01    0.5960E-07  0.1962E-06
    38  0.9580E-03  0.1143E+01    0.0000E+00  0.1525E-05
    39  0.3743E-02  0.2165E+01    0.0000E+00  0.4948E-05

                                  0.4768E-06  0.4948E-05



     ierr in sti =  -58           ierr in lancz =   0

     k    erra        errb          erra        errb

     0  0.9313E-08  0.6557E-06    0.5448E-06  0.6557E-06   N =  80
     1  0.4632E-07  0.6976E-06    0.6054E-07  0.6104E-06
     2  0.5484E-07  0.1091E-06    0.3446E-06  0.2181E-06
     3  0.1231E-06  0.0000E+00    0.1639E-06  0.7922E-06
     4  0.9110E-07  0.0000E+00    0.1006E-06  0.1147E-06
     5  0.2649E-07  0.1155E-06    0.1863E-06  0.0000E+00
     6  0.8598E-08  0.0000E+00    0.1043E-06  0.0000E+00
     7  0.8406E-08  0.1165E-06    0.3055E-06  0.3496E-06
     8  0.4124E-07  0.0000E+00    0.1118E-06  0.4679E-06
     9  0.1624E-07  0.0000E+00    0.1714E-06  0.0000E+00
    10  0.3210E-07  0.2356E-06    0.8941E-07  0.2356E-06
    11  0.1711E-06  0.3547E-06    0.3278E-06  0.5912E-06
    12  0.1070E-06  0.5936E-06    0.4917E-06  0.4749E-06
    13  0.1189E-06  0.2384E-06    0.4470E-06  0.1192E-06
    14  0.9956E-07  0.0000E+00    0.0000E+00  0.1198E-06
    15  0.1608E-06  0.3009E-06    0.4470E-07  0.6017E-07
    16  0.2458E-06  0.2419E-06    0.8941E-07  0.2419E-06
    17  0.1530E-06  0.6082E-07    0.1639E-06  0.6082E-07
    18  0.3109E-06  0.6118E-07    0.4470E-07  0.4894E-06
    19  0.2165E-06  0.0000E+00    0.1788E-06  0.2462E-06
    20  0.1591E-06  0.2478E-06    0.2980E-07  0.1239E-06
    21  0.2390E-06  0.1248E-06    0.8941E-07  0.2496E-06
    22  0.1266E-07  0.5656E-06    0.4768E-06  0.5656E-06
    23  0.1465E-06  0.1267E-06    0.1490E-06  0.1267E-06
    24  0.1171E-06  0.6384E-07    0.1192E-06  0.3192E-06
    25  0.2602E-06  0.1288E-06    0.2086E-06  0.1288E-06
    26  0.3566E-07  0.1299E-06    0.3278E-06  0.3248E-06
    27  0.1591E-06  0.1967E-06    0.6557E-06  0.3934E-06
    28  0.3268E-06  0.4635E-06    0.3576E-06  0.5960E-06
    29  0.6454E-07  0.2676E-06    0.4172E-06  0.6690E-06
    30  0.1870E-06  0.3381E-06    0.8941E-07  0.4733E-06
    31  0.1804E-06  0.6838E-07    0.1192E-06  0.2735E-06
    32  0.3905E-06  0.2767E-06    0.3278E-06  0.2767E-06
    33  0.1623E-06  0.1401E-06    0.1490E-06  0.8403E-06
    34  0.4647E-06  0.6383E-06    0.3278E-06  0.7801E-06
    35  0.2273E-06  0.5749E-06    0.2384E-06  0.5749E-06
    36  0.3033E-06  0.3643E-06    0.1490E-06  0.3643E-06
    37  0.4689E-06  0.3696E-06    0.2682E-06  0.5175E-06
    38  0.8952E-07  0.7505E-07    0.2980E-06  0.7505E-07
    39  0.1814E-06  0.7623E-07    0.4470E-06  0.1067E-05
    40  0.4446E-06  0.1472E-05    0.5960E-07  0.5424E-06
    41  0.2006E-06  0.3153E-05    0.5960E-07  0.3153E-06
    42  0.3900E-06  0.1027E-04    0.2384E-06  0.8023E-07
    43  0.1216E-06  0.3187E-04    0.1788E-06  0.4904E-06
    44  0.1767E-05  0.1052E-03    0.1788E-06  0.0000E+00
    45  0.4088E-05  0.3561E-03    0.4768E-06  0.8502E-07
    46  0.1696E-04  0.1251E-02    0.2384E-06  0.3473E-06
    47  0.6019E-04  0.4566E-02    0.2980E-06  0.1775E-06
    48  0.2268E-03  0.1725E-01    0.1788E-06  0.1816E-06
    49  0.8073E-03  0.6675E-01    0.5960E-07  0.2790E-06
    50  0.2236E-02  0.2524E+00    0.1192E-06  0.0000E+00
    51  0.2493E-02  0.7963E+00    0.2980E-06  0.9791E-06
    52  0.1535E-02  0.1470E+01    0.1192E-06  0.8051E-06
    53  0.2786E-02  0.1179E+01    0.1192E-06  0.5179E-06
    54  0.1149E-02  0.5026E+00    0.3576E-06  0.1601E-05
    55  0.2950E-03  0.2052E+00    0.0000E+00  0.5511E-06
    56  0.5950E-04  0.1266E+00    0.1788E-06  0.1140E-06
    57  0.8322E-05  0.1112E+00    0.2384E-06  0.9444E-06
    58                            0.2384E-06  0.1164E-05
    59                            0.5960E-06  0.2549E-06
    60                            0.5960E-07  0.7306E-06
    61                            0.4172E-06  0.5554E-06
    62                            0.2384E-06  0.9459E-06
    63                            0.2980E-06  0.1989E-05
    64                            0.6557E-06  0.4036E-06
    65                            0.1192E-06  0.1710E-06
    66                            0.5960E-07  0.1456E-05
    67                            0.1788E-06  0.9732E-07
    68                            0.5364E-06  0.2094E-06
    69                            0.3576E-06  0.2270E-06
    70                            0.1192E-06  0.8679E-06
    71                            0.0000E+00  0.2053E-06
    72                            0.5960E-07  0.7648E-07
    73                            0.4172E-06  0.1737E-05
    74                            0.1788E-06  0.7045E-06
    75                            0.2384E-06  0.1680E-05
    76                            0.4172E-06  0.7451E-06
    77                            0.4768E-06  0.1185E-05
    78                            0.5960E-07  0.1545E-05
    79                            0.5960E-07  0.2266E-05

                                  0.6557E-06  0.2266E-05



     ierr in sti =  -61           ierr in lancz =   0

     k    erra        errb          erra        errb

     0  0.4657E-09  0.1550E-05    0.7749E-06  0.1550E-05   N = 160
     1  0.2207E-07  0.1678E-05    0.3725E-07  0.0000E+00
     2  0.2555E-08  0.1104E-06    0.3446E-06  0.7727E-06
     3  0.6135E-07  0.1145E-06    0.2980E-07  0.2290E-06
     4  0.5729E-07  0.2319E-06    0.4508E-06  0.5798E-06
     5  0.9344E-08  0.1167E-06    0.4098E-07  0.4666E-06
     6  0.6423E-07  0.3512E-06    0.1118E-07  0.2341E-06
     7  0.2710E-07  0.1173E-06    0.3725E-08  0.3520E-06
     8  0.1737E-06  0.2351E-06    0.3576E-06  0.9405E-06
     9  0.2639E-06  0.7064E-06    0.2608E-07  0.4709E-06
    10  0.2915E-06  0.4716E-06    0.1490E-06  0.0000E+00
    11  0.3963E-06  0.3541E-06    0.4470E-07  0.1180E-06
    12  0.3544E-06  0.1182E-06    0.1043E-06  0.5909E-06
    13  0.2543E-06  0.3550E-06    0.1490E-07  0.7100E-06
    14  0.1053E-06  0.4739E-06    0.7451E-07  0.3554E-06
    15  0.8804E-07  0.0000E+00    0.1043E-06  0.5932E-06
    16  0.1671E-07  0.1188E-06    0.1043E-06  0.1188E-06
    17  0.2794E-06  0.5948E-06    0.7451E-07  0.2379E-06
    18  0.3250E-06  0.0000E+00    0.1118E-06  0.3574E-06
    19  0.1668E-07  0.5966E-07    0.2235E-07  0.5370E-06
    20  0.1255E-07  0.3586E-06    0.8941E-07  0.7171E-06
    21  0.5145E-07  0.5986E-07    0.0000E+00  0.2993E-06
    22  0.6127E-07  0.3598E-06    0.5066E-06  0.5997E-07
    23  0.2108E-06  0.0000E+00    0.2384E-06  0.1202E-06
    24  0.1613E-06  0.2408E-06    0.0000E+00  0.2408E-06
    25  0.3209E-07  0.1809E-06    0.2086E-06  0.6634E-06
    26  0.8163E-07  0.4835E-06    0.8941E-07  0.4231E-06
    27  0.1597E-07  0.5451E-06    0.1788E-06  0.3634E-06
    28  0.1441E-07  0.6070E-06    0.1937E-06  0.1821E-06
    29  0.3073E-07  0.4259E-06    0.2980E-07  0.1825E-06
    30  0.4702E-07  0.3659E-06    0.1788E-06  0.3659E-06
    31  0.3061E-06  0.4280E-06    0.1192E-06  0.2446E-06
    32  0.1237E-06  0.4904E-06    0.1788E-06  0.6130E-07
    33  0.1164E-06  0.2459E-06    0.4172E-06  0.2459E-06
    34  0.8020E-07  0.3082E-06    0.5960E-07  0.3082E-06
    35  0.7664E-07  0.3708E-06    0.7451E-07  0.1545E-05
    36  0.1055E-06  0.6819E-06    0.4023E-06  0.6199E-07
    37  0.2178E-06  0.1244E-06    0.2980E-06  0.1244E-06
    38  0.1473E-06  0.0000E+00    0.1192E-06  0.5613E-06
    39  0.2251E-06  0.6257E-07    0.2980E-07  0.3128E-06
    40  0.6905E-07  0.1256E-06    0.1788E-06  0.1883E-06
    41  0.1756E-06  0.0000E+00    0.1192E-06  0.3149E-06
    42  0.1060E-06  0.2528E-06    0.5960E-07  0.2528E-06
    43  0.4320E-07  0.6344E-07    0.4172E-06  0.6344E-07
    44  0.4718E-07  0.5094E-06    0.8941E-07  0.1146E-05
    45  0.8076E-07  0.0000E+00    0.2980E-07  0.6391E-07
    46  0.9090E-07  0.1925E-06    0.3874E-06  0.2566E-06
    47  0.1901E-06  0.6441E-06    0.4470E-06  0.2577E-06
    48  0.1544E-06  0.0000E+00    0.5066E-06  0.1294E-06
    49  0.1754E-06  0.1299E-06    0.4768E-06  0.5196E-06
    50  0.3465E-06  0.4566E-06    0.8941E-07  0.6523E-06
    51  0.1860E-06  0.3931E-06    0.3278E-06  0.2620E-06
    52  0.1827E-06  0.5265E-06    0.5960E-07  0.6581E-07
    53  0.1517E-06  0.0000E+00    0.4768E-06  0.0000E+00
    54  0.4805E-06  0.8635E-06    0.1788E-06  0.5978E-06
    55  0.1234E-06  0.6007E-06    0.2384E-06  0.1335E-06
    56  0.5379E-06  0.1543E-05    0.3278E-06  0.1073E-05
    57  0.1133E-05  0.3236E-05    0.2980E-06  0.7415E-06
    58  0.1974E-05  0.6031E-05    0.5960E-07  0.2033E-06
    59  0.3852E-05  0.1335E-04    0.2682E-06  0.2725E-06
    60  0.7644E-05  0.2774E-04    0.4172E-06  0.1027E-05
    61                            0.1788E-06  0.9642E-06
    62                            0.2980E-07  0.8311E-06
    63                            0.4768E-06  0.0000E+00
    64                            0.1192E-06  0.9810E-06
    65                            0.2384E-06  0.1410E-06
    66                            0.0000E+00  0.9930E-06
    67                            0.1490E-06  0.6424E-06
    68                            0.7749E-06  0.9338E-06
    69                            0.5662E-06  0.5061E-06
    70                            0.2086E-06  0.0000E+00
    71                            0.0000E+00  0.5130E-06
    72                            0.3576E-06  0.9595E-06
    73                            0.1192E-06  0.1338E-05
    74                            0.2980E-06  0.1048E-05
    75                            0.4172E-06  0.7543E-06
    76                            0.5960E-07  0.7601E-06
    77                            0.2086E-06  0.3064E-06
    78                            0.3576E-06  0.3860E-06
    79                            0.4768E-06  0.5448E-06
    80                            0.5364E-06  0.8633E-06
    81                            0.2980E-06  0.2216E-05
    82                            0.1788E-06  0.1437E-05
    83                            0.2384E-06  0.4832E-06
    84                            0.0000E+00  0.6500E-06
    85                            0.7153E-06  0.0000E+00
    86                            0.8345E-06  0.8277E-07
    87                            0.1192E-06  0.7521E-06
    88                            0.3576E-06  0.5907E-06
    89                            0.4172E-06  0.2131E-05
    90                            0.7749E-06  0.5166E-06
    91                            0.5960E-07  0.6090E-06
    92                            0.2384E-06  0.1495E-05
    93                            0.7749E-06  0.1244E-05
    94                            0.3576E-06  0.1977E-05
    95                            0.5960E-07  0.1364E-05
    96                            0.1788E-06  0.1839E-06
    97                            0.2384E-06  0.4653E-06
    98                            0.1788E-06  0.1884E-05
    99                            0.5364E-06  0.1907E-06
   100                            0.9537E-06  0.9659E-06
   101                            0.8941E-06  0.1468E-05
   102                            0.7749E-06  0.0000E+00
   103                            0.2384E-06  0.1307E-05
   104                            0.4768E-06  0.8154E-06
   105                            0.2980E-06  0.2378E-05
   106                            0.4172E-06  0.1154E-05
   107                            0.1192E-06  0.1065E-05
   108                            0.5960E-07  0.1298E-05
   109                            0.2384E-06  0.3295E-06
   110                            0.1192E-06  0.1116E-06
   111                            0.5364E-06  0.9078E-06
   112                            0.1192E-06  0.1270E-05
   113                            0.2384E-06  0.4697E-06
   114                            0.2384E-06  0.3587E-06
   115                            0.2384E-06  0.1522E-05
   116                            0.5960E-07  0.3040E-05
   117                            0.8941E-06  0.1265E-05
   118                            0.4768E-06  0.1420E-05
   119                            0.1788E-06  0.7245E-06
   120                            0.4172E-06  0.1682E-05
   121                            0.1073E-05  0.6875E-07
   122                            0.5364E-06  0.1055E-05
   123                            0.4172E-06  0.8634E-06
   124                            0.2384E-06  0.2948E-06
   125                            0.1192E-06  0.3777E-06
   126                            0.7153E-06  0.2402E-05
   127                            0.2384E-06  0.7160E-06
   128                            0.3576E-06  0.8993E-06
   129                            0.1192E-06  0.2775E-05
   130                            0.7749E-06  0.1039E-05
   131                            0.5960E-07  0.9821E-06
   132                            0.1192E-06  0.8294E-06
   133                            0.0000E+00  0.1429E-05
   134                            0.1192E-06  0.1577E-05
   135                            0.3576E-06  0.2656E-05
   136                            0.4172E-06  0.2757E-05
   137                            0.6557E-06  0.2096E-05
   138                            0.5960E-07  0.1149E-06
   139                            0.1192E-06  0.1200E-06
   140                            0.5364E-06  0.2135E-05
   141                            0.2980E-06  0.3425E-05
   142                            0.0000E+00  0.3257E-05
   143                            0.9537E-06  0.9507E-06
   144                            0.8941E-06  0.1859E-05
   145                            0.5960E-06  0.0000E+00
   146                            0.5960E-07  0.5892E-05
   147                            0.4172E-06  0.1793E-05
   148                            0.2980E-06  0.5096E-06
   149                            0.8345E-06  0.4212E-05
   150                            0.0000E+00  0.7899E-06
   151                            0.1013E-05  0.6729E-06
   152                            0.8941E-06  0.1056E-05
   153                            0.7153E-06  0.1719E-05
   154                            0.7153E-06  0.9998E-07
   155                            0.8941E-06  0.3588E-06
   156                            0.4768E-06  0.1863E-05
   157                            0.1192E-06  0.2179E-05
   158                            0.4768E-06  0.5109E-05
   159                            0.2980E-06  0.2583E-05

                                  0.1073E-05  0.5892E-05



     ierr in sti =  -62           ierr in lancz =   0

     k    erra        errb          erra        errb

     0  0.6985E-09  0.2623E-05    0.2027E-05  0.2623E-05   N = 320
     1  0.2707E-07  0.2577E-05    0.4750E-06  0.2399E-05
     2  0.5820E-07  0.1111E-06    0.1381E-05  0.1111E-05
     3  0.1125E-06  0.2304E-06    0.1433E-05  0.3916E-05
     4  0.7826E-07  0.2333E-06    0.1163E-05  0.2566E-05
     5  0.6257E-07  0.2346E-06    0.9798E-06  0.1760E-05
     6  0.9503E-07  0.3531E-06    0.7469E-06  0.1765E-05
     7  0.1857E-06  0.4717E-06    0.7302E-06  0.1533E-05
     8  0.2141E-06  0.0000E+00    0.2086E-06  0.7085E-06
     9  0.2308E-06  0.1182E-06    0.1919E-06  0.0000E+00
    10  0.3160E-06  0.1183E-06    0.3502E-06  0.1183E-06
    11  0.2683E-06  0.0000E+00    0.1155E-06  0.1184E-06
    12  0.3614E-06  0.1184E-06    0.2831E-06  0.8290E-06
    13  0.2425E-06  0.0000E+00    0.3055E-06  0.7109E-06
    14  0.7144E-07  0.2371E-06    0.4992E-06  0.9483E-06
    15  0.4442E-08  0.1186E-06    0.6706E-07  0.7116E-06
    16  0.1370E-06  0.2373E-06    0.1602E-06  0.1186E-06
    17  0.2157E-06  0.3561E-06    0.5215E-07  0.2374E-06
    18  0.3552E-06  0.0000E+00    0.1267E-06  0.1187E-06
    19  0.2054E-06  0.3564E-06    0.3725E-08  0.0000E+00
    20  0.1416E-06  0.2377E-06    0.2980E-07  0.0000E+00
    21  0.1804E-06  0.0000E+00    0.5215E-06  0.4756E-06
    22  0.5183E-06  0.3569E-06    0.1192E-06  0.1309E-05
    23  0.2923E-06  0.3571E-06    0.5439E-06  0.0000E+00
    24  0.4910E-06  0.1191E-06    0.9686E-07  0.9527E-06
    25  0.4756E-06  0.0000E+00    0.9686E-07  0.4766E-06
    26  0.5880E-06  0.2384E-06    0.1788E-06  0.8345E-06
    27  0.7105E-06  0.8946E-06    0.1341E-06  0.5367E-06
    28  0.5089E-06  0.7757E-06    0.4470E-07  0.7160E-06
    29  0.4718E-06  0.8359E-06    0.2459E-06  0.5373E-06
    30  0.4054E-06  0.0000E+00    0.5215E-07  0.8364E-06
    31  0.4322E-06  0.4782E-06    0.1565E-06  0.3587E-06
    32  0.3102E-06  0.2393E-06    0.1267E-06  0.4187E-06
    33  0.4340E-06  0.3591E-06    0.2384E-06  0.5986E-06
    34  0.3218E-06  0.4193E-06    0.2086E-06  0.5990E-07
    35  0.5473E-06  0.7193E-06    0.2459E-06  0.3596E-06
    36  0.6337E-06  0.1200E-06    0.5513E-06  0.4199E-06
    37  0.7054E-06  0.3601E-06    0.1490E-06  0.2401E-06
    38  0.1093E-05  0.4806E-06    0.2235E-07  0.4205E-06
    39  0.7783E-06  0.1803E-06    0.3725E-07  0.7214E-06
    40  0.9637E-06  0.3008E-06    0.1043E-06  0.2407E-06
    41  0.7127E-06  0.1204E-06    0.3725E-06  0.1806E-06
    42  0.4258E-06  0.4218E-06    0.1341E-06  0.0000E+00
    43  0.2730E-06  0.4222E-06    0.1639E-06  0.1146E-05
    44  0.3125E-06  0.6037E-07    0.4768E-06  0.7848E-06
    45  0.3577E-06  0.3021E-06    0.4321E-06  0.3021E-06
    46  0.1550E-06  0.7862E-06    0.4619E-06  0.1814E-06
    47  0.5581E-06  0.4843E-06    0.3576E-06  0.7869E-06
    48  0.7224E-06  0.5453E-06    0.1490E-07  0.9088E-06
    49  0.6034E-06  0.5458E-06    0.5364E-06  0.6065E-06
    50  0.1060E-05  0.2428E-06    0.4470E-07  0.3643E-06
    51  0.8161E-06  0.4862E-06    0.2533E-06  0.6077E-07
    52  0.9969E-06  0.1217E-06    0.2235E-06  0.3042E-06
    53  0.8545E-06  0.3654E-06    0.7302E-06  0.4872E-06
    54  0.1211E-05  0.4877E-06    0.1788E-06  0.6096E-06
    55  0.1076E-05  0.8544E-06    0.1341E-06  0.1831E-06
    56  0.8642E-06  0.1833E-06    0.5066E-06  0.1222E-05
    57  0.6476E-06  0.7952E-06    0.7302E-06  0.1957E-05
    58  0.1243E-05  0.1837E-06    0.1788E-06  0.3062E-06
    59  0.9208E-06  0.6131E-06    0.2086E-06  0.3066E-06
    60  0.1135E-05  0.1228E-06    0.1639E-06  0.4297E-06
    61  0.1153E-05  0.1352E-05    0.1341E-06  0.1414E-05
    62                            0.3725E-06  0.1108E-05
    63                            0.2980E-06  0.2465E-06
    64                            0.3278E-06  0.1851E-06
    65                            0.3725E-06  0.8031E-06
    66                            0.3874E-06  0.2289E-05
    67                            0.1192E-06  0.7433E-06
    68                            0.2831E-06  0.2481E-06
    69                            0.4470E-07  0.7454E-06
    70                            0.5960E-07  0.1493E-05
    71                            0.1088E-05  0.0000E+00
    72                            0.5662E-06  0.1061E-05
    73                            0.0000E+00  0.1874E-06
    74                            0.5215E-06  0.6258E-07
    75                            0.1192E-06  0.1003E-05
    76                            0.1341E-06  0.1444E-05
    77                            0.7451E-07  0.1572E-05
    78                            0.4172E-06  0.6927E-06
    79                            0.3278E-06  0.2523E-06
    80                            0.5066E-06  0.3159E-06
    81                            0.5960E-07  0.3164E-06
    82                            0.4470E-06  0.6339E-07
    83                            0.4470E-06  0.8255E-06
    84                            0.7451E-06  0.2545E-06
    85                            0.1490E-06  0.6373E-06
    86                            0.1788E-06  0.0000E+00
    87                            0.1788E-06  0.1343E-05
    88                            0.4470E-06  0.1922E-06
    89                            0.2980E-06  0.7704E-06
    90                            0.2980E-06  0.8361E-06
    91                            0.0000E+00  0.5800E-06
    92                            0.3576E-06  0.2583E-06
    93                            0.1192E-06  0.1941E-06
    94                            0.2980E-06  0.1945E-06
    95                            0.2086E-06  0.2014E-05
    96                            0.4172E-06  0.1953E-06
    97                            0.8941E-07  0.5870E-06
    98                            0.1490E-06  0.6536E-06
    99                            0.2384E-06  0.9170E-06
   100                            0.2980E-06  0.5251E-06
   101                            0.2086E-06  0.1776E-05
   102                            0.1490E-06  0.1780E-05
   103                            0.1788E-06  0.1388E-05
   104                            0.4470E-06  0.7285E-06
   105                            0.2384E-06  0.7302E-06
   106                            0.8047E-06  0.0000E+00
   107                            0.4172E-06  0.2067E-05
   108                            0.5066E-06  0.2005E-06
   109                            0.3576E-06  0.9381E-06
   110                            0.6855E-06  0.0000E+00
   111                            0.4768E-06  0.1010E-05
   112                            0.1013E-05  0.9450E-06
   113                            0.2980E-07  0.6767E-07
   114                            0.0000E+00  0.4070E-06
   115                            0.8941E-07  0.1428E-05
   116                            0.3576E-06  0.6819E-07
   117                            0.0000E+00  0.0000E+00
   118                            0.3278E-06  0.1234E-05
   119                            0.2384E-06  0.0000E+00
   120                            0.2384E-06  0.4825E-06
   121                            0.2086E-06  0.2765E-06
   122                            0.7451E-06  0.0000E+00
   123                            0.4768E-06  0.6950E-06
   124                            0.7451E-06  0.1394E-05
   125                            0.5960E-06  0.2097E-06
   126                            0.1490E-06  0.1612E-05
   127                            0.0000E+00  0.9843E-06
   128                            0.5662E-06  0.2186E-05
   129                            0.3576E-06  0.1415E-06
   130                            0.2980E-07  0.4966E-06
   131                            0.2086E-06  0.1210E-05
   132                            0.5960E-07  0.1642E-05
   133                            0.8941E-06  0.1647E-05
   134                            0.3874E-06  0.9337E-06
   135                            0.8941E-07  0.2882E-06
   136                            0.3874E-06  0.2602E-05
   137                            0.3874E-06  0.7253E-07
   138                            0.1013E-05  0.1455E-06
   139                            0.1281E-05  0.1898E-05
   140                            0.9537E-06  0.1465E-06
   141                            0.2682E-06  0.5145E-06
   142                            0.1132E-05  0.3688E-06
   143                            0.9835E-06  0.8881E-06
   144                            0.5662E-06  0.1188E-05
   145                            0.5960E-07  0.6708E-06
   146                            0.1788E-06  0.8976E-06
   147                            0.9835E-06  0.1126E-05
   148                            0.5066E-06  0.7535E-07
   149                            0.5960E-07  0.5294E-06
   150                            0.4768E-06  0.7591E-07
   151                            0.4172E-06  0.9144E-06
   152                            0.2682E-06  0.1300E-05
   153                            0.3278E-06  0.1612E-05
   154                            0.7153E-06  0.2004E-05
   155                            0.5364E-06  0.0000E+00
   156                            0.5364E-06  0.2331E-06
   157                            0.6557E-06  0.3901E-06
   158                            0.9537E-06  0.1175E-05
   159                            0.6258E-06  0.2359E-06
   160                            0.5364E-06  0.3159E-06
   161                            0.5960E-07  0.1269E-05
   162                            0.5960E-07  0.2230E-05
   163                            0.4172E-06  0.2400E-05
   164                            0.4172E-06  0.8836E-06
   165                            0.2980E-06  0.1291E-05
   166                            0.8345E-06  0.8104E-07
   167                            0.1132E-05  0.1709E-05
   168                            0.5960E-07  0.8177E-07
   169                            0.5364E-06  0.1643E-05
   170                            0.1788E-06  0.1485E-05
   171                            0.5960E-07  0.2902E-05
   172                            0.4172E-06  0.1000E-05
   173                            0.5960E-06  0.1841E-05
   174                            0.8941E-06  0.2439E-05
   175                            0.7749E-06  0.1352E-05
   176                            0.5960E-07  0.1359E-05
   177                            0.3576E-06  0.1365E-05
   178                            0.2980E-06  0.7719E-06
   179                            0.0000E+00  0.1121E-05
   180                            0.1132E-05  0.5199E-06
   181                            0.5960E-06  0.1045E-05
   182                            0.5960E-07  0.1751E-06
   183                            0.1192E-06  0.1144E-05
   184                            0.8345E-06  0.1681E-05
   185                            0.2980E-06  0.0000E+00
   186                            0.5364E-06  0.7156E-06
   187                            0.6557E-06  0.1439E-05
   188                            0.1132E-05  0.9045E-07
   189                            0.1192E-06  0.3639E-06
   190                            0.1252E-05  0.4574E-06
   191                            0.5364E-06  0.1564E-05
   192                            0.7153E-06  0.1296E-05
   193                            0.8941E-06  0.6517E-06
   194                            0.2384E-06  0.2529E-05
   195                            0.8941E-06  0.1036E-05
   196                            0.2384E-06  0.2370E-05
   197                            0.7749E-06  0.1049E-05
   198                            0.5960E-06  0.1056E-05
   199                            0.7749E-06  0.9658E-06
   200                            0.2384E-06  0.1652E-05
   201                            0.1192E-06  0.9783E-06
   202                            0.1788E-06  0.2954E-06
   203                            0.5364E-06  0.4956E-06
   204                            0.1311E-05  0.1696E-05
   205                            0.1431E-05  0.3818E-05
   206                            0.2980E-06  0.7081E-06
   207                            0.1192E-06  0.3056E-06
   208                            0.1788E-06  0.1641E-05
   209                            0.7153E-06  0.1653E-05
   210                            0.7153E-06  0.5202E-06
   211                            0.9537E-06  0.4297E-05
   212                            0.5960E-07  0.1267E-05
   213                            0.7153E-06  0.3191E-06
   214                            0.1013E-05  0.1607E-05
   215                            0.1013E-05  0.1188E-05
   216                            0.2980E-06  0.1415E-05
   217                            0.6557E-06  0.7676E-06
   218                            0.7153E-06  0.3316E-05
   219                            0.3576E-06  0.3788E-05
   220                            0.7153E-06  0.2359E-05
   221                            0.6557E-06  0.1132E-05
   222                            0.5960E-06  0.3426E-06
   223                            0.4768E-06  0.1958E-05
   224                            0.4172E-06  0.3136E-05
   225                            0.8345E-06  0.8200E-06
   226                            0.1311E-05  0.1182E-06
   227                            0.2980E-06  0.1669E-05
   228                            0.5960E-07  0.1865E-05
   229                            0.8345E-06  0.0000E+00
   230                            0.5960E-07  0.1961E-05
   231                            0.8345E-06  0.2350E-05
   232                            0.1192E-06  0.3683E-05
   233                            0.6557E-06  0.3971E-05
   234                            0.2205E-05  0.5092E-06
   235                            0.9537E-06  0.2379E-05
   236                            0.2384E-06  0.1948E-06
   237                            0.2384E-06  0.1968E-05
   238                            0.5960E-06  0.3314E-06
   239                            0.1788E-06  0.1072E-05
   240                            0.1669E-05  0.3385E-06
   241                            0.6557E-06  0.1437E-05
   242                            0.1192E-06  0.1245E-05
   243                            0.1252E-05  0.4197E-05
   244                            0.4172E-06  0.2406E-05
   245                            0.5364E-06  0.1002E-05
   246                            0.1788E-06  0.1665E-05
   247                            0.7153E-06  0.1172E-05
   248                            0.1192E-06  0.7416E-07
   249                            0.2384E-06  0.7507E-06
   250                            0.3576E-06  0.1292E-05
   251                            0.4768E-06  0.1309E-05
   252                            0.7153E-06  0.2495E-05
   253                            0.1013E-05  0.1106E-05
   254                            0.1192E-05  0.2802E-05
   255                            0.9537E-06  0.3246E-06
   256                            0.4768E-06  0.2468E-06
   257                            0.1073E-05  0.4672E-05
   258                            0.4768E-06  0.0000E+00
   259                            0.2980E-06  0.3950E-05
   260                            0.4768E-06  0.2614E-05
   261                            0.5960E-06  0.1062E-05
   262                            0.2980E-06  0.2695E-05
   263                            0.8941E-06  0.9126E-06
   264                            0.2980E-06  0.2875E-05
   265                            0.5364E-06  0.3299E-05
   266                            0.7749E-06  0.3738E-05
   267                            0.5364E-06  0.5166E-05
   268                            0.1192E-06  0.3769E-05
   269                            0.1192E-06  0.1817E-05
   270                            0.4172E-06  0.4112E-06
   271                            0.5960E-06  0.1152E-05
   272                            0.9537E-06  0.2135E-06
   273                            0.2980E-06  0.7617E-06
   274                            0.5960E-07  0.4440E-06
   275                            0.4768E-06  0.7929E-06
   276                            0.1788E-06  0.4626E-06
   277                            0.1431E-05  0.1536E-05
   278                            0.7749E-06  0.3441E-05
   279                            0.1013E-05  0.1791E-05
   280                            0.1848E-05  0.1895E-06
   281                            0.1788E-06  0.4593E-05
   282                            0.3576E-06  0.9280E-06
   283                            0.2384E-06  0.1699E-05
   284                            0.7153E-06  0.5649E-05
   285                            0.1788E-06  0.3581E-06
   286                            0.3576E-06  0.9567E-06
   287                            0.2980E-06  0.6813E-06
   288                            0.2384E-06  0.7482E-05
   289                            0.1192E-05  0.4899E-05
   290                            0.5364E-06  0.1657E-05
   291                            0.1132E-05  0.2396E-05
   292                            0.4172E-06  0.4424E-06
   293                            0.4172E-06  0.1283E-05
   294                            0.5960E-07  0.1330E-05
   295                            0.1132E-05  0.1282E-05
   296                            0.2980E-06  0.1436E-05
   297                            0.9537E-06  0.7480E-06
   298                            0.1371E-05  0.1673E-05
   299                            0.6557E-06  0.2216E-05
   300                            0.1013E-05  0.5503E-06
   301                            0.7153E-06  0.1928E-05
   302                            0.8941E-06  0.5147E-05
   303                            0.1073E-05  0.7875E-06
   304                            0.5960E-07  0.4708E-05
   305                            0.4768E-06  0.4124E-05
   306                            0.0000E+00  0.6575E-05
   307                            0.5364E-06  0.2325E-05
   308                            0.1192E-06  0.4326E-05
   309                            0.1192E-06  0.8766E-05
   310                            0.0000E+00  0.7401E-05
   311                            0.1192E-06  0.7877E-05
   312                            0.2980E-06  0.1192E-04
   313                            0.0000E+00  0.5989E-06
   314                            0.1192E-06  0.1395E-05
   315                            0.9537E-06  0.5970E-07
   316                            0.1132E-05  0.4545E-05
   317                            0.0000E+00  0.7637E-05
   318                            0.1192E-06  0.9804E-05
   319                            0.2384E-06  0.3115E-05

                                  0.2205E-05  0.1192E-04

C-END-OF-FILE

cat <<C-END-OF-FILE > test4.f
c
c
      program test4
c
c
      external qchle
      dimension a(81),b(81),e(81),xp(1),yp(1),endl(1),endr(1),
     *xfer(1),wfer(1),alpha(80),beta(80),be(80),x(81),w(81),
     *xm(162),wm(162),p0(162),p1(162),p2(162),betap(80,3)
      logical finl,finr
      common/s/c,a,b,e,epsma
c
c This is a test of the routine  mcdis, which is applied to generate
c the first 80 recurrence coefficients for the orthogonal polynomials
c belonging to the weight function
c
c       (1-x**2)**(-1/2) + c   on (-1,1),  c = 1, 10, 100.
c
c The corresponding inner product is discretized by applying the
c Gauss-Chebyshev quadrature rule to the first term of the weight
c function, and the Gauss-Legendre rule to the second term. In
c addition to the beta-coefficients (all alpha's are zero), the
c routine prints the variables  ncap  and  kount  to confirm 
c convergence after one iteration.
c 
      write(*,1)
    1 format(/)
c
c epsma is the machine single precision.
c
      epsma=r1mach(3)
      iq=1
      idelta=2
      irout=1
      n=80
      mc=2
      mp=0
      ncapm=81
      eps=5000.*epsma
      iem=0
      c=.1
      do 20 ic=1,3
        c=10.*c
c
c Compute the desired recursion coefficients. On machines with limited
c exponent range, harmless underflow may occur in the routine  gauss
c used in  qchle  to generate the Gauss-Legendre quadrature rule.
c
        call mcdis(n,ncapm,mc,mp,xp,yp,qchle,eps,iq,idelta,irout,finl,
     *    finr,endl,endr,xfer,wfer,alpha,beta,ncap,kount,ierr,ie,be,
     *    x,w,xm,wm,p0,p1,p2)
        write(*,2) ncap,kount,ierr,ie,c
    2   format(3x,'ncap = ',i3,' kount = ',i2,' ierr = ',i3,
     *    ' ie = ',i3,' for c = ',f5.1)
        if(abs(ie).gt.iem) iem=abs(ie)
        if(ie.ne.0 .and. abs(ie).le.n) then
          call mcdis(abs(ie)-1,ncapm,mc,mp,xp,yp,qchle,eps,iq,idelta,
     *    irout,finl,finr,endl,endr,xfer,wfer,alpha,beta,ncap,kount,
     *    ierr,ie,be,x,w,xm,wm,p0,p1,p2)
          write(*,2) ncap,kount,ierr,ie,c
          write(*,1)
        end if
c
c Assemble the results in an array.
c
        do 10 k=1,n
          if(ie.eq.0 .or. k-1.lt.abs(ie)) then
            betap(k,ic)=beta(k)
          else
            betap(k,ic)=0.
          end if
   10   continue
   20 continue
c
c Print the results.
c
      write(*,3)
    3 format(//3x,'k',2x,'beta(k), c=1',3x,'beta(k), c=10',2x,
     *  'beta(k), c=100'/)
      do 30 k=1,n
        km1=k-1
        if(iem.eq.0 .or. km1.lt.iem) write(*,4) km1,betap(k,1),
     *    betap(k,2),betap(k,3)
    4   format(1x,i3,3e15.7)
   30 continue
      stop
      end 

      subroutine qchle(n,x,w,i,ierr)
      dimension x(n),w(n),a(81),b(81),e(81)
      common/s/c,a,b,e,epsma
      fn=real(n)
      pi=4.*atan(1.)
      if(i.eq.1) then
        do 10 k=1,n
          fk=real(k)
          x(k)=cos((2.*fk-1.)*pi/(2.*fn))
          w(k)=pi/fn
   10   continue
      else
        call recur(n,1,0.,0.,a,b,ierr)
        call gauss(n,a,b,epsma,x,w,ierr,e)
        do 20 k=1,n
          w(k)=c*w(k)
   20   continue
      end if
      return
      end  

      function wf(x,i)
c
c This is a dummy function. It is never called, since the routine
c qgp  in  mcdis  which requires  wf  is not activated in this test.
c
      wf=0.
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test4.out


 output of test4:


   ncap =  81 kount =  1 ierr =   0 ie = -64 for c =   1.0
   ncap =  64 kount =  1 ierr =   0 ie =   0 for c =   1.0


   ncap =  81 kount =  1 ierr =   0 ie = -65 for c =  10.0
   ncap =  65 kount =  1 ierr =   0 ie =   0 for c =  10.0


   ncap =  81 kount =  1 ierr =   0 ie = -66 for c = 100.0
   ncap =  66 kount =  1 ierr =   0 ie =   0 for c = 100.0




   k  beta(k), c=1   beta(k), c=10  beta(k), c=100

   0  0.5141590E+01  0.2314159E+02  0.2031416E+03
   1  0.4351695E+00  0.3559593E+00  0.3359111E+00
   2  0.2701372E+00  0.2726445E+00  0.2675423E+00
   3  0.2554833E+00  0.2599946E+00  0.2576706E+00
   4  0.2521528E+00  0.2555836E+00  0.2543430E+00
   5  0.2510397E+00  0.2535186E+00  0.2528130E+00
   6  0.2505736E+00  0.2523877E+00  0.2519803E+00
   7  0.2503471E+00  0.2517037E+00  0.2514742E+00
   8  0.2502255E+00  0.2512628E+00  0.2511438E+00
   9  0.2501538E+00  0.2509628E+00  0.2509149E+00
  10  0.2501097E+00  0.2507512E+00  0.2507500E+00
  11  0.2500808E+00  0.2505974E+00  0.2506272E+00
  12  0.2500609E+00  0.2504824E+00  0.2505324E+00
  13  0.2500473E+00  0.2503948E+00  0.2504589E+00
  14  0.2500373E+00  0.2503272E+00  0.2503988E+00
  15  0.2500300E+00  0.2502740E+00  0.2503503E+00
  16  0.2500245E+00  0.2502318E+00  0.2503105E+00
  17  0.2500200E+00  0.2501976E+00  0.2502770E+00
  18  0.2500169E+00  0.2501690E+00  0.2502493E+00
  19  0.2500144E+00  0.2501465E+00  0.2502250E+00
  20  0.2500121E+00  0.2501267E+00  0.2502041E+00
  21  0.2500104E+00  0.2501119E+00  0.2501855E+00
  22  0.2500088E+00  0.2500980E+00  0.2501708E+00
  23  0.2500076E+00  0.2500865E+00  0.2501562E+00
  24  0.2500068E+00  0.2500771E+00  0.2501443E+00
  25  0.2500061E+00  0.2500682E+00  0.2501339E+00
  26  0.2500055E+00  0.2500611E+00  0.2501238E+00
  27  0.2500046E+00  0.2500543E+00  0.2501151E+00
  28  0.2500042E+00  0.2500488E+00  0.2501074E+00
  29  0.2500039E+00  0.2500446E+00  0.2501005E+00
  30  0.2500033E+00  0.2500404E+00  0.2500942E+00
  31  0.2500030E+00  0.2500362E+00  0.2500891E+00
  32  0.2500029E+00  0.2500336E+00  0.2500830E+00
  33  0.2500027E+00  0.2500312E+00  0.2500790E+00
  34  0.2500021E+00  0.2500271E+00  0.2500735E+00
  35  0.2500022E+00  0.2500257E+00  0.2500694E+00
  36  0.2500018E+00  0.2500233E+00  0.2500654E+00
  37  0.2500013E+00  0.2500215E+00  0.2500629E+00
  38  0.2500018E+00  0.2500201E+00  0.2500584E+00
  39  0.2500021E+00  0.2500185E+00  0.2500565E+00
  40  0.2500009E+00  0.2500173E+00  0.2500535E+00
  41  0.2500016E+00  0.2500162E+00  0.2500514E+00
  42  0.2500012E+00  0.2500152E+00  0.2500482E+00
  43  0.2500010E+00  0.2500144E+00  0.2500463E+00
  44  0.2500013E+00  0.2500127E+00  0.2500445E+00
  45  0.2500010E+00  0.2500117E+00  0.2500422E+00
  46  0.2500007E+00  0.2500117E+00  0.2500407E+00
  47  0.2500010E+00  0.2500101E+00  0.2500392E+00
  48  0.2500006E+00  0.2500108E+00  0.2500366E+00
  49  0.2500007E+00  0.2500098E+00  0.2500353E+00
  50  0.2500009E+00  0.2500081E+00  0.2500330E+00
  51  0.2500001E+00  0.2500078E+00  0.2500329E+00
  52  0.2500014E+00  0.2500074E+00  0.2500315E+00
  53  0.2500001E+00  0.2500076E+00  0.2500305E+00
  54  0.2500005E+00  0.2500074E+00  0.2500286E+00
  55  0.2500007E+00  0.2500060E+00  0.2500297E+00
  56  0.2500004E+00  0.2500063E+00  0.2500255E+00
  57  0.2500006E+00  0.2500052E+00  0.2500259E+00
  58  0.2500007E+00  0.2500055E+00  0.2500261E+00
  59  0.2500005E+00  0.2500045E+00  0.2500244E+00
  60  0.2500004E+00  0.2500050E+00  0.2500231E+00
  61  0.2499993E+00  0.2500033E+00  0.2500229E+00
  62  0.2500009E+00  0.2500061E+00  0.2500210E+00
  63  0.2500001E+00  0.2500027E+00  0.2500197E+00
  64  0.0000000E+00  0.2500051E+00  0.2500210E+00
  65  0.0000000E+00  0.0000000E+00  0.2500199E+00


C-END-OF-FILE

cat <<C-END-OF-FILE > test5.f
c
c
      program test5
c
c
      external qjac
      dimension a(41),b(41),e(41),xp(1),yp(1),endl(1),endr(1),xfer(1),
     *wfer(1),alpha(40), beta(40),be(40),x(41),w(41),xm(42),wm(42),
     *p0(42),p1(42),p2(42)
      double precision dy,dalj,dbej,dalpbe,da(41),db(41),daex(40),
     *dbex(40),dnum,dd,dkm1,dden
      logical finl,finr
      common/s/a,b,e,epsma
c
c This test generates the first 40 recursion coefficients for 
c polynomials orthogonal with respect to the Jacobi weight function
c with parameters  alj = -.8(.2)1., bej = -.8(.2)1.  and an added mass
c point of strength  y = .5, 1, 2, 4, 8  at the left end point. It 
c also computes the maximum relative errors (absolute errors for alpha-
c coefficients near zero) of the computed coefficients by comparing
c them against the exact coefficients known analytically.
c
      write(*,1)
    1 format(/)
c
c epsma is the machine single precision
c
      epsma=r1mach(3)
      iq=1
      idelta=2
      irout=1
      n=40
      mc=1
      mp=1
      xp(1)=-1.
      ncapm=41
      eps=5000.*epsma
      y=.25
      do 40 iy=1,5
        y=2.*y
        dy=dble(y)
        yp(1)=y
        write(*,2) y
    2   format(/1x,'y = ',f6.2/)
        write(*,3)
    3   format(2x,'alj',2x,'bej',5x,'erra',7x,'errb',6x,'alpha',
     *    4x,'beta',4x,'ka',2x,'kb',1x,'ierr',1x,'ie',1x,'it'/)
        do 30 ia=1,10
          alj=-1.+.2*real(ia)
          dalj=dble(alj)
          do 20 ib=1,10
            bej=-1.+.2*real(ib)
            alpbe=alj+bej
            dbej=dble(bej)
            dalpbe=dalj+dbej
c
c Generate the Jacobi recurrence coefficients.
c
            call recur(ncapm,6,alj,bej,a,b,ierr)
            call drecur(ncapm,6,dalj,dbej,da,db,iderr)
c
c Compute the desired recursion coefficients.
c
            call mcdis(n,ncapm,mc,mp,xp,yp,qjac,eps,iq,idelta,irout,
     *        finl,finr,endl,endr,xfer,wfer,alpha,beta,ncap,kount,
     *        ierr,ie,be,x,w,xm,wm,p0,p1,p2)
c
c Compute the exact coefficients by Eqs. (4.19)-(4.21) of the companion
c paper along with the relative errors (absolute errors for alpha-
c coefficients close to zero).
c
            daex(1)=(da(1)-dy)/(1.d0+dy)
            dbex(1)=1.d0+dy
            erra=abs(sngl(dble(alpha(1))-daex(1)))
            if(abs(sngl(daex(1))).gt.eps) erra=erra/abs(sngl(daex(1)))
            errb=abs(sngl((dble(beta(1))-dbex(1))/dbex(1)))
            erram=erra
            alpham=alpha(1)
            errbm=errb
            betam=beta(1)
            kam=0
            kbm=0
            dnum=1.d0+dy
            dd=1.d0
            do 10 k=2,n
              km1=k-1
              dkm1=dble(km1)
              dden=dnum
              if(k.gt.2) dd=(dbej+dkm1)*(dalpbe+dkm1)*dd/((dalj+dkm1
     *          -1.d0)*(dkm1-1.d0))
              dnum=(1.d0+(dbej+dkm1+1.d0)*(dalpbe+dkm1+1.d0)*dy*dd/
     *          (dkm1*(dalj+dkm1)))/(1.d0+dy*dd)
              daex(k)=da(k)+2.d0*dkm1*(dkm1+dalj)*(dnum-1.d0)/
     *          ((dalpbe+2.d0*dkm1)*(dalpbe+2.d0*dkm1+1.d0))
     *          +2.d0*(dbej+dkm1+1.d0)*(dalpbe+dkm1+1.d0)*((1.d0/dnum)
     *          -1.d0)/((dalpbe+2.d0*dkm1+1.d0)*(dalpbe+2.d0*dkm1+2.d0))
              dbex(k)=dnum*db(k)/dden
              erra=abs(sngl(dble(alpha(k))-daex(k)))
              if(abs(sngl(daex(k))).gt.eps) erra=erra/abs(sngl(daex(k)))
              errb=abs(sngl((dble(beta(k))-dbex(k))/dbex(k)))
              if(erra.gt.erram) then
                erram=erra
                alpham=alpha(k)
                kam=km1
              end if
              if(errb.gt.errbm) then
                errbm=errb
                betam=beta(k)
                kbm=km1
              end if
   10       continue
c
c Print the results.
c
            write(*,4) alj,bej,erram,errbm,alpham,betam,kam,kbm,ierr,
     *        ie,kount
    4       format(1x,2f5.2,2e11.4,2f9.6,4i4,i2)
   20     continue
          write(*,1)
   30   continue
   40 continue
      stop
      end 

      subroutine qjac(n,x,w,i,ierr)
      dimension x(n),w(n),a(41),b(41),e(41)
      common/s/a,b,e,epsma
      call gauss(n,a,b,epsma,x,w,ierr,e)
      do 10 k=1,n
        w(k)=w(k)/b(1)
   10 continue
      return
      end  

      function wf(x,i)
c
c This is a dummy function. It is never called, since the routine
c qgp  in  mcdis  which requires  wf  is not activated in this test.
c
      wf=0.
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test5.out


 output of test5:


 y =   0.50

  alj  bej     erra       errb      alpha    beta    ka  kb ierr ie it

 -0.80-0.80 0.5820E-02 0.9059E-05 0.000341 0.249876  21  38   0   0 1
 -0.80-0.60 0.8379E-02 0.5148E-05 0.000324 0.249830  31  39   0   0 1
 -0.80-0.40 0.6120E-02 0.8149E-05 0.000327 0.249772  38  39   0   0 1
 -0.80-0.20 0.3570E-02 0.3399E-05 0.000471 0.249483  37  29   0   0 1
 -0.80 0.00 0.7352E-02 0.3937E-05 0.000553 0.249271  39  27   0   0 1
 -0.80 0.20 0.2943E-02 0.5258E-05 0.000804 0.249539  36  37   0   0 1
 -0.80 0.40 0.2912E-02 0.3481E-05 0.000826 0.249483  39  38   0   0 1
 -0.80 0.60 0.3275E-02 0.3897E-05 0.000983 0.249368  39  37   0   0 1
 -0.80 0.80 0.2611E-02 0.6919E-05 0.001218 0.249311  38  38   0   0 1
 -0.80 1.00 0.9932E-03 0.3184E-05 0.001332 0.247863  39  23   0   0 1


 -0.60-0.80 0.1416E-02 0.5137E-05 0.000390 0.249910  23  39   0   0 1
 -0.60-0.60 0.4508E-02 0.6034E-05 0.000336 0.249859  33  39   0   0 1
 -0.60-0.40 0.6768E-02 0.4833E-05 0.000356 0.249802  39  39   0   0 1
 -0.60-0.20 0.2570E-02 0.4412E-05 0.000840 0.249561  29  30   0   0 1
 -0.60 0.00 0.1866E-02 0.6472E-05 0.000658 0.249663  37  38   0   0 1
 -0.60 0.20 0.2936E-02 0.5793E-05 0.000852 0.249543  36  36   0   0 1
 -0.60 0.40 0.4827E-02 0.7963E-05 0.000911 0.249509  38  38   0   0 1
 -0.60 0.60 0.1893E-02 0.6646E-05 0.001342 0.249426  34  38   0   0 1
 -0.60 0.80 0.1549E-02 0.4140E-05 0.001195 0.249372  39  39   0   0 1
 -0.60 1.00 0.2313E-02 0.4258E-05 0.001368 0.249279  39  39   0   0 1


 -0.40-0.80 0.6284E-02 0.7995E-05 0.000318 0.249927  28  39   0   0 1
 -0.40-0.60 0.3453E-02 0.5118E-05 0.000391 0.249879  32  39   0   0 1
 -0.40-0.40 0.5791E-02 0.3079E-05 0.000399 0.249777  38  35   0   0 1
 -0.40-0.20 0.6360E-02 0.3550E-05 0.000526 0.249620  38  31   0   0 1
 -0.40 0.00 0.3697E-02 0.4026E-05 0.000650 0.249488  38  30   0   0 1
 -0.40 0.20 0.2472E-02 0.3891E-05 0.000791 0.249224  38  27   0   0 1
 -0.40 0.40 0.3946E-02 0.5172E-05 0.000894 0.249446  39  35   0   0 1
 -0.40 0.60 0.2377E-02 0.3395E-05 0.001235 0.248985  36  28   0   0 1
 -0.40 0.80 0.2071E-02 0.5234E-05 0.001280 0.249322  38  37   0   0 1
 -0.40 1.00 0.9532E-03 0.6214E-05 0.001726 0.249133  35  35   0   0 1


 -0.20-0.80 0.3314E-02 0.3664E-05 0.000349 0.249937  28  38   0   0 1
 -0.20-0.60 0.3330E-02 0.4111E-05 0.000498 0.249819  29  30   0   0 1
 -0.20-0.40 0.8978E-02 0.3895E-05 0.000413 0.249736  38  31   0   0 1
 -0.20-0.20 0.4415E-02 0.3796E-05 0.000571 0.249489  37  26   0   0 1
 -0.20 0.00 0.3018E-02 0.3258E-05 0.000742 0.249618  36  34   0   0 1
 -0.20 0.20 0.4826E-02 0.6251E-05 0.000772 0.249580  39  36   0   0 1
 -0.20 0.40 0.1804E-02 0.4280E-05 0.001009 0.249315  37  31   0   0 1
 -0.20 0.60 0.3840E-02 0.4776E-05 0.001062 0.249487  39  39   0   0 1
 -0.20 0.80 0.1281E-02 0.4092E-05 0.001363 0.249404  37  39   0   0 1
 -0.20 1.00 0.1534E-02 0.5262E-05 0.001953 0.249278  33  38   0   0 1


  0.00-0.80 0.4469E-02 0.3612E-05 0.000409 0.249891  26  27   0   0 1
  0.00-0.60 0.4452E-02 0.6726E-05 0.000312 0.249893  37  38   0   0 1
  0.00-0.40 0.4429E-02 0.3873E-05 0.000421 0.249828  38  38   0   0 1
  0.00-0.20 0.3004E-02 0.4153E-05 0.000541 0.249738  38  36   0   0 1
  0.00 0.00 0.2561E-02 0.5547E-05 0.000889 0.249483  33  29   0   0 1
  0.00 0.20 0.2666E-02 0.4969E-05 0.000813 0.249647  38  39   0   0 1
  0.00 0.40 0.1514E-02 0.3666E-05 0.001634 0.249368  29  32   0   0 1
  0.00 0.60 0.1583E-02 0.2769E-05 0.001121 0.249336  38  34   0   0 1
  0.00 0.80 0.1380E-02 0.3003E-05 0.001519 0.249344  35  37   0   0 1
  0.00 1.00 0.1556E-02 0.5293E-05 0.001556 0.249321  37  39   0   0 1


  0.20-0.80 0.7251E-02 0.4760E-05 0.000319 0.249938  29  37   0   0 1
  0.20-0.60 0.9311E-02 0.5855E-05 0.000315 0.249879  36  36   0   0 1
  0.20-0.40 0.4302E-02 0.3807E-05 0.000409 0.249667  38  27   0   0 1
  0.20-0.20 0.6469E-02 0.6887E-05 0.000502 0.249739  39  36   0   0 1
  0.20 0.00 0.4933E-02 0.5615E-05 0.000658 0.249714  38  39   0   0 1
  0.20 0.20 0.4236E-02 0.4118E-05 0.000764 0.249504  39  33   0   0 1
  0.20 0.40 0.2044E-02 0.5082E-05 0.001058 0.249570  36  39   0   0 1
  0.20 0.60 0.1776E-02 0.5237E-05 0.001464 0.249494  33  39   0   0 1
  0.20 0.80 0.1790E-02 0.3674E-05 0.001348 0.249377  37  38   0   0 1
  0.20 1.00 0.7917E-03 0.2866E-05 0.001392 0.246925  39  18   0   0 1


  0.40-0.80 0.5799E-02 0.3325E-05 0.000315 0.249930  27  38   0   0 1
  0.40-0.60 0.7827E-02 0.8880E-05 0.000358 0.249879  32  38   0   0 1
  0.40-0.40 0.8620E-02 0.5760E-05 0.000368 0.249787  39  35   0   0 1
  0.40-0.20 0.2969E-02 0.3172E-05 0.000536 0.249658  37  32   0   0 1
  0.40 0.00 0.3154E-02 0.2796E-05 0.001074 0.249705  29  39   0   0 1
  0.40 0.20 0.2855E-02 0.5291E-05 0.000820 0.249635  37  39   0   0 1
  0.40 0.40 0.2674E-02 0.3822E-05 0.000922 0.249030  38  26   0   0 1
  0.40 0.60 0.2216E-02 0.6172E-05 0.001087 0.249488  38  39   0   0 1
  0.40 0.80 0.1697E-02 0.5463E-05 0.001254 0.249370  38  38   0   0 1
  0.40 1.00 0.1959E-02 0.3901E-05 0.001370 0.248686  39  28   0   0 1


  0.60-0.80 0.2554E-02 0.3926E-05 0.000473 0.249915  19  38   0   0 1
  0.60-0.60 0.3644E-02 0.7216E-05 0.000325 0.249864  31  38   0   0 1
  0.60-0.40 0.6339E-02 0.3412E-05 0.000381 0.249649  36  28   0   0 1
  0.60-0.20 0.9764E-02 0.5014E-05 0.000452 0.249751  39  39   0   0 1
  0.60 0.00 0.2411E-02 0.2945E-05 0.000631 0.249541  37  32   0   0 1
  0.60 0.20 0.2673E-02 0.4545E-05 0.000704 0.249624  39  39   0   0 1
  0.60 0.40 0.3313E-02 0.5339E-05 0.000884 0.249552  38  39   0   0 1
  0.60 0.60 0.1220E-02 0.4411E-05 0.001226 0.249472  35  39   0   0 1
  0.60 0.80 0.2682E-02 0.3587E-05 0.001220 0.249391  38  39   0   0 1
  0.60 1.00 0.1740E-02 0.3033E-05 0.001550 0.248972  36  32   0   0 1


  0.80-0.80 0.3329E-02 0.6616E-05 0.000306 0.249893  18  38   0   0 1
  0.80-0.60 0.3726E-02 0.4119E-05 0.000421 0.249852  23  39   0   0 1
  0.80-0.40 0.7137E-02 0.5441E-05 0.000347 0.249769  35  37   0   0 1
  0.80-0.20 0.5656E-02 0.3898E-05 0.000445 0.249717  37  38   0   0 1
  0.80 0.00 0.3706E-02 0.2612E-05 0.000648 0.249632  35  37   0   0 1
  0.80 0.20 0.4622E-02 0.2760E-05 0.000728 0.249181  37  27   0   0 1
  0.80 0.40 0.1847E-02 0.6166E-05 0.000838 0.249504  38  38   0   0 1
  0.80 0.60 0.2558E-02 0.3863E-05 0.000993 0.249454  38  39   0   0 1
  0.80 0.80 0.2022E-02 0.6405E-05 0.001230 0.249336  37  38   0   0 1
  0.80 1.00 0.1487E-02 0.5536E-05 0.001666 0.249281  34  39   0   0 1


  1.00-0.80 0.3282E-03 0.3378E-05-0.000722 0.249632   4  23   0   0 1
  1.00-0.60 0.3390E-02 0.4870E-05 0.000305 0.249822  20  39   0   0 1
  1.00-0.40 0.3557E-02 0.6135E-05 0.000358 0.249712  30  35   0   0 1
  1.00-0.20 0.4729E-02 0.5045E-05 0.000465 0.249691  33  38   0   0 1
  1.00 0.00 0.7466E-02 0.5390E-05 0.000461 0.249643  39  39   0   0 1
  1.00 0.20 0.2551E-02 0.3377E-05 0.000736 0.248100  35  18   0   0 1
  1.00 0.40 0.2297E-02 0.3527E-05 0.000909 0.249505  35  39   0   0 1
  1.00 0.60 0.2477E-02 0.3099E-05 0.000884 0.249158  39  32   0   0 1
  1.00 0.80 0.1317E-02 0.4609E-05 0.001366 0.249344  34  39   0   0 1
  1.00 1.00 0.1521E-02 0.4104E-05 0.001352 0.249221  37  38   0   0 1



 y =   1.00

  alj  bej     erra       errb      alpha    beta    ka  kb ierr ie it

 -0.80-0.80 0.5762E-02 0.8852E-05 0.000396 0.249869  21  38   0   0 1
 -0.80-0.60 0.7855E-02 0.5331E-05 0.000337 0.249826  31  39   0   0 1
 -0.80-0.40 0.5987E-02 0.8129E-05 0.000330 0.249770  38  39   0   0 1
 -0.80-0.20 0.3583E-02 0.4092E-05 0.000448 0.249482  38  29   0   0 1
 -0.80 0.00 0.7592E-02 0.3827E-05 0.000553 0.249270  39  27   0   0 1
 -0.80 0.20 0.1857E-02 0.5306E-05 0.001318 0.249539  28  37   0   0 1
 -0.80 0.40 0.2849E-02 0.3179E-05 0.000826 0.247676  39  18   0   0 1
 -0.80 0.60 0.3892E-02 0.4164E-05 0.000982 0.249368  39  37   0   0 1
 -0.80 0.80 0.2918E-02 0.7286E-05 0.001218 0.249311  38  38   0   0 1
 -0.80 1.00 0.2338E-02 0.5846E-05 0.001330 0.249215  39  38   0   0 1


 -0.60-0.80 0.2448E-02 0.5505E-05 0.000300 0.249902  28  39   0   0 1
 -0.60-0.60 0.6674E-02 0.6325E-05 0.000354 0.249791  33  33   0   0 1
 -0.60-0.40 0.5298E-02 0.4904E-05 0.000359 0.249799  39  39   0   0 1
 -0.60-0.20 0.3297E-02 0.4544E-05 0.000471 0.249559  39  30   0   0 1
 -0.60 0.00 0.1629E-02 0.6526E-05 0.000735 0.249662  35  38   0   0 1
 -0.60 0.20 0.3652E-02 0.5783E-05 0.000853 0.249543  36  36   0   0 1
 -0.60 0.40 0.4864E-02 0.8294E-05 0.000911 0.249509  38  38   0   0 1
 -0.60 0.60 0.1839E-02 0.6414E-05 0.001342 0.249426  34  38   0   0 1
 -0.60 0.80 0.1602E-02 0.3918E-05 0.001473 0.249372  35  39   0   0 1
 -0.60 1.00 0.2535E-02 0.4371E-05 0.001367 0.249279  39  39   0   0 1


 -0.40-0.80 0.5690E-02 0.7974E-05 0.000354 0.249918  28  39   0   0 1
 -0.40-0.60 0.4067E-02 0.4772E-05 0.000331 0.249872  36  39   0   0 1
 -0.40-0.40 0.5176E-02 0.2940E-05 0.000385 0.249773  39  35   0   0 1
 -0.40-0.20 0.6412E-02 0.3753E-05 0.000529 0.249617  38  31   0   0 1
 -0.40 0.00 0.2497E-02 0.4105E-05 0.000619 0.249487  39  30   0   0 1
 -0.40 0.20 0.2429E-02 0.3699E-05 0.000791 0.249223  38  27   0   0 1
 -0.40 0.40 0.4104E-02 0.5006E-05 0.000894 0.249446  39  35   0   0 1
 -0.40 0.60 0.2189E-02 0.3550E-05 0.001235 0.249114  36  30   0   0 1
 -0.40 0.80 0.1962E-02 0.4838E-05 0.001280 0.249322  38  37   0   0 1
 -0.40 1.00 0.9556E-03 0.6473E-05 0.002328 0.249134  30  35   0   0 1


 -0.20-0.80 0.2126E-02 0.3682E-05 0.000523 0.249927  24  38   0   0 1
 -0.20-0.60 0.4331E-02 0.3796E-05 0.000314 0.249803  38  30   0   0 1
 -0.20-0.40 0.8512E-02 0.4123E-05 0.000421 0.249728  38  31   0   0 1
 -0.20-0.20 0.4224E-02 0.4013E-05 0.000574 0.249483  37  26   0   0 1
 -0.20 0.00 0.3442E-02 0.3146E-05 0.000743 0.249657  36  36   0   0 1
 -0.20 0.20 0.4252E-02 0.6095E-05 0.000772 0.249579  39  36   0   0 1
 -0.20 0.40 0.1559E-02 0.4020E-05 0.001010 0.249315  37  31   0   0 1
 -0.20 0.60 0.4506E-02 0.4789E-05 0.001061 0.249487  39  39   0   0 1
 -0.20 0.80 0.1289E-02 0.4192E-05 0.001233 0.249404  39  39   0   0 1
 -0.20 1.00 0.1240E-02 0.4563E-05 0.001482 0.249278  38  38   0   0 1


  0.00-0.80 0.6530E-02 0.3867E-05 0.000307 0.249870  32  27   0   0 1
  0.00-0.60 0.4333E-02 0.7057E-05 0.000331 0.249884  37  38   0   0 1
  0.00-0.40 0.5616E-02 0.3867E-05 0.000430 0.249823  38  38   0   0 1
  0.00-0.20 0.3439E-02 0.3640E-05 0.000544 0.249736  38  36   0   0 1
  0.00 0.00 0.2272E-02 0.5340E-05 0.000891 0.249481  33  29   0   0 1
  0.00 0.20 0.2232E-02 0.5172E-05 0.000814 0.249647  38  39   0   0 1
  0.00 0.40 0.1914E-02 0.3362E-05 0.001635 0.249367  29  32   0   0 1
  0.00 0.60 0.1162E-02 0.2836E-05 0.001121 0.249089  38  29   0   0 1
  0.00 0.80 0.1777E-02 0.3109E-05 0.001518 0.249344  35  37   0   0 1
  0.00 1.00 0.1596E-02 0.5254E-05 0.001409 0.249321  39  39   0   0 1


  0.20-0.80 0.6264E-02 0.5071E-05 0.000380 0.249927  28  37   0   0 1
  0.20-0.60 0.6177E-02 0.5411E-05 0.000337 0.249868  36  36   0   0 1
  0.20-0.40 0.4350E-02 0.3903E-05 0.000516 0.249792  34  35   0   0 1
  0.20-0.20 0.6264E-02 0.6526E-05 0.000506 0.249736  39  36   0   0 1
  0.20 0.00 0.4233E-02 0.5703E-05 0.000660 0.249713  38  39   0   0 1
  0.20 0.20 0.3984E-02 0.4518E-05 0.000764 0.249503  39  33   0   0 1
  0.20 0.40 0.2003E-02 0.5101E-05 0.000901 0.249570  39  39   0   0 1
  0.20 0.60 0.1545E-02 0.5713E-05 0.001464 0.249494  33  39   0   0 1
  0.20 0.80 0.1850E-02 0.3953E-05 0.001348 0.249377  37  38   0   0 1
  0.20 1.00 0.1823E-02 0.3472E-05 0.001391 0.248997  39  32   0   0 1


  0.40-0.80 0.5320E-02 0.3009E-05 0.000358 0.249920  27  38   0   0 1
  0.40-0.60 0.7004E-02 0.8675E-05 0.000311 0.249869  36  38   0   0 1
  0.40-0.40 0.1275E-01 0.5767E-05 0.000379 0.249779  39  35   0   0 1
  0.40-0.20 0.3595E-02 0.3049E-05 0.000485 0.249630  39  31   0   0 1
  0.40 0.00 0.2595E-02 0.3307E-05 0.001080 0.249562  29  32   0   0 1
  0.40 0.20 0.3340E-02 0.5385E-05 0.000741 0.249635  39  39   0   0 1
  0.40 0.40 0.2633E-02 0.3774E-05 0.000923 0.249029  38  26   0   0 1
  0.40 0.60 0.1250E-02 0.6269E-05 0.001086 0.249487  38  39   0   0 1
  0.40 0.80 0.1912E-02 0.5185E-05 0.001254 0.249370  38  38   0   0 1
  0.40 1.00 0.1934E-02 0.3719E-05 0.001370 0.248686  39  28   0   0 1


  0.60-0.80 0.2883E-02 0.3981E-05 0.000335 0.249900  25  37   0   0 1
  0.60-0.60 0.1516E-01 0.7010E-05 0.000308 0.249853  34  38   0   0 1
  0.60-0.40 0.6137E-02 0.3516E-05 0.000394 0.249634  36  28   0   0 1
  0.60-0.20 0.7684E-02 0.4708E-05 0.000456 0.249749  39  39   0   0 1
  0.60 0.00 0.3880E-02 0.2954E-05 0.000632 0.249539  37  32   0   0 1
  0.60 0.20 0.2542E-02 0.4603E-05 0.000971 0.249623  33  39   0   0 1
  0.60 0.40 0.2131E-02 0.5026E-05 0.000885 0.249551  38  39   0   0 1
  0.60 0.60 0.1684E-02 0.4393E-05 0.001226 0.249471  35  39   0   0 1
  0.60 0.80 0.1986E-02 0.3571E-05 0.001220 0.249390  38  39   0   0 1
  0.60 1.00 0.1339E-02 0.3227E-05 0.001551 0.248972  36  32   0   0 1


  0.80-0.80 0.2700E-02 0.6493E-05 0.000368 0.249882  19  38   0   0 1
  0.80-0.60 0.4051E-02 0.4240E-05 0.000398 0.249842  26  39   0   0 1
  0.80-0.40 0.7266E-02 0.5362E-05 0.000363 0.249762  35  37   0   0 1
  0.80-0.20 0.6076E-02 0.3899E-05 0.000452 0.249664  37  35   0   0 1
  0.80 0.00 0.3295E-02 0.2969E-05 0.000524 0.249631  39  37   0   0 1
  0.80 0.20 0.4014E-02 0.2953E-05 0.000729 0.249508  37  35   0   0 1
  0.80 0.40 0.2593E-02 0.5690E-05 0.000839 0.249504  38  38   0   0 1
  0.80 0.60 0.2431E-02 0.3923E-05 0.000993 0.249454  38  39   0   0 1
  0.80 0.80 0.2436E-02 0.6205E-05 0.001230 0.249336  37  38   0   0 1
  0.80 1.00 0.1298E-02 0.5605E-05 0.001492 0.249281  36  39   0   0 1


  1.00-0.80 0.2019E-02 0.3480E-05 0.000533 0.249601   7  23   0   0 1
  1.00-0.60 0.4713E-02 0.4857E-05 0.000385 0.249811  21  39   0   0 1
  1.00-0.40 0.5653E-02 0.6290E-05 0.000301 0.249704  34  35   0   0 1
  1.00-0.20 0.4399E-02 0.4925E-05 0.000362 0.249687  38  38   0   0 1
  1.00 0.00 0.6353E-02 0.5342E-05 0.000464 0.249642  39  39   0   0 1
  1.00 0.20 0.2483E-02 0.3624E-05 0.000737 0.248086  35  18   0   0 1
  1.00 0.40 0.2703E-02 0.3407E-05 0.000910 0.249505  35  39   0   0 1
  1.00 0.60 0.3006E-02 0.3440E-05 0.000884 0.249158  39  32   0   0 1
  1.00 0.80 0.1721E-02 0.4527E-05 0.001367 0.249344  34  39   0   0 1
  1.00 1.00 0.1151E-02 0.4412E-05 0.001679 0.249221  33  38   0   0 1



 y =   2.00

  alj  bej     erra       errb      alpha    beta    ka  kb ierr ie it

 -0.80-0.80 0.4649E-02 0.8822E-05 0.000429 0.249864  21  38   0   0 1
 -0.80-0.60 0.8917E-02 0.5455E-05 0.000344 0.249824  31  39   0   0 1
 -0.80-0.40 0.6782E-02 0.8042E-05 0.000331 0.249770  38  39   0   0 1
 -0.80-0.20 0.3796E-02 0.3727E-05 0.000448 0.249481  38  29   0   0 1
 -0.80 0.00 0.8010E-02 0.3953E-05 0.000554 0.249270  39  27   0   0 1
 -0.80 0.20 0.3030E-02 0.5121E-05 0.000804 0.249539  36  37   0   0 1
 -0.80 0.40 0.2465E-02 0.3556E-05 0.000918 0.249483  37  38   0   0 1
 -0.80 0.60 0.3668E-02 0.3982E-05 0.000982 0.249401  39  38   0   0 1
 -0.80 0.80 0.3071E-02 0.6036E-05 0.001218 0.249311  38  38   0   0 1
 -0.80 1.00 0.1665E-02 0.3220E-05 0.001331 0.247863  39  23   0   0 1


 -0.60-0.80 0.1928E-02 0.5280E-05 0.000478 0.249897  23  39   0   0 1
 -0.60-0.60 0.4492E-02 0.6338E-05 0.000319 0.249787  35  33   0   0 1
 -0.60-0.40 0.6074E-02 0.5110E-05 0.000362 0.249798  39  39   0   0 1
 -0.60-0.20 0.4609E-02 0.4563E-05 0.000472 0.249558  39  30   0   0 1
 -0.60 0.00 0.2656E-02 0.6703E-05 0.000590 0.249662  39  38   0   0 1
 -0.60 0.20 0.2652E-02 0.6047E-05 0.000852 0.249543  36  36   0   0 1
 -0.60 0.40 0.4826E-02 0.8519E-05 0.000911 0.249509  38  38   0   0 1
 -0.60 0.60 0.2339E-02 0.5969E-05 0.001341 0.249426  34  38   0   0 1
 -0.60 0.80 0.1531E-02 0.3986E-05 0.001474 0.249372  35  39   0   0 1
 -0.60 1.00 0.3805E-02 0.4056E-05 0.001365 0.248864  39  31   0   0 1


 -0.40-0.80 0.5778E-02 0.8033E-05 0.000353 0.249912  29  39   0   0 1
 -0.40-0.60 0.7295E-02 0.5033E-05 0.000302 0.249868  38  39   0   0 1
 -0.40-0.40 0.4451E-02 0.3082E-05 0.000388 0.249771  39  35   0   0 1
 -0.40-0.20 0.7362E-02 0.3915E-05 0.000530 0.249616  38  31   0   0 1
 -0.40 0.00 0.2806E-02 0.4059E-05 0.000620 0.249487  39  30   0   0 1
 -0.40 0.20 0.2215E-02 0.3452E-05 0.000792 0.249223  38  27   0   0 1
 -0.40 0.40 0.4138E-02 0.4655E-05 0.000894 0.249446  39  35   0   0 1
 -0.40 0.60 0.1743E-02 0.3762E-05 0.001234 0.249114  36  30   0   0 1
 -0.40 0.80 0.1473E-02 0.5178E-05 0.001280 0.249322  38  37   0   0 1
 -0.40 1.00 0.8470E-03 0.5944E-05 0.001726 0.249133  35  35   0   0 1


 -0.20-0.80 0.2404E-02 0.3423E-05 0.000413 0.249895  28  33   0   0 1
 -0.20-0.60 0.4511E-02 0.4253E-05 0.000304 0.249794  39  30   0   0 1
 -0.20-0.40 0.8055E-02 0.3881E-05 0.000424 0.249724  38  31   0   0 1
 -0.20-0.20 0.3481E-02 0.3916E-05 0.000575 0.249480  37  26   0   0 1
 -0.20 0.00 0.3207E-02 0.3398E-05 0.000744 0.249537  36  31   0   0 1
 -0.20 0.20 0.4427E-02 0.6286E-05 0.000772 0.249579  39  36   0   0 1
 -0.20 0.40 0.2258E-02 0.3831E-05 0.000914 0.249315  39  31   0   0 1
 -0.20 0.60 0.3813E-02 0.4855E-05 0.001062 0.249487  39  39   0   0 1
 -0.20 0.80 0.1952E-02 0.4092E-05 0.001362 0.249404  37  39   0   0 1
 -0.20 1.00 0.1130E-02 0.5349E-05 0.001952 0.249278  33  38   0   0 1


  0.00-0.80 0.5416E-02 0.3714E-05 0.000485 0.249854  26  27   0   0 1
  0.00-0.60 0.4055E-02 0.6855E-05 0.000342 0.249879  37  38   0   0 1
  0.00-0.40 0.4017E-02 0.3642E-05 0.000434 0.249790  38  35   0   0 1
  0.00-0.20 0.4014E-02 0.3831E-05 0.000612 0.249734  36  36   0   0 1
  0.00 0.00 0.2877E-02 0.5522E-05 0.000893 0.249480  33  29   0   0 1
  0.00 0.20 0.2904E-02 0.5064E-05 0.000814 0.249647  38  39   0   0 1
  0.00 0.40 0.1758E-02 0.3599E-05 0.001635 0.249367  29  32   0   0 1
  0.00 0.60 0.1486E-02 0.2811E-05 0.001121 0.249089  38  29   0   0 1
  0.00 0.80 0.1628E-02 0.2894E-05 0.001519 0.249344  35  37   0   0 1
  0.00 1.00 0.1570E-02 0.5384E-05 0.001556 0.249321  37  39   0   0 1


  0.20-0.80 0.5500E-02 0.4995E-05 0.000380 0.249920  29  37   0   0 1
  0.20-0.60 0.6799E-02 0.5635E-05 0.000349 0.249862  36  36   0   0 1
  0.20-0.40 0.5668E-02 0.4159E-05 0.000425 0.249789  38  35   0   0 1
  0.20-0.20 0.7320E-02 0.6625E-05 0.000507 0.249735  39  36   0   0 1
  0.20 0.00 0.3245E-02 0.5631E-05 0.000662 0.249712  38  39   0   0 1
  0.20 0.20 0.4043E-02 0.3940E-05 0.000764 0.249503  39  33   0   0 1
  0.20 0.40 0.1733E-02 0.4932E-05 0.000901 0.249570  39  39   0   0 1
  0.20 0.60 0.1632E-02 0.5264E-05 0.001464 0.249494  33  39   0   0 1
  0.20 0.80 0.2464E-02 0.3435E-05 0.001347 0.249377  37  38   0   0 1
  0.20 1.00 0.1090E-02 0.3157E-05 0.001392 0.248997  39  32   0   0 1


  0.40-0.80 0.5692E-02 0.2769E-05 0.000387 0.249912  27  38   0   0 1
  0.40-0.60 0.9051E-02 0.8503E-05 0.000323 0.249863  36  38   0   0 1
  0.40-0.40 0.8102E-02 0.6049E-05 0.000383 0.249776  39  35   0   0 1
  0.40-0.20 0.2823E-02 0.3367E-05 0.000544 0.249627  37  31   0   0 1
  0.40 0.00 0.2577E-02 0.2867E-05 0.001083 0.249703  29  39   0   0 1
  0.40 0.20 0.3262E-02 0.5223E-05 0.000821 0.249635  37  39   0   0 1
  0.40 0.40 0.1966E-02 0.3749E-05 0.000923 0.249028  38  26   0   0 1
  0.40 0.60 0.1979E-02 0.5840E-05 0.001087 0.249487  38  39   0   0 1
  0.40 0.80 0.1932E-02 0.5255E-05 0.001254 0.249370  38  38   0   0 1
  0.40 1.00 0.1833E-02 0.3898E-05 0.001370 0.248686  39  28   0   0 1


  0.60-0.80 0.3108E-02 0.4267E-05 0.000318 0.249892  27  37   0   0 1
  0.60-0.60 0.1126E-01 0.7037E-05 0.000323 0.249847  34  38   0   0 1
  0.60-0.40 0.4978E-02 0.3507E-05 0.000402 0.249626  36  28   0   0 1
  0.60-0.20 0.6938E-02 0.4870E-05 0.000458 0.249748  39  39   0   0 1
  0.60 0.00 0.2823E-02 0.3120E-05 0.000575 0.249592  39  34   0   0 1
  0.60 0.20 0.3296E-02 0.4871E-05 0.000706 0.249623  39  39   0   0 1
  0.60 0.40 0.1664E-02 0.4989E-05 0.000886 0.249551  38  39   0   0 1
  0.60 0.60 0.2173E-02 0.4444E-05 0.001105 0.249471  37  39   0   0 1
  0.60 0.80 0.2488E-02 0.3563E-05 0.001220 0.249390  38  39   0   0 1
  0.60 1.00 0.1284E-02 0.3115E-05 0.001551 0.248972  36  32   0   0 1


  0.80-0.80 0.3444E-02 0.6703E-05 0.000435 0.249875  19  38   0   0 1
  0.80-0.60 0.4941E-02 0.4321E-05 0.000306 0.249836  31  39   0   0 1
  0.80-0.40 0.6030E-02 0.5721E-05 0.000371 0.249758  35  37   0   0 1
  0.80-0.20 0.4627E-02 0.4138E-05 0.000454 0.249712  37  38   0   0 1
  0.80 0.00 0.3215E-02 0.2899E-05 0.000652 0.249630  35  37   0   0 1
  0.80 0.20 0.4666E-02 0.2979E-05 0.000730 0.249507  37  35   0   0 1
  0.80 0.40 0.3067E-02 0.5690E-05 0.000840 0.249504  38  38   0   0 1
  0.80 0.60 0.2694E-02 0.3715E-05 0.000993 0.249454  38  39   0   0 1
  0.80 0.80 0.2100E-02 0.6493E-05 0.001230 0.249336  37  38   0   0 1
  0.80 1.00 0.1002E-02 0.5580E-05 0.001279 0.249281  39  39   0   0 1


  1.00-0.80 0.1794E-02 0.3711E-05 0.000377 0.249578  13  23   0   0 1
  1.00-0.60 0.6424E-02 0.4748E-05 0.000319 0.249805  25  39   0   0 1
  1.00-0.40 0.4991E-02 0.6454E-05 0.000311 0.249699  34  35   0   0 1
  1.00-0.20 0.3860E-02 0.5263E-05 0.000481 0.249686  33  38   0   0 1
  1.00 0.00 0.6160E-02 0.5296E-05 0.000465 0.249641  39  39   0   0 1
  1.00 0.20 0.2168E-02 0.3680E-05 0.000738 0.248079  35  18   0   0 1
  1.00 0.40 0.2313E-02 0.3452E-05 0.000910 0.249479  35  38   0   0 1
  1.00 0.60 0.3285E-02 0.3730E-05 0.000884 0.249158  39  32   0   0 1
  1.00 0.80 0.2376E-02 0.4456E-05 0.001368 0.249344  34  39   0   0 1
  1.00 1.00 0.1282E-02 0.4386E-05 0.001678 0.249221  33  38   0   0 1



 y =   4.00

  alj  bej     erra       errb      alpha    beta    ka  kb ierr ie it

 -0.80-0.80 0.5384E-02 0.9100E-05 0.000449 0.249862  21  38   0   0 1
 -0.80-0.60 0.6938E-02 0.5162E-05 0.000347 0.249823  31  39   0   0 1
 -0.80-0.40 0.7226E-02 0.8144E-05 0.000331 0.249769  38  39   0   0 1
 -0.80-0.20 0.3834E-02 0.3755E-05 0.000473 0.249481  37  29   0   0 1
 -0.80 0.00 0.8800E-02 0.3956E-05 0.000554 0.249270  39  27   0   0 1
 -0.80 0.20 0.2588E-02 0.5297E-05 0.000803 0.249539  36  37   0   0 1
 -0.80 0.40 0.3764E-02 0.3479E-05 0.000826 0.249483  39  38   0   0 1
 -0.80 0.60 0.2747E-02 0.3946E-05 0.000983 0.249368  39  37   0   0 1
 -0.80 0.80 0.2508E-02 0.7950E-05 0.001218 0.249311  38  38   0   0 1
 -0.80 1.00 0.3064E-02 0.6028E-05 0.001329 0.249215  39  38   0   0 1


 -0.60-0.80 0.2109E-02 0.5093E-05 0.000456 0.249894  24  39   0   0 1
 -0.60-0.60 0.4615E-02 0.6293E-05 0.000367 0.249784  33  33   0   0 1
 -0.60-0.40 0.5483E-02 0.5076E-05 0.000363 0.249798  39  39   0   0 1
 -0.60-0.20 0.3292E-02 0.4450E-05 0.000472 0.249557  39  30   0   0 1
 -0.60 0.00 0.1072E-02 0.6642E-05 0.001066 0.249662  29  38   0   0 1
 -0.60 0.20 0.3603E-02 0.5463E-05 0.000853 0.249543  36  36   0   0 1
 -0.60 0.40 0.4537E-02 0.7945E-05 0.000912 0.249509  38  38   0   0 1
 -0.60 0.60 0.2364E-02 0.6733E-05 0.001341 0.249425  34  38   0   0 1
 -0.60 0.80 0.1335E-02 0.3990E-05 0.001474 0.249372  35  39   0   0 1
 -0.60 1.00 0.2818E-02 0.4606E-05 0.001367 0.249279  39  39   0   0 1


 -0.40-0.80 0.4637E-02 0.7998E-05 0.000324 0.249909  31  39   0   0 1
 -0.40-0.60 0.5166E-02 0.5237E-05 0.000306 0.249867  38  39   0   0 1
 -0.40-0.40 0.6633E-02 0.3005E-05 0.000409 0.249805  38  38   0   0 1
 -0.40-0.20 0.5453E-02 0.3571E-05 0.000530 0.249615  38  31   0   0 1
 -0.40 0.00 0.2901E-02 0.4007E-05 0.000620 0.249486  39  30   0   0 1
 -0.40 0.20 0.2233E-02 0.3807E-05 0.000792 0.249222  38  27   0   0 1
 -0.40 0.40 0.4264E-02 0.5106E-05 0.000894 0.249446  39  35   0   0 1
 -0.40 0.60 0.1362E-02 0.3450E-05 0.001106 0.249114  38  30   0   0 1
 -0.40 0.80 0.1865E-02 0.5289E-05 0.001280 0.249322  38  37   0   0 1
 -0.40 1.00 0.1019E-02 0.6368E-05 0.001827 0.249133  34  35   0   0 1


 -0.20-0.80 0.1867E-02 0.3386E-05 0.000536 0.249889  25  33   0   0 1
 -0.20-0.60 0.3688E-02 0.3821E-05 0.000559 0.249790  29  30   0   0 1
 -0.20-0.40 0.8607E-02 0.3601E-05 0.000426 0.249723  38  31   0   0 1
 -0.20-0.20 0.4427E-02 0.3689E-05 0.000547 0.249479  38  26   0   0 1
 -0.20 0.00 0.3483E-02 0.3514E-05 0.000744 0.249536  36  31   0   0 1
 -0.20 0.20 0.4229E-02 0.6321E-05 0.000772 0.249579  39  36   0   0 1
 -0.20 0.40 0.1748E-02 0.4214E-05 0.001010 0.249314  37  31   0   0 1
 -0.20 0.60 0.4354E-02 0.4828E-05 0.001061 0.249487  39  39   0   0 1
 -0.20 0.80 0.1723E-02 0.4341E-05 0.001363 0.249404  37  39   0   0 1
 -0.20 1.00 0.2170E-02 0.4875E-05 0.001484 0.249278  38  38   0   0 1


  0.00-0.80 0.7933E-02 0.3759E-05 0.000339 0.249605  32  17   0   0 1
  0.00-0.60 0.3156E-02 0.7039E-05 0.000367 0.249876  36  38   0   0 1
  0.00-0.40 0.5765E-02 0.3893E-05 0.000437 0.249788  38  35   0   0 1
  0.00-0.20 0.3116E-02 0.3650E-05 0.000547 0.249734  38  36   0   0 1
  0.00 0.00 0.1961E-02 0.5491E-05 0.001077 0.249479  30  29   0   0 1
  0.00 0.20 0.2151E-02 0.5428E-05 0.000814 0.249647  38  39   0   0 1
  0.00 0.40 0.2294E-02 0.3479E-05 0.001637 0.249367  29  32   0   0 1
  0.00 0.60 0.1464E-02 0.2732E-05 0.001121 0.249336  38  34   0   0 1
  0.00 0.80 0.1498E-02 0.2935E-05 0.001519 0.249344  35  37   0   0 1
  0.00 1.00 0.1876E-02 0.5808E-05 0.001409 0.249321  39  39   0   0 1


  0.20-0.80 0.4407E-02 0.5045E-05 0.000423 0.249915  28  37   0   0 1
  0.20-0.60 0.6247E-02 0.5486E-05 0.000376 0.249858  35  36   0   0 1
  0.20-0.40 0.5635E-02 0.3999E-05 0.000427 0.249787  38  35   0   0 1
  0.20-0.20 0.5328E-02 0.6924E-05 0.000509 0.249734  39  36   0   0 1
  0.20 0.00 0.2853E-02 0.5983E-05 0.000662 0.249712  38  39   0   0 1
  0.20 0.20 0.2424E-02 0.4219E-05 0.000889 0.249503  36  33   0   0 1
  0.20 0.40 0.2988E-02 0.4937E-05 0.000900 0.249570  39  39   0   0 1
  0.20 0.60 0.1720E-02 0.5727E-05 0.001465 0.249494  33  39   0   0 1
  0.20 0.80 0.2706E-02 0.3023E-05 0.001347 0.249269  37  35   0   0 1
  0.20 1.00 0.1123E-02 0.3104E-05 0.001392 0.246924  39  18   0   0 1


  0.40-0.80 0.4751E-02 0.3042E-05 0.000406 0.249908  27  38   0   0 1
  0.40-0.60 0.1438E-01 0.8656E-05 0.000303 0.249860  38  38   0   0 1
  0.40-0.40 0.9759E-02 0.6189E-05 0.000386 0.249774  39  35   0   0 1
  0.40-0.20 0.3133E-02 0.2960E-05 0.000489 0.249626  39  31   0   0 1
  0.40 0.00 0.2623E-02 0.3219E-05 0.001084 0.249703  29  39   0   0 1
  0.40 0.20 0.2695E-02 0.5052E-05 0.000821 0.249635  37  39   0   0 1
  0.40 0.40 0.2949E-02 0.3885E-05 0.000923 0.249028  38  26   0   0 1
  0.40 0.60 0.1077E-02 0.6431E-05 0.001086 0.249487  38  39   0   0 1
  0.40 0.80 0.1849E-02 0.4931E-05 0.001254 0.249370  38  38   0   0 1
  0.40 1.00 0.1578E-02 0.3777E-05 0.001370 0.248686  39  28   0   0 1


  0.60-0.80 0.2950E-02 0.4141E-05 0.000394 0.249887  25  37   0   0 1
  0.60-0.60 0.1141E-01 0.7125E-05 0.000331 0.249844  34  38   0   0 1
  0.60-0.40 0.6203E-02 0.3608E-05 0.000405 0.249622  36  28   0   0 1
  0.60-0.20 0.8779E-02 0.5089E-05 0.000460 0.249747  39  39   0   0 1
  0.60 0.00 0.3158E-02 0.2824E-05 0.000634 0.249591  37  34   0   0 1
  0.60 0.20 0.2637E-02 0.4618E-05 0.000705 0.249623  39  39   0   0 1
  0.60 0.40 0.2353E-02 0.4911E-05 0.000886 0.249551  38  39   0   0 1
  0.60 0.60 0.1157E-02 0.4618E-05 0.001104 0.249471  37  39   0   0 1
  0.60 0.80 0.1557E-02 0.3828E-05 0.001219 0.249391  38  39   0   0 1
  0.60 1.00 0.1919E-02 0.3627E-05 0.001550 0.248972  36  32   0   0 1


  0.80-0.80 0.6893E-02 0.7068E-05 0.000302 0.249870  24  38   0   0 1
  0.80-0.60 0.3072E-02 0.4379E-05 0.000449 0.249833  26  39   0   0 1
  0.80-0.40 0.6624E-02 0.5533E-05 0.000319 0.249757  38  37   0   0 1
  0.80-0.20 0.3355E-02 0.3983E-05 0.000537 0.249661  34  35   0   0 1
  0.80 0.00 0.3926E-02 0.2833E-05 0.000525 0.249630  39  37   0   0 1
  0.80 0.20 0.3946E-02 0.2813E-05 0.000730 0.249507  37  35   0   0 1
  0.80 0.40 0.2765E-02 0.5780E-05 0.000840 0.249504  38  38   0   0 1
  0.80 0.60 0.3512E-02 0.4088E-05 0.000992 0.249454  38  39   0   0 1
  0.80 0.80 0.1916E-02 0.6040E-05 0.001230 0.249336  37  38   0   0 1
  0.80 1.00 0.1069E-02 0.5747E-05 0.001768 0.249281  33  39   0   0 1


  1.00-0.80 0.1647E-02 0.3496E-05 0.000365 0.249564  15  23   0   0 1
  1.00-0.60 0.5394E-02 0.5152E-05 0.000340 0.249802  25  39   0   0 1
  1.00-0.40 0.6100E-02 0.6364E-05 0.000315 0.249697  34  35   0   0 1
  1.00-0.20 0.3950E-02 0.4882E-05 0.000483 0.249685  33  38   0   0 1
  1.00 0.00 0.5439E-02 0.5215E-05 0.000466 0.249641  39  39   0   0 1
  1.00 0.20 0.2024E-02 0.3421E-05 0.000738 0.248076  35  18   0   0 1
  1.00 0.40 0.2651E-02 0.3629E-05 0.000911 0.249479  35  38   0   0 1
  1.00 0.60 0.2634E-02 0.3307E-05 0.000884 0.249158  39  32   0   0 1
  1.00 0.80 0.1590E-02 0.4182E-05 0.001367 0.249344  34  39   0   0 1
  1.00 1.00 0.1452E-02 0.4403E-05 0.001351 0.249221  37  38   0   0 1



 y =   8.00

  alj  bej     erra       errb      alpha    beta    ka  kb ierr ie it

 -0.80-0.80 0.5595E-02 0.8702E-05 0.000459 0.249861  21  38   0   0 1
 -0.80-0.60 0.7881E-02 0.5389E-05 0.000349 0.249823  31  39   0   0 1
 -0.80-0.40 0.7451E-02 0.7866E-05 0.000331 0.249769  38  39   0   0 1
 -0.80-0.20 0.4311E-02 0.3590E-05 0.000448 0.249481  38  29   0   0 1
 -0.80 0.00 0.8024E-02 0.3778E-05 0.000554 0.249270  39  27   0   0 1
 -0.80 0.20 0.1769E-02 0.5266E-05 0.001318 0.249539  28  37   0   0 1
 -0.80 0.40 0.3759E-02 0.3172E-05 0.000826 0.249483  39  38   0   0 1
 -0.80 0.60 0.2815E-02 0.3991E-05 0.000983 0.249401  39  38   0   0 1
 -0.80 0.80 0.3135E-02 0.7414E-05 0.001218 0.249311  38  38   0   0 1
 -0.80 1.00 0.9971E-03 0.3244E-05 0.001332 0.247863  39  23   0   0 1


 -0.60-0.80 0.1846E-02 0.5646E-05 0.000299 0.249892  30  39   0   0 1
 -0.60-0.60 0.4624E-02 0.6554E-05 0.000325 0.249783  35  33   0   0 1
 -0.60-0.40 0.5326E-02 0.5182E-05 0.000382 0.249797  38  39   0   0 1
 -0.60-0.20 0.3321E-02 0.4392E-05 0.000472 0.249557  39  30   0   0 1
 -0.60 0.00 0.1429E-02 0.6612E-05 0.000591 0.249662  39  38   0   0 1
 -0.60 0.20 0.3632E-02 0.6066E-05 0.000853 0.249543  36  36   0   0 1
 -0.60 0.40 0.4338E-02 0.8344E-05 0.000912 0.249509  38  38   0   0 1
 -0.60 0.60 0.2626E-02 0.6487E-05 0.001341 0.249426  34  38   0   0 1
 -0.60 0.80 0.1447E-02 0.4351E-05 0.001194 0.249372  39  39   0   0 1
 -0.60 1.00 0.7616E-02 0.1122E-04 0.001360 0.249244  39  38   0   0 1


 -0.40-0.80 0.5842E-02 0.8249E-05 0.000331 0.249907  31  39   0   0 1
 -0.40-0.60 0.8438E-02 0.5196E-05 0.000307 0.249866  38  39   0   0 1
 -0.40-0.40 0.4913E-02 0.3522E-05 0.000411 0.249805  38  38   0   0 1
 -0.40-0.20 0.5467E-02 0.3606E-05 0.000530 0.249615  38  31   0   0 1
 -0.40 0.00 0.3061E-02 0.4221E-05 0.000652 0.249486  38  30   0   0 1
 -0.40 0.20 0.2681E-02 0.3745E-05 0.000791 0.249222  38  27   0   0 1
 -0.40 0.40 0.4439E-02 0.4525E-05 0.000893 0.249446  39  35   0   0 1
 -0.40 0.60 0.1528E-02 0.3413E-05 0.001555 0.249114  32  30   0   0 1
 -0.40 0.80 0.2257E-02 0.5105E-05 0.001279 0.249322  38  37   0   0 1
 -0.40 1.00 0.1391E-02 0.6490E-05 0.001466 0.249134  38  35   0   0 1


 -0.20-0.80 0.2727E-02 0.3289E-05 0.000315 0.249886  33  33   0   0 1
 -0.20-0.60 0.4082E-02 0.4391E-05 0.000311 0.249787  39  30   0   0 1
 -0.20-0.40 0.8201E-02 0.3764E-05 0.000427 0.249722  38  31   0   0 1
 -0.20-0.20 0.4506E-02 0.4016E-05 0.000577 0.249478  37  26   0   0 1
 -0.20 0.00 0.4346E-02 0.3380E-05 0.000744 0.249616  36  34   0   0 1
 -0.20 0.20 0.5101E-02 0.5861E-05 0.000773 0.249579  39  36   0   0 1
 -0.20 0.40 0.1544E-02 0.3748E-05 0.000913 0.249315  39  31   0   0 1
 -0.20 0.60 0.4132E-02 0.4516E-05 0.001062 0.249487  39  39   0   0 1
 -0.20 0.80 0.1794E-02 0.3988E-05 0.001363 0.249404  37  39   0   0 1
 -0.20 1.00 0.1990E-02 0.7627E-05 0.001404 0.249278  39  38   0   0 1


  0.00-0.80 0.5754E-02 0.3970E-05 0.000345 0.249840  32  27   0   0 1
  0.00-0.60 0.2499E-02 0.6776E-05 0.000350 0.249875  37  38   0   0 1
  0.00-0.40 0.5587E-02 0.3939E-05 0.000438 0.249787  38  35   0   0 1
  0.00-0.20 0.3074E-02 0.3945E-05 0.000613 0.249734  36  36   0   0 1
  0.00 0.00 0.2404E-02 0.5325E-05 0.000749 0.249479  36  29   0   0 1
  0.00 0.20 0.2475E-02 0.4775E-05 0.000814 0.249646  38  39   0   0 1
  0.00 0.40 0.1892E-02 0.3418E-05 0.001636 0.249367  29  32   0   0 1
  0.00 0.60 0.1368E-02 0.2478E-05 0.001121 0.249437  38  37   0   0 1
  0.00 0.80 0.1219E-02 0.2986E-05 0.001294 0.249344  38  37   0   0 1
  0.00 1.00 0.1689E-02 0.6109E-05 0.001409 0.249321  39  39   0   0 1


  0.20-0.80 0.4389E-02 0.5036E-05 0.000403 0.249913  29  37   0   0 1
  0.20-0.60 0.5695E-02 0.5736E-05 0.000359 0.249857  36  36   0   0 1
  0.20-0.40 0.5526E-02 0.3795E-05 0.000428 0.249786  38  35   0   0 1
  0.20-0.20 0.8318E-02 0.6986E-05 0.000508 0.249734  39  36   0   0 1
  0.20 0.00 0.3396E-02 0.5653E-05 0.000662 0.249712  38  39   0   0 1
  0.20 0.20 0.3312E-02 0.4447E-05 0.000764 0.249502  39  33   0   0 1
  0.20 0.40 0.2414E-02 0.5119E-05 0.000901 0.249570  39  39   0   0 1
  0.20 0.60 0.1780E-02 0.5570E-05 0.001465 0.249494  33  39   0   0 1
  0.20 0.80 0.3083E-02 0.3517E-05 0.001346 0.249269  37  35   0   0 1
  0.20 1.00 0.1358E-02 0.3310E-05 0.001463 0.248997  38  32   0   0 1


  0.40-0.80 0.5530E-02 0.3069E-05 0.000416 0.249906  27  38   0   0 1
  0.40-0.60 0.1095E-01 0.8954E-05 0.000305 0.249858  38  38   0   0 1
  0.40-0.40 0.1113E-01 0.5393E-05 0.000388 0.249773  39  35   0   0 1
  0.40-0.20 0.3221E-02 0.3483E-05 0.000546 0.249650  37  32   0   0 1
  0.40 0.00 0.2390E-02 0.2888E-05 0.000677 0.249703  37  39   0   0 1
  0.40 0.20 0.2872E-02 0.5653E-05 0.000821 0.249635  37  39   0   0 1
  0.40 0.40 0.2477E-02 0.4253E-05 0.000923 0.249028  38  26   0   0 1
  0.40 0.60 0.1949E-02 0.6339E-05 0.001087 0.249487  38  39   0   0 1
  0.40 0.80 0.1971E-02 0.5516E-05 0.001254 0.249370  38  38   0   0 1
  0.40 1.00 0.1596E-02 0.4147E-05 0.001684 0.249315  35  39   0   0 1


  0.60-0.80 0.4292E-02 0.3980E-05 0.000407 0.249884  25  37   0   0 1
  0.60-0.60 0.9946E-02 0.6715E-05 0.000335 0.249842  34  38   0   0 1
  0.60-0.40 0.4893E-02 0.3755E-05 0.000407 0.249620  36  28   0   0 1
  0.60-0.20 0.8635E-02 0.5107E-05 0.000460 0.249747  39  39   0   0 1
  0.60 0.00 0.3356E-02 0.3127E-05 0.000635 0.249537  37  32   0   0 1
  0.60 0.20 0.3655E-02 0.4640E-05 0.000706 0.249623  39  39   0   0 1
  0.60 0.40 0.2587E-02 0.5350E-05 0.000885 0.249551  38  39   0   0 1
  0.60 0.60 0.1179E-02 0.4646E-05 0.001226 0.249471  35  39   0   0 1
  0.60 0.80 0.2108E-02 0.3781E-05 0.001220 0.249391  38  39   0   0 1
  0.60 1.00 0.1886E-02 0.3644E-05 0.001396 0.248972  38  32   0   0 1


  0.80-0.80 0.5217E-02 0.6768E-05 0.000316 0.249868  24  38   0   0 1
  0.80-0.60 0.3612E-02 0.4446E-05 0.000582 0.249831  23  39   0   0 1
  0.80-0.40 0.5557E-02 0.5376E-05 0.000377 0.249756  35  37   0   0 1
  0.80-0.20 0.5378E-02 0.3993E-05 0.000457 0.249711  37  38   0   0 1
  0.80 0.00 0.2458E-02 0.2739E-05 0.000526 0.249630  39  37   0   0 1
  0.80 0.20 0.4672E-02 0.2879E-05 0.000731 0.249507  37  35   0   0 1
  0.80 0.40 0.2782E-02 0.5795E-05 0.000840 0.249504  38  38   0   0 1
  0.80 0.60 0.3161E-02 0.4006E-05 0.000993 0.249454  38  39   0   0 1
  0.80 0.80 0.2006E-02 0.6082E-05 0.001230 0.249336  37  38   0   0 1
  0.80 1.00 0.1307E-02 0.5502E-05 0.001769 0.249281  33  39   0   0 1


  1.00-0.80 0.2026E-02 0.3289E-05 0.000407 0.249555  15  23   0   0 1
  1.00-0.60 0.4169E-02 0.4882E-05 0.000351 0.249800  25  39   0   0 1
  1.00-0.40 0.5289E-02 0.6067E-05 0.000318 0.249696  34  35   0   0 1
  1.00-0.20 0.3964E-02 0.4816E-05 0.000484 0.249685  33  38   0   0 1
  1.00 0.00 0.7829E-02 0.5951E-05 0.000465 0.249641  39  39   0   0 1
  1.00 0.20 0.1637E-02 0.3813E-05 0.000738 0.248074  35  18   0   0 1
  1.00 0.40 0.2486E-02 0.3508E-05 0.000735 0.249479  39  38   0   0 1
  1.00 0.60 0.3181E-02 0.3126E-05 0.000884 0.249158  39  32   0   0 1
  1.00 0.80 0.1703E-02 0.4523E-05 0.001367 0.249344  34  39   0   0 1
  1.00 1.00 0.1535E-02 0.4591E-05 0.001352 0.249221  37  38   0   0 1



C-END-OF-FILE

cat <<C-END-OF-FILE > test6.f
c
c
      program test6
c
c
      external qlag,dqlag
      dimension a(100),b(100),e(100),xp(1),yp(1),endl(1),endr(1),
     *xfer(1),wfer(1),alpha(40),beta(40),be(40),x(100),w(100),
     *xm(200),wm(200),p0(200),p1(200),p2(200)
      double precision d1mach,da(300),db(300),de(300),depsma,dxp(1),
     *dyp(1),dendl(1),dendr(1),dxfer(1),dwfer(1),dalpha(40),dbeta(40),
     *dbe(40),dx(300),dw(300),dxm(600),dwm(600),dp0(600),dp1(600),
     *dp2(600),deps
      logical finl,finr,finld,finrd
      common/s/a,b,e,epsma
      common/d/da,db,de,depsma
c
c This test generates in single and double precision the first 40
c recursion coefficients of the orthogonal polynomials belonging to
c the logistic density function
c
c              exp(-x)/((1+exp(-x))**2)  on (-oo, oo).
c
c It prints the double-precision beta-coefficients (the alpha's being
c all zero) along with the absolute and relative errors of the alpha-
c coefficients resp. beta-coefficients.
c
      write(*,1)
    1 format(/)
c
c epsma and depsma are the machine single and double precision.
c
      iq=1
      idelta=1
      irout=1
      epsma=r1mach(3)
      depsma=d1mach(3)
      n=40
      mc=2
      mp=0
      ncapm=100
      ncapmm=mc*ncapm+mp
      ncpmd=300
      ncpmmd=mc*ncpmd+mp
      eps=5000.*epsma
      deps=1000.*depsma
c
c Compute the desired coefficients. On machines with limited exponent
c range, some of the weights in the Gauss-Laguerre quadrature rule may
c underflow. 
c
      call mcdis(n,ncapm,mc,mp,xp,yp,qlag,eps,iq,idelta,irout,finl,
     *  finr,endl,endr,xfer,wfer,alpha,beta,ncap,kount,ierr,ie,be,x,w,
     *  xm,wm,p0,p1,p2)
      call dmcdis(n,ncpmd,mc,mp,dxp,dyp,dqlag,deps,iq,idelta,irout,
     *  finld,finrd,dendl,dendr,dxfer,dwfer,dalpha,dbeta,ncapd,kountd,
     *  ierrd,ied,dbe,dx,dw,dxm,dwm,dp0,dp1,dp2)
      write(*,2) ncap,kount,ierr,ie
    2 format(/1x,'ncap = ',i3,' kount = ',i2,' ierr = ',i3,' ie = ',i5)
      write(*,3) ncapd,kountd,ierrd,ied
    3 format(1x,'ncapd= ',i3,' kountd= ',i2,' ierrd= ',i3,' ied= ',i5/) 
c
c Print the results.
c
      write(*,4)
    4 format(/5x,'k',8x,'dbeta(k)',13x,'erra',8x,'errb'/)
      do 10 k=1,n
        km1=k-1
        erra=abs(alpha(k))
        errb=abs(sngl((dble(beta(k))-dbeta(k))/dbeta(k)))
        if(ied.eq.0 .or. km1.lt.ied) then
          if(ie.eq.0 .or. km1.lt.ie) then
            write(*,5) km1,dbeta(k),erra,errb
    5       format(1x,i5,d24.16,2e12.4)
          else
            write(*,6) km1,dbeta(k)
    6       format(1x,i5,d24.16)
          end if
        end if
   10 continue
      stop
      end 

      subroutine qlag(n,x,w,i,ierr)
      dimension x(n),w(n),a(100),b(100),e(100)
      common/s/a,b,e,epsma
      call recur(n,7,0.,0.,a,b,ierr)
      call gauss(n,a,b,epsma,x,w,ierr,e)
      do 10 k=1,n
        w(k)=w(k)/((1.+exp(-x(k)))**2)
        if(i.eq.1) x(k)=-x(k)
   10 continue
      return
      end  

      subroutine dqlag(n,dx,dw,i,ierr)
      double precision dx(n),dw(n),da(300),db(300),de(300),depsma
      common/d/da,db,de,depsma
      call drecur(n,7,0.d0,0.d0,da,db,ierr)
      call dgauss(n,da,db,depsma,dx,dw,ierr,de)
      do 10 k=1,n
        dw(k)=dw(k)/((1.d0+dexp(-dx(k)))**2)
        if(i.eq.1) dx(k)=-dx(k)
   10 continue
      return
      end

      function wf(x,i)
c
c This is a dummy function. It is never called, since the routine
c qgp  in  mcdis  which requires  wf  is not activated in this test.
c
      wf=0.
      return
      end

      double precision function dwf(dx,i)
      double precision dx
c
c This is a dummy function. It is never called, since the routine
c dqgp  in  dmcdis  which requires  dwf  is not activated in this test.
c
      dwf=0.d0
      return
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > test6.out


output of test6, using sti in mcdis:


 ncap =  81 kount =  1 ierr =   0 ie =    18
 ncapd=  81 kountd=  1 ierrd=   0 ied=     0


     k        dbeta(k)             erra        errb

     0  0.9999999999999976D+00  0.1543E-07  0.1192E-06
     1  0.3289868133696454D+01  0.1908E-06  0.2227E-06
     2  0.1052757802782865D+02  0.4237E-06  0.3027E-06
     3  0.2284108447109253D+02  0.1968E-06  0.7102E-06
     4  0.4010505915363288D+02  0.1219E-05  0.5962E-07
     5  0.6230810859273588D+02  0.1997E-05  0.7458E-06
     6  0.8944760352315951D+02  0.1293E-05  0.1937E-05
     7  0.1215226675231568D+03  0.4247E-05  0.5602E-06
     8  0.1585329397131847D+03  0.2533E-05  0.3141E-06
     9  0.2004782491503015D+03  0.1650E-05  0.5681E-06
    10  0.2473585062929672D+03  0.7026E-06  0.1192E-06
    11  0.2991736605307440D+03  0.2828E-05  0.3579E-06
    12  0.3559236814973709D+03  0.3605E-05  0.5834E-06
    13  0.4176085500733528D+03  0.6623E-05  0.2215E-06
    14  0.4842282537321177D+03  0.1465E-04  0.1035E-05
    15  0.5557827839879309D+03  0.1682E-04  0.1459E-07
    16  0.6322721349264831D+03  0.9747E-05  0.9983E-06
    17  0.7136963023232787D+03  0.1353E-04  0.3235E-06
    18  0.8000552830955646D+03
    19  0.8913490749510479D+03
    20  0.9875776761565355D+03
    21  0.1088741085381883D+04
    22  0.1194839301592559D+04
    23  0.1305872323974114D+04
    24  0.1421840151878338D+04
    25  0.1542742784784127D+04
    26  0.1668580222268672D+04
    27  0.1799352463986049D+04
    28  0.1935059509651033D+04
    29  0.2075701359026737D+04
    30  0.2221278011915082D+04
    31  0.2371789468149471D+04
    32  0.2527235727588941D+04
    33  0.2687616790113491D+04
    34  0.2852932655620603D+04
    35  0.3023183324022218D+04
    36  0.3198368795242142D+04
    37  0.3378489069214600D+04
    38  0.3563544145882250D+04
    39  0.3753534025194910D+04


C-END-OF-FILE

cat <<C-END-OF-FILE > test7.f
c
c
      program test7
c
c
      external quad,dquad
      dimension endl(4),endr(4),xp(1),yp(1),xfer(100),wfer(100),
     *alpha(40),beta(40),be(40),x(100),w(100),xm(400),wm(400),p0(400),
     *p1(400),p2(400)
      double precision d1mach,depsma,dendl(4),dendr(4),dxp(1),dyp(1),
     *dxfer(250),dwfer(250),dalpha(40),dbeta(40),dbe(40),dx(250),
     *dw(250),dxm(1000),dwm(1000),dp0(1000),dp1(1000),dp2(1000),di,deps
      logical finl,finr,finld,finrd
c
c This test generates in single and double precision the first 40
c recurrence coefficients of the orthogonal polynomials for the half-
c range Hermite weight function
c
c                   exp(-x**2)  on  (0,oo).
c
c Printed are the double-precision values of the alpha- and beta-
c coefficients along with the respective relative errors of the single-
c precision values.
c
      finl=.true.
      finr=.false.
      finld=.true.
      finrd=.false.
      epsma=r1mach(3)
      depsma=d1mach(3)
c
c epsma and depsma are the machine single and double precision.
c
      iq=2
      idelta=1
      irout=1
      n=40
      mc=4
      mcd=4
      mp=0
      ncapm=100
      ncpmd=250
c
c Set up the partition for the discretization of the inner product.
c
      do 10 i=1,4
        fi=real(i)
        di=dble(fi)
        endl(i)=3.*(fi-1.)
        endr(i)=3.*fi
        dendl(i)=3.d0*(di-1.d0)
        dendr(i)=3.d0*di
   10 continue
      eps=50.*epsma
      deps=1000.*depsma
c
c Compute the desired recursion coefficients by the multiple-component
c discretization procedure. On the third and fourth subinterval of the
c partition, the quadrature weights produced by  qgp  resp.  dqgp  may
c underflow, on the fourth subinterval even on machines with large
c exponent range.
c
      call mcdis(n,ncapm,mc,mp,xp,yp,quad,eps,iq,idelta,irout,finl,
     *  finr,endl,endr,xfer,wfer,alpha,beta,ncap,kount,ierr,ie,be,x,w,
     *  xm,wm,p0,p1,p2)
      call dmcdis(n,ncpmd,mcd,mp,dxp,dyp,dquad,deps,iq,idelta,irout,
     *  finld,finrd,dendl,dendr,dxfer,dwfer,dalpha,dbeta,ncapd,kountd,
     *  ierrd,ied,dbe,dx,dw,dxm,dwm,dp0,dp1,dp2)
      write(*,1) ncap,kount,ierr,ie
    1 format(/1x,'ncap = ',i3,' kount = ',i2,' ierr = ',i3,' ie = ',i3)
      write(*,2) ncapd,kountd,ierrd,ied
    2 format(1x,'ncapd =',i3,' kountd =',i2,' ierrd =',i3,' ied =',i3/)
c
c Print the results.
c
      write(*,3)
    3 format(/5x,'k',9x,'dalpha(k)',15x,'dbeta(k)')
      write(*,4)
    4 format(10x,'erra',20x,'errb')
      do 20 k=1,n
        km1=k-1
        erra=abs(sngl((dble(alpha(k))-dalpha(k))/dalpha(k)))
        errb=abs(sngl((dble(beta(k))-dbeta(k))/dbeta(k)))
        write(*,5) km1,dalpha(k),dbeta(k)
    5   format(1x,i5,2d24.16)
        write(*,6) erra,errb
    6   format(6x,e12.4,12x,e12.4)
   20 continue
      stop
      end 

      subroutine quad(n,x,w,i,ierr)
      dimension x(n),w(n)
      print *,' User has selected the wrong SP-quadrature routine.'
      stop
      end

      subroutine dquad(n,dx,dw,i,ierr)
      double precision dx(n),dw(n)
      print *,' User has selected the wrong DP-quadrature routine.'
      stop
      end

      function wf(x,i)
      wf=exp(-x*x)
      return
      end

      double precision function dwf(dx,i)
      double precision dx
      dwf=dexp(-dx*dx)
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test7.out


output of test7:


 ncap = 121 kount =  2 ierr = 100 ie =   0
 ncapd = 81 kountd = 1 ierrd =  0 ied =  0


     k         dalpha(k)               dbeta(k)
          erra                    errb
     0  0.5641895835477558D+00  0.8862269254527578D+00
        0.5196E-07              0.9730E-07
     1  0.9884253928468024D+00  0.1816901138162091D+00
        0.2222E-06              0.4214E-06
     2  0.1285967619363937D+01  0.3413251289594394D+00
        0.4876E-06              0.4514E-06
     3  0.1524720844080119D+01  0.5049621529880013D+00
        0.2760E-06              0.1313E-06
     4  0.1730192274309435D+01  0.6702641946396192D+00
        0.5194E-07              0.1041E-06
     5  0.1913499843143109D+01  0.8361704992803103D+00
        0.3172E-06              0.6563E-07
     6  0.2080620336400828D+01  0.1002347851011012D+01
        0.9174E-07              0.2400E-07
     7  0.2235228380504643D+01  0.1168671164744273D+01
        0.6040E-06              0.4368E-06
     8  0.2379782443504634D+01  0.1335082922242336D+01
        0.1104E-05              0.5105E-06
     9  0.2516025643443868D+01  0.1501552599344763D+01
        0.1097E-05              0.3059E-06
    10  0.2645247925056952D+01  0.1668062362188114D+01
        0.1077E-05              0.4485E-06
    11  0.2768435953504259D+01  0.1834601052793767D+01
        0.5173E-06              0.4504E-06
    12  0.2886364594032689D+01  0.2001161318551214D+01
        0.2840E-06              0.2291E-06
    13  0.2999655653353608D+01  0.2167738111763265D+01
        0.2150E-06              0.6963E-07
    14  0.3108817175924916D+01  0.2334327849540504D+01
        0.2425E-07              0.2414E-06
    15  0.3214270636071134D+01  0.2500927917133699D+01
        0.3105E-06              0.3845E-06
    16  0.3316370297083082D+01  0.2667536360957202D+01
        0.2302E-06              0.5104E-07
    17  0.3415417332413347D+01  0.2834151691667836D+01
        0.7275E-06              0.1029E-06
    18  0.3511670344615623D+01  0.3000772753782714D+01
        0.6771E-06              0.1720E-06
    19  0.3605353345905573D+01  0.3167398636964428D+01
        0.7962E-06              0.3592E-06
    20  0.3696661911504583D+01  0.3334028614203111D+01
        0.5058E-06              0.1110E-06
    21  0.3785767992700229D+01  0.3500662097828115D+01
        0.4304E-06              0.2695E-08
    22  0.3872823730185229D+01  0.3667298607618390D+01
        0.1227E-05              0.2458E-06
    23  0.3957964510422987D+01  0.3833937747295836D+01
        0.1408E-05              0.2133E-06
    24  0.4041311441034400D+01  0.4000579186936197D+01
        0.1136E-05              0.4255E-07
    25  0.4122973374779623D+01  0.4167222649628333D+01
        0.4463E-06              0.1504E-06
    26  0.4203048578872008D+01  0.4333867901229953D+01
        0.2572E-06              0.2490E-06
    27  0.4281626122768196D+01  0.4500514742412094D+01
        0.6444E-06              0.2656E-06
    28  0.4358787040389895D+01  0.4667163002416826D+01
        0.2143E-06              0.2273E-06
    29  0.4434605310041301D+01  0.4833812534112320D+01
        0.1118E-05              0.1344E-05
    30  0.4509148685807786D+01  0.5000463210041209D+01
        0.6259E-05              0.5476E-05
    31  0.4582479407059634D+01  0.5167114919236642D+01
        0.2204E-04              0.2329E-04
    32  0.4654654807220990D+01  0.5333767564637805D+01
        0.7823E-04              0.8523E-04
    33  0.4725727838755018D+01  0.5500421060976677D+01
        0.2437E-03              0.2788E-03
    34  0.4795747528043545D+01  0.5667075333039156D+01
        0.6861E-03              0.8286E-03
    35  0.4864759371276866D+01  0.5833730314225066D+01
        0.1723E-02              0.2203E-02
    36  0.4932805680443487D+01  0.6000385945348893D+01
        0.3868E-02              0.5230E-02
    37  0.4999925886899696D+01  0.6167042173635500D+01
        0.7721E-02              0.1105E-01
    38  0.5066156808707952D+01  0.6333698951874868D+01
        0.1377E-01              0.2079E-01
    39  0.5131532886894296D+01  0.6500356237707132D+01
        0.2207E-01              0.3498E-01


C-END-OF-FILE

cat <<C-END-OF-FILE > test8.f
c
c
      program test8
c
c
      external qcheb
      dimension oom2(7),xp(1),yp(1),endl(1),endr(1),xfer(1),wfer(1),
     *a(79),b(79),fnu(80),alpha(40),beta(40),be(40),x(500),w(500),
     *xm(500),wm(500),s(40),s0(80),s1(80),s2(80)
      logical finl,finr
      common/s/om2
      data oom2/.1,.3,.5,.7,.9,.99,.999/
c
c This test reproduces the results of  test1  in single precision,
c for n=40, using the routine  mccheb  in place of  cheb  and 
c Gauss-Chebyshev quadrature to discretize the modified moments.
c
      write(*,1)
    1 format(/)
      epsma=r1mach(3)
c
c epsma is the machine single precision.
c
      iq=1
      idelta=1
      n=40
      ndm1=2*n-1
      mc=1
      mp=0
      ncapm=500
      eps=100.*epsma
c
c Generate the recurrence coefficients for the (Chebyshev) polynomials
c defining the modified moments.
c
      call recur(ndm1,3,0.,0.,a,b,ierr)
c
c Compute the desired recursion coefficients by the discretized
c Chebyshev algorithm.
c
      do 20 iom=1,7
        om2=oom2(iom)
        call mccheb(n,ncapm,mc,mp,xp,yp,qcheb,eps,iq,idelta,finl,finr,
     *    endl,endr,xfer,wfer,a,b,fnu,alpha,beta,ncap,kount,ierr,be,x,
     *    w,xm,wm,s,s0,s1,s2)
c
c On machines with limited single-precision exponent range, the routine
c cheb  may have generated an underflow exception, which however is
c harmless and can be ignored.
c
        write(*,2) ncap,kount,ierr
    2   format(/'ncap=',i3,'  kount=',i3,'  ierr=',i3/)
c
c Print the results.
c
        write(*,3)
    3   format(5x,'k',4x,'beta(k)'/)
        do 10 k=1,n
          km1=k-1
          if(k.eq.1) then
            write(*,4) km1,beta(k),om2
    4       format(1x,i5,e14.6,'   om2 =',f6.3)
          else
            write(*,5) km1,beta(k)
    5     format(1x,i5,e14.6)
          end if
   10   continue
        write(*,1)
   20 continue      
      stop
      end

      subroutine qcheb(n,x,w,i,ierr)
      dimension x(n),w(n) 
      common/s/om2
      fn=real(n)
      pi=4.*atan(1.)
      do 10 k=1,n
        fk=real(k)
        x(k)=cos((2.*fk-1.)*pi/(2.*fn))
        w(k)=pi/(fn*sqrt(1.-om2*x(k)**2))
   10 continue
      return
      end

      function wf(x,i)
c
c This is a dummy function. It is never called, since the routine
c qgp  in  mccheb  which requires  wf  is not activated in this test.
c
      wf=0.
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test8.out


output of test8: 


ncap= 81  kount=  1  ierr=  0

     k    beta(k)

     0  0.322488E+01   om2 = 0.100
     1  0.506584E+00
     2  0.246729E+00
     3  0.249979E+00
     4  0.250000E+00
     5  0.250000E+00
     6  0.250000E+00
     7  0.250000E+00
     8  0.250000E+00
     9  0.250000E+00
    10  0.250000E+00
    11  0.250000E+00
    12  0.250000E+00
    13  0.250000E+00
    14  0.250000E+00
    15  0.250000E+00
    16  0.250000E+00
    17  0.250000E+00
    18  0.250000E+00
    19  0.250000E+00
    20  0.250000E+00
    21  0.250000E+00
    22  0.250000E+00
    23  0.250000E+00
    24  0.250000E+00
    25  0.250000E+00
    26  0.250000E+00
    27  0.250000E+00
    28  0.250000E+00
    29  0.250000E+00
    30  0.250000E+00
    31  0.250000E+00
    32  0.250000E+00
    33  0.250000E+00
    34  0.250000E+00
    35  0.250000E+00
    36  0.250000E+00
    37  0.250000E+00
    38  0.250000E+00
    39  0.250000E+00



ncap= 81  kount=  1  ierr=  0

     k    beta(k)

     0  0.342778E+01   om2 = 0.300
     1  0.522255E+00
     2  0.239109E+00
     3  0.249763E+00
     4  0.249990E+00
     5  0.249999E+00
     6  0.250000E+00
     7  0.250000E+00
     8  0.250000E+00
     9  0.250000E+00
    10  0.250000E+00
    11  0.250000E+00
    12  0.250000E+00
    13  0.250000E+00
    14  0.250000E+00
    15  0.250000E+00
    16  0.250000E+00
    17  0.250000E+00
    18  0.250000E+00
    19  0.250000E+00
    20  0.250000E+00
    21  0.250000E+00
    22  0.250000E+00
    23  0.250000E+00
    24  0.250000E+00
    25  0.250000E+00
    26  0.250000E+00
    27  0.250000E+00
    28  0.250000E+00
    29  0.250000E+00
    30  0.250000E+00
    31  0.250000E+00
    32  0.250000E+00
    33  0.250000E+00
    34  0.250000E+00
    35  0.250000E+00
    36  0.250000E+00
    37  0.250000E+00
    38  0.250000E+00
    39  0.250000E+00



ncap= 81  kount=  1  ierr=  0

     k    beta(k)

     0  0.370815E+01   om2 = 0.500
     1  0.543053E+00
     2  0.229320E+00
     3  0.249153E+00
     4  0.249929E+00
     5  0.249992E+00
     6  0.249999E+00
     7  0.250000E+00
     8  0.250000E+00
     9  0.250000E+00
    10  0.250000E+00
    11  0.250000E+00
    12  0.250000E+00
    13  0.250000E+00
    14  0.250000E+00
    15  0.250000E+00
    16  0.250000E+00
    17  0.250000E+00
    18  0.250000E+00
    19  0.250000E+00
    20  0.250000E+00
    21  0.250000E+00
    22  0.250000E+00
    23  0.250000E+00
    24  0.250000E+00
    25  0.250000E+00
    26  0.250000E+00
    27  0.250000E+00
    28  0.250000E+00
    29  0.250000E+00
    30  0.250000E+00
    31  0.250000E+00
    32  0.250000E+00
    33  0.250000E+00
    34  0.250000E+00
    35  0.250000E+00
    36  0.250000E+00
    37  0.250000E+00
    38  0.250000E+00
    39  0.250000E+00



ncap= 81  kount=  1  ierr=  0

     k    beta(k)

     0  0.415073E+01   om2 = 0.700
     1  0.573870E+00
     2  0.215390E+00
     3  0.247669E+00
     4  0.249673E+00
     5  0.249942E+00
     6  0.249988E+00
     7  0.249997E+00
     8  0.249999E+00
     9  0.250000E+00
    10  0.250000E+00
    11  0.250000E+00
    12  0.250000E+00
    13  0.250000E+00
    14  0.250000E+00
    15  0.250000E+00
    16  0.250000E+00
    17  0.250000E+00
    18  0.250000E+00
    19  0.250000E+00
    20  0.250000E+00
    21  0.250000E+00
    22  0.250000E+00
    23  0.250000E+00
    24  0.250000E+00
    25  0.250000E+00
    26  0.250000E+00
    27  0.250000E+00
    28  0.250000E+00
    29  0.250000E+00
    30  0.250000E+00
    31  0.250000E+00
    32  0.250000E+00
    33  0.250000E+00
    34  0.250000E+00
    35  0.250000E+00
    36  0.250000E+00
    37  0.250000E+00
    38  0.250000E+00
    39  0.250000E+00



ncap= 81  kount=  1  ierr=  0

     k    beta(k)

     0  0.515618E+01   om2 = 0.900
     1  0.634973E+00
     2  0.189149E+00
     3  0.243230E+00
     4  0.248376E+00
     5  0.249498E+00
     6  0.249824E+00
     7  0.249933E+00
     8  0.249973E+00
     9  0.249989E+00
    10  0.249995E+00
    11  0.249998E+00
    12  0.249999E+00
    13  0.250000E+00
    14  0.250000E+00
    15  0.250000E+00
    16  0.250000E+00
    17  0.250000E+00
    18  0.250000E+00
    19  0.250000E+00
    20  0.250000E+00
    21  0.250000E+00
    22  0.250000E+00
    23  0.250000E+00
    24  0.250000E+00
    25  0.250000E+00
    26  0.250000E+00
    27  0.250000E+00
    28  0.250000E+00
    29  0.250000E+00
    30  0.250000E+00
    31  0.250000E+00
    32  0.250000E+00
    33  0.250000E+00
    34  0.250000E+00
    35  0.250000E+00
    36  0.250000E+00
    37  0.250000E+00
    38  0.250000E+00
    39  0.250000E+00



ncap= 81  kount=  1  ierr=  0

     k    beta(k)

     0  0.739127E+01   om2 = 0.990
     1  0.732407E+00
     2  0.147943E+00
     3  0.233856E+00
     4  0.244342E+00
     5  0.247397E+00
     6  0.248620E+00
     7  0.249202E+00
     8  0.249511E+00
     9  0.249687E+00
    10  0.249793E+00
    11  0.249860E+00
    12  0.249904E+00
    13  0.249932E+00
    14  0.249952E+00
    15  0.249965E+00
    16  0.249975E+00
    17  0.249982E+00
    18  0.249986E+00
    19  0.249990E+00
    20  0.249992E+00
    21  0.249994E+00
    22  0.249996E+00
    23  0.249997E+00
    24  0.249997E+00
    25  0.249998E+00
    26  0.249998E+00
    27  0.249999E+00
    28  0.249999E+00
    29  0.249999E+00
    30  0.249999E+00
    31  0.249999E+00
    32  0.249999E+00
    33  0.250000E+00
    34  0.250000E+00
    35  0.250000E+00
    36  0.249999E+00
    37  0.250000E+00
    38  0.249999E+00
    39  0.249999E+00



ncap=201  kount=  4  ierr=  0

     k    beta(k)

     0  0.968229E+01   om2 = 0.999
     1  0.793783E+00
     2  0.119867E+00
     3  0.227040E+00
     4  0.241061E+00
     5  0.245428E+00
     6  0.247302E+00
     7  0.248259E+00
     8  0.248806E+00
     9  0.249144E+00
    10  0.249365E+00
    11  0.249516E+00
    12  0.249624E+00
    13  0.249702E+00
    14  0.249761E+00
    15  0.249805E+00
    16  0.249840E+00
    17  0.249867E+00
    18  0.249889E+00
    19  0.249906E+00
    20  0.249921E+00
    21  0.249932E+00
    22  0.249942E+00
    23  0.249950E+00
    24  0.249957E+00
    25  0.249963E+00
    26  0.249967E+00
    27  0.249971E+00
    28  0.249975E+00
    29  0.249978E+00
    30  0.249981E+00
    31  0.249983E+00
    32  0.249985E+00
    33  0.249986E+00
    34  0.249988E+00
    35  0.249989E+00
    36  0.249991E+00
    37  0.249992E+00
    38  0.249993E+00
    39  0.249993E+00


C-END-OF-FILE

cat <<C-END-OF-FILE > test9.f
c
c
      program test9
c
c
      dimension a(199),b(199),fnu(200),alpha(100),beta(100),s(100),
     *s0(200),s1(200),s2(200),alphc(100),betc(100)
      double precision dsigma,da(199),db(199),dnu(200),dalpha(100),
     *dbeta(100),ds(100),ds0(200),ds1(200),ds2(200),dalphc(100),
     *dbetc(100)
c
c This test recomputes the results of  test2  for  sigma=.5  by applying
c the routine  chri  with  iopt=1, x=0  to the weight function with
c parameter  sigma=-.5. Printed are the relative discrepancies in both
c single and double precision between these results and those obtained
c in  test 2  by the modified Chebyshev algorithm. The test is embedded
c in the routine  test2, from which all print statements have been
c removed.
c
      logical modmom,intexp
      modmom=.true.
c
c Generate the recursion coefficients for the polynomials defining the
c modified resp. ordinary moments.
c
      if(modmom) then
        n=100
        ndm1=2*n-1
        call recur(ndm1,2,0.,0.,a,b,ierr)
        call drecur(ndm1,2,0.d0,0.d0,da,db,iderr)
      else 
        n=12
        ndm1=2*n-1
        do 10 k=1,ndm1
          a(k)=0.
          b(k)=0.
          da(k)=0.d0
          db(k)=0.d0
   10   continue
      end if
      do 30 is=1,3
        dsigma=-.5d0+.5d0*dble(is-1)
        sigma=sngl(dsigma)
        if(is.eq.2) then
          intexp=.true.
        else
          intexp=.false.
        end if
c
c Compute the modified resp. ordinary moments using Eqs. (3.12) and
c (3.11) of the companion paper. On machines with limited exponent
c range, some of the high-order modified moments may underflow, without
c this having any deteriorating effect on the accuracy.
c
        call fmm(n,modmom,intexp,sigma,fnu)
        call dmm(n,modmom,intexp,dsigma,dnu)
c
c Compute the desired recursion coefficients by means of the modified
c Chebyshev algorithm; for the latter, see, e.g., Section 2.4 of
c W. Gautschi, ``On generating orthogonal polynomials'', SIAM J. Sci.
c Statist. Comput. 3, 1982, 289-317.
c
        call cheb(n,a,b,fnu,alpha,beta,s,ierr,s0,s1,s2)
c
c On machines with limited single-precision exponent range, the routine
c cheb  may generate an underflow exception, which however is harmless
c and can be ignored.
c
        call dcheb(n,da,db,dnu,dalpha,dbeta,ds,iderr,ds0,ds1,ds2)
c
c Up to this point the code is identical with the one of  test2.
c
        if(is.eq.1) then
          write(*,1) ierr,iderr
    1     format(/1x,'ierr in cheb = ',i4,' iderr in dcheb = ',i4/)
          if(ierr.ne.0) then
            nc=abs(ierr)
          else
            nc=n
          end if
          if(iderr.ne.0) then
            ncd=abs(iderr)
          else
            ncd=n
          end if 
c
c Compute the desired recursion coefficients by a modification
c algorithm.
c
          nm1=nc-1
          call chri(nm1,1,alpha,beta,0.,0.,0.,0.,alphc,betc,ierr)
          nm1=ncd-1
          call dchri(nm1,1,dalpha,dbeta,0.d0,0.d0,0.d0,0.d0,dalphc,
     *      dbetc,iderr)
        end if
        if(is.eq.3) then
          write(*,2)
    2     format(/1x,'test of the results for sigma=1/2'/)
          np=nc
          if(ncd.lt.nc) np=ncd
          nm1=np-1
c
c Compute and print the relative discrepancies between the results of
c the modified Chebyshev algorithm and the modification algorithm.
c
          write(*,3)
    3     format(3x,'k',2x,'err alpha',4x,'err beta',12x,'err dalpha',
     *      2x,'err dbeta'/)
          do 15 k=1,nm1
            km1=k-1
            errac=abs(alpha(k)-alphc(k))/alpha(k)
            errbc=abs(beta(k)-betc(k))/beta(k)
            errdac=sngl(dabs(dalpha(k)-dalphc(k))/dalpha(k))
            errdbc=sngl(dabs(dbeta(k)-dbetc(k))/dbetc(k))
            write(*,4) km1,errac,errbc,errdac,errdbc
    4       format(1x,i3,2e12.4,9x,2e12.4)
   15     continue
          write(*,5)
    5     format(/1x,'end of test'/)
        end if
c
c The rest of the code is essentially the same as the corresponding
c piece of code in  test2  with all print statements removed.
c
        eamax=0.
        ebmax=0.
        do 20 k=1,n
          km1=k-1
          erra=sngl(dabs(dble(alpha(k))-dalpha(k))/dalpha(k))
          errb=sngl(dabs(dble(beta(k))-dbeta(k))/dbeta(k))
          if(erra.gt.eamax) then
            eamax=erra
            kamax=km1
          end if
          if(errb.gt.ebmax) then
            ebmax=errb
            kbmax=km1
          end if
   20   continue
   30 continue
      stop
      end

      subroutine fmm(n,modmom,intexp,sigma,fnu)
c
c This generates the first  2*n  modified moments (if modmom=.true.)
c relative to shifted monic Legendre polynomials, using Eq. (3.12) of
c the companion paper, and the first  2*n  ordinary moments (if modmom
c =.false.) by Eq. (3.11), of the weight function
c
c          (x**sigma)*ln(1/x)  on (0,1],   sigma > -1,
c
c for sigma an integer (if intexp=.true.) or a real number (if intexp
c =.false.). In either case, the input variable sigma is of type real.
c
      dimension fnu(*)
      logical modmom,intexp
c
c The array  fnu  is assumed to have dimension  2*n.
c
      nd=2*n
      sigp1=sigma+1.
      if(modmom) then
        isigma=int(sigma)
        isigp1=isigma+1
        isigp2=isigma+2
        isigp3=isigma+3
        if(intexp .and. isigp1.lt.nd) then
          kmax=isigp1
        else
          kmax=nd
        end if
        c=1.
        do 20 k=1,kmax
          km1=k-1
          fk=real(k)
          p=1.
          s=1./sigp1
          if(kmax.gt.1) then
            do 10 i=1,km1
              fi=real(i)
              p=(sigp1-fi)*p/(sigp1+fi)
              s=s+1./(sigp1+fi)-1./(sigp1-fi)
   10       continue
          end if
          fnu(k)=c*s*p/sigp1
          c=fk*c/(4.*fk-2.)
   20   continue
        if(.not.intexp .or. isigp1.ge.nd) return
        q=-.5
        if(isigma.gt.0) then
          do 30 iq=1,isigma
            fiq=real(iq)
            q=fiq*fiq*q/((2.*fiq+1.)*(2.*fiq+2.))
   30     continue
        end if
        fnu(isigp2)=c*q
        if(isigp2.eq.nd) return
        do 40 k=isigp3,nd
          km1=k-1
          fkm1=real(km1)
          fnu(k)=-fkm1*(fkm1-sigp1)*fnu(km1)/((4.*fkm1-2.)*
     *      (fkm1+sigp1))
   40   continue
        return
      else
        do 50 k=1,nd
          fkm1=real(k-1)
          fnu(k)=(1./(sigp1+fkm1))**2
   50   continue
      end if
      end

      subroutine dmm(n,modmom,intexp,dsigma,dnu)
c
c This is a double-precision version of the routine  fmm.
c
      double precision dsigma,dnu(*),dsigp1,dc,dk,dp,ds,di,dq,diq,dkm1
      logical modmom,intexp
c
c The array  dnu  is assumed to have dimension  2*n.
c
      nd=2*n
      dsigp1=dsigma+1.d0
      if(modmom) then
        isigma=idint(dsigma)
        isigp1=isigma+1
        isigp2=isigma+2
        isigp3=isigma+3
        if(intexp .and. isigp1.lt.nd) then
          kmax=isigp1
        else
          kmax=nd
        end if
        dc=1.d0
        do 20 k=1,kmax
          km1=k-1
          dk=dble(k)
          dp=1.d0
          ds=1.d0/dsigp1
          if(kmax.gt.1) then
            do 10 i=1,km1
              di=dble(i)
              dp=(dsigp1-di)*dp/(dsigp1+di)
              ds=ds+1.d0/(dsigp1+di)-1.d0/(dsigp1-di)
   10       continue
          end if
          dnu(k)=dc*ds*dp/dsigp1
          dc=dk*dc/(4.d0*dk-2.d0)
   20   continue
        if(.not.intexp .or. isigp1.ge.nd) return
        dq=-.5d0
        if(isigma.gt.0) then
          do 30 iq=1,isigma
            diq=dble(iq)
            dq=diq*diq*dq/((2.d0*diq+1.d0)*(2.d0*diq+2.d0))
   30     continue
        end if
        dnu(isigp2)=dc*dq
        if(isigp2.eq.nd) return
        do 40 k=isigp3,nd
          km1=k-1
          dkm1=dble(km1)
          dnu(k)=-dkm1*(dkm1-dsigp1)*dnu(km1)/((4.d0*dkm1-2.d0)*
     *      (dkm1+dsigp1))
   40   continue
        return
      else
        do 50 k=1,nd
          dkm1=dble(k-1)
          dnu(k)=(1.d0/(dsigp1+dkm1))**2
   50   continue
      end if
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test9.out


 output of test9 with modmom=.true.:


 ierr in cheb =  -31 iderr in dcheb =    0


 test of the results for sigma=1/2

   k  err alpha    err beta            err dalpha  err dbeta

   0  0.3311E-06  0.3353E-06           0.1234E-14  0.4996E-15
   1  0.3788E-06  0.9645E-06           0.1764E-14  0.3080E-14
   2  0.1832E-06  0.6894E-06           0.2503E-14  0.4086E-14
   3  0.1813E-06  0.6115E-06           0.3489E-14  0.6720E-14
   4  0.6012E-07  0.3632E-06           0.5039E-14  0.7893E-14
   5  0.5996E-07  0.0000E+00           0.6589E-14  0.1156E-13
   6  0.1556E-05  0.1081E-05           0.7582E-14  0.1409E-13
   7  0.2631E-05  0.4556E-05           0.9914E-14  0.1798E-13
   8  0.3227E-05  0.5927E-05           0.1180E-13  0.2163E-13
   9  0.3345E-05  0.6700E-05           0.1402E-13  0.2563E-13
  10  0.3642E-05  0.6875E-05           0.1546E-13  0.2984E-13
  11  0.3880E-05  0.7887E-05           0.1545E-13  0.3194E-13
  12  0.4118E-05  0.7824E-05           0.1523E-13  0.3026E-13
  13  0.4595E-05  0.8598E-05           0.1523E-13  0.3114E-13
  14  0.5966E-05  0.1075E-04           0.1511E-13  0.2958E-13
  15  0.6979E-05  0.1295E-04           0.1589E-13  0.3024E-13
  16  0.8172E-05  0.1546E-04           0.1744E-13  0.3368E-13
  17  0.8171E-05  0.1629E-04           0.1700E-13  0.3434E-13
  18  0.7932E-05  0.1635E-04           0.1677E-13  0.3412E-13
  19  0.7932E-05  0.1575E-04           0.1622E-13  0.3289E-13
  20  0.8468E-05  0.1646E-04           0.1511E-13  0.3167E-13
  21  0.8229E-05  0.1712E-04           0.1544E-13  0.3011E-13
  22  0.8169E-05  0.1634E-04           0.1533E-13  0.3155E-13
  23  0.7930E-05  0.1610E-04           0.1577E-13  0.3033E-13
  24  0.7036E-05  0.1509E-04           0.1633E-13  0.3210E-13
  25  0.7930E-05  0.1491E-04           0.1699E-13  0.3343E-13
  26  0.8705E-05  0.1664E-04           0.1599E-13  0.3377E-13
  27  0.8049E-05  0.1688E-04           0.1521E-13  0.3066E-13
  28  0.7810E-05  0.1598E-04           0.1433E-13  0.2910E-13
  29  0.7691E-05  0.1556E-04           0.1510E-13  0.2921E-13

 end of test

C-END-OF-FILE

cat <<C-END-OF-FILE > test10.f
c
c
      program test10
c
c
      dimension a(31),b(31),alpha(31),beta(31),z(11),w(11),e(11),
     *a1(31),b1(31),betap(20,12),erram(12),errbm(12)
      double precision depsma,d1mach,da(31),db(31),dalpha(31),dbeta(31),
     *dz(11),dw(11),de(11),da1(31),db1(31)
c
c epsma and depsma are the machine single and double precision.
c
      epsma=r1mach(3)
      depsma=d1mach(3)
c
c This test applies the routines  indp  and  dindp  to generate the
c first 20 recursion coefficients of the induced Legendre polynomials
c pind(k,m)(.), m=0,1,2,...,11, that is, of the polynomials orthogonal
c relative to the weight function
c
c                 [p(m)(x)]**2    on [-1,1],
c
c where  p(m)(.)  is the (monic) Legendre polynomial of degree m.
c (When m=0, then  pind(k,0)(.)=p(k)(.).) The routine also prints the
c absolute and relative errors, respectively, of the alpha- and beta-
c coefficients.
c
      n=20
      do 20 im=1,12
        m=im-1
        npm=n+m
c
c Generate the Legendre recurrence coefficients required in the
c routines  indp  and dindp.
c
        call recur(npm,1,0.,0.,a,b,ierr) 
        call drecur(npm,1,0.d0,0.d0,da,db,ierr)
c
c Compute the desired recursion coefficients.
c
        call indp(n,m,a,b,epsma,alpha,beta,ierr,z,w,e,a1,b1)
        call dindp(n,m,da,db,depsma,dalpha,dbeta,ierr,dz,dw,
     *    de,da1,db1)
c
c Compute and print the respective errors.
c
        erram(im)=0.
        errbm(im)=0.
        do 10 k=1,n
          erra=sngl(dabs(dble(alpha(k))-dalpha(k)))
          errb=sngl(dabs((dble(beta(k))-dbeta(k))/dbeta(k)))
          if(erra.gt.erram(im)) erram(im)=erra
          if(errb.gt.errbm(im)) errbm(im)=errb
          betap(k,im)=sngl(dbeta(k))
   10   continue
   20 continue
      do 40 ip=1,3
        ip4=1+4*(ip-1)
        write(*,1) ip4-1,ip4,ip4+1,ip4+2
    1   format(5x,'k',5x,'m=',i1,'  beta(k)',3x,'m=',i1,'  beta(k)',3x,
     *    'm=',i2,' beta(k)',3x,'m=',i2,' beta(k)'/)
        do 30 k=1,n
          km1=k-1
          write(*,2) km1,betap(k,ip4),betap(k,ip4+1),betap(k,ip4+2),
     *      betap(k,ip4+3)
    2     format(1x,i5,4f15.7)
   30   continue
        write(*,3) erram(ip4),erram(ip4+1),erram(ip4+2),erram(ip4+3)
    3   format(/4x,'erra',e14.4,3e15.4)
        write(*,4) errbm(ip4),errbm(ip4+1),errbm(ip4+2),errbm(ip4+3)
    4   format(4x,'errb',e14.4,3e15.4//)
   40 continue
      stop
      end

      subroutine indp(n,m,a,b,eps,alpha,beta,ierr,z,w,e,a1,b1)
c
c If  p(m)(.)  denotes the (monic) orthogonal polynomial of degree  m
c relative to the weight function  w(x), then the corresponding m-th 
c induced orthogonal polynomials  pind(k,m)(.), k=0,1,2,..., are those
c orthogonal with respect to the weight function
c
c                   (p(m)(x)**2)*w(x).  
c
c (For background on induced orthogonal polynomials, including an
c algorithm for generating their recursion coefficients, see W. Gautschi
c and S. Li,``A set of orthogonal polynomials induced by a given
c orthogonal polynomial'', Aequationes Math., to appear.) This routine
c obtains the first n recurrence coefficients of the m-th induced
c orthogonal polynomials by an m-fold application of the routine  chri
c with  iopt=7, the shifts taken being, in succession, the zeros of
c p(m)(.).
c
      dimension a(*),b(*),alpha(*),beta(*),z(m),w(m),e(m),
     *a1(*),b1(*)
c
c The arrays  a,b,alpha,beta,a1,b1  are assumed to have dimension  n+m.
c
      npm=n+m
      do 10 k=1,npm
        alpha(k)=a(k)
        beta(k)=b(k)
   10 continue
      if(m.eq.0) return
      call gauss(m,a,b,eps,z,w,ierr,e)
      do 30 imu=1,m
        mi=npm-imu
        do 20 k=1,mi+1
          a1(k)=alpha(k)
          b1(k)=beta(k)
   20   continue
        x=z(imu)
        call chri(mi,7,a1,b1,x,0.,0.,0.,alpha,beta,ierrc)
   30 continue
      return
      end

      subroutine dindp(n,m,da,db,deps,dalpha,dbeta,ierr,dz,dw,de,
     *da1,db1)
c
c This is a double-precision version of the routine  indp.
c
      double precision da(*),db(*),deps,dalpha(*),dbeta(*),
     *dz(m),dw(m),de(m),da1(*),db1(*),dx
c
c The arrays  da,db,dalpha,dbeta,da1,db1  are assumed to have
c dimension  n+m.
c
      npm=n+m
      do 10 k=1,npm
        dalpha(k)=da(k)
        dbeta(k)=db(k)
   10 continue
      if(m.eq.0) return
      call dgauss(m,da,db,deps,dz,dw,ierr,de)
      do 30 imu=1,m
        mi=npm-imu
        do 20 k=1,mi+1
          da1(k)=dalpha(k)
          db1(k)=dbeta(k)
   20   continue
        dx=dz(imu)
        call dchri(mi,7,da1,db1,dx,0.d0,0.d0,0.d0,dalpha,
     *    dbeta,ierrc)
   30 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test10.out


     output of test10:


     k     m=0  beta(k)   m=1  beta(k)   m= 2 beta(k)   m= 3 beta(k)

     0      2.0000000      0.6666667      0.1777778      0.0457143
     1      0.3333333      0.6000000      0.5238096      0.5111111
     2      0.2666667      0.1142857      0.2943723      0.2596399
     3      0.2571429      0.3968254      0.1122995      0.2940976
     4      0.2539683      0.1616162      0.3049499      0.1117331
     5      0.2525252      0.3426574      0.3401083      0.3018522
     6      0.2517483      0.1846154      0.1650551      0.2620478
     7      0.2512821      0.3176471      0.2375564      0.3332025
     8      0.2509804      0.1981424      0.3369734      0.1650309
     9      0.2507740      0.3032582      0.2091606      0.2504291
    10      0.2506266      0.2070393      0.2095635      0.2324007
    11      0.2505176      0.2939130      0.3138134      0.3361176
    12      0.2504348      0.2133333      0.2467060      0.2111810
    13      0.2503704      0.2873563      0.2018702      0.2421750
    14      0.2503193      0.2180200      0.2840271      0.2095683
    15      0.2502781      0.2825024      0.2737337      0.3119781
    16      0.2502444      0.2216450      0.2073733      0.2443413
    17      0.2502165      0.2787645      0.2563508      0.2546524
    18      0.2501931      0.2245322      0.2870840      0.2016614
    19      0.2501732      0.2757974      0.2214990      0.2802563

    erra    0.0000E+00     0.0000E+00     0.4768E-06     0.1132E-05
    errb    0.8214E-07     0.9824E-07     0.1095E-05     0.2756E-05


     k     m=4  beta(k)   m=5  beta(k)   m= 6 beta(k)   m= 7 beta(k)

     0      0.0116100      0.0029318      0.0007381      0.0001855
     1      0.5064935      0.5042735      0.5030303      0.5022625
     2      0.2544532      0.2526272      0.2517535      0.2512614
     3      0.2591064      0.2540899      0.2523799      0.2515793
     4      0.2943171      0.2589409      0.2539382      0.2522611
     5      0.1114941      0.2945729      0.2588910      0.2538679
     6      0.3003072      0.1113708      0.2947960      0.2588843
     7      0.2612041      0.2993873      0.1112988      0.2949805
     8      0.2554918      0.2607481      0.2987821      0.1112532
     9      0.3314525      0.2550761      0.2604586      0.2983568
    10      0.1650591      0.2531916      0.2548413      0.2602577
    11      0.2512313      0.3309445      0.2529443      0.2546880
    12      0.2483109      0.1651390      0.2521023      0.2527988
    13      0.2299636      0.2511611      0.3308373      0.2519400
    14      0.3360043      0.2500050      0.1652347      0.2514956
    15      0.2126214      0.2473366      0.2509883      0.3308774
    16      0.2422271      0.2284895      0.2503709      0.1653301
    17      0.2466970      0.3360524      0.2494033      0.2508275
    18      0.2084099      0.2136950      0.2467760      0.2504458
    19      0.3105007      0.2423054      0.2274819      0.2499557

    erra    0.1490E-05     0.1907E-05     0.1937E-04     0.7093E-05
    errb    0.1639E-05     0.4058E-05     0.4159E-04     0.4904E-05


     k     m=8  beta(k)   m=9  beta(k)   m=10 beta(k)   m=11 beta(k)

     0      0.0000465      0.0000117      0.0000029      0.0000007
     1      0.5017544      0.5014006      0.5011442      0.5009524
     2      0.2509544      0.2507491      0.2506044      0.2504985
     3      0.2511344      0.2508591      0.2506758      0.2505469
     4      0.2514875      0.2510628      0.2508025      0.2506302
     5      0.2521980      0.2514347      0.2510192      0.2507665
     6      0.2538342      0.2521625      0.2514026      0.2509913
     7      0.2588947      0.2538188      0.2521420      0.2513824
     8      0.2951320      0.2589120      0.2538129      0.2521302
     9      0.1112224      0.2952571      0.2589313      0.2538124
    10      0.2980437      0.1112007      0.2953612      0.2589508
    11      0.2601101      0.2978047      0.1111848      0.2954489
    12      0.2545792      0.2599972      0.2976172      0.1111728
    13      0.2527018      0.2544975      0.2599082      0.2974667
    14      0.2518408      0.2526320      0.2544339      0.2598365
    15      0.2513822      0.2517734      0.2525789      0.2543829
    16      0.2511212      0.2513106      0.2517243      0.2525371
    17      0.3309727      0.2510385      0.2512610      0.2516866
    18      0.1654193      0.2508731      0.2509847      0.2512244
    19      0.2506951      0.3310864      0.2508108      0.2509467

    erra    0.7987E-05     0.5084E-04     0.5126E-05     0.2623E-05
    errb    0.1075E-04     0.6333E-04     0.1109E-04     0.1062E-04


C-END-OF-FILE

cat <<C-END-OF-FILE > test11.f
c
c
      program test11
c
c
      complex rho,rold,z,e
      dimension xx(5),rr(5),a(500),b(500),alpha(40),beta(40),alphc(40),
     *betc(40),fnu(80),rho(80),rold(80),s(40),s0(80),s1(80),s2(80),
     *alphr(40),betr(40),alphcr(40),betcr(40)
      double precision d1mach,depsma,deps,dal,dbe,dhi,da(800),db(800),
     *dx,dy,dalpha(40),dbeta(40),dnu(80),drhor(80),drhoi(80),
     *droldr(80),droldi(80),ds(40),ds0(80),ds1(80),ds2(80),dhr,
     *dalphc(40),dbetc(40),dalphr(40),dbetr(40),dalcr(40),dbecr(40)
      data xx/1.001,1.01,1.04,1.07,1.1/
      data rr/1.05,1.1625,1.275,1.3875,1.5/
c
c This test is to illustrate the dissimilar performance of the routines
c chri  and  gchri  in the case of division of the Jacobi weight
c function  w(t;alj,bej)  with parameters  alj,bej  by either a linear
c divisor  t-x  or a quadratic divisor  (t-x)**2 + y**2 . In either
c case, the parameters selected are  alj=-.8(.4).8, bej=alj(.4).8.  In
c the former case, x = -1.001, -1.01, -1.04, -1.07 and -1.1, whereas in
c the latter case,  x and  y  are chosen to lie, regularly spaced, on
c the upper half of an ellipse with foci at +1 and -1 and sum of the
c semiaxes equal to  rho = 1.05, 1.1625, 1.275, 1.3875 and 1.5. The
c routines are run in both single and double precision with n=40, the 
c results of the latter being used to calculate, and print, the maximum
c absolute and relative error of the single-precision alpha- and beta-
c coefficients, respectively. Also printed are the starting recurrence 
c indexes required in the backward recurrence schemes of  gchri,dgchri  
c to achieve single- resp. double-precision accuracy. This information 
c is contained in the first line of each 3-line block of the output,
c where in the case of quadratic divisors only average values (averaged
c over the upper half of the respective ellipse) are shown. The second
c and third line of each 3-line block display the maximum 
c ``reconstruction error'', that is, the maximum errors in the alpha's
c and beta's if the coefficients produced by  gchri,chri  and  dgchri,
c dchri  are fed back to the routines  chri  and  dchri  with  iopt=1
c to recover the original recursion coefficients in single and double
c precision.
c
      write(*,1)
    1 format(/)
      epsma=r1mach(3)
      depsma=d1mach(3)
c
c epsma and depsma are the machine single and double precision.
c
      n=40
      np1=n+1
      nm1=n-1
      nd=2*n
      ndm1=nd-1
      numax=500
      numaxd=800
      eps=10.*epsma
      deps=100.d0*depsma
      epsd=sngl(deps)
      ipoly=6
      do 70 ial=1,5
        al=-.8+.4*real(ial-1)
        dal=dble(al)
        ibemax=6-ial
        do 60 ibe=1,ibemax
          be=al+.4*real(ibe-1)
          dbe=dble(be)
          write(*,2) al,be
    2     format(///1x,'al = ',f6.2,'  be = ',f6.2//)
          hi=0.
          dhi=0.d0
c
c Generate the Jacobi recurrence coefficients to be used in the
c backward recurrence algorithm of the routines  gchri  and  dgchri.
c
          call recur(numax,ipoly,al,be,a,b,ierr)
          call drecur(numaxd,ipoly,dal,dbe,da,db,ierrd)
          write(*,3)
    3     format(30x,'gchri',20x,'chri')
          write(*,4)
    4     format(5x,'x',5x,'nu0',2x,'nud0',4x,'erra',8x,'errb',10x,
     *      'erra',7x,'errb'/)
          do 20 ix=1,5
            x=-xx(ix)
            dx=dble(x)
            y=0.
            dy=0.d0
            z=cmplx(x,y)
c
c Compute the starting index for backward recurrence.
c
            nu0=nu0jac(ndm1,z,eps)
            nu0d=nu0jac(ndm1,z,epsd)
c
c Generate the recurrence coefficients for the Jacobi weight function
c divided by a linear divisor, using the routines  gchri,dgchri.
c
            call gchri(n,1,nu0,numax,eps,a,b,x,y,alpha,beta,nu,ierrg,
     *        ierrc,fnu,rho,rold,s,s0,s1,s2)
c
c On machines with limited single-precision exponent range, the routine
c cheb  used in  gchri  may have generated an underflow exception,
c which however is harmless and can be ignored.
c
            call dgchri(n,1,nu0d,numaxd,deps,da,db,dx,dy,dalpha,dbeta,
     *        nud,ierrgd,ierrcd,dnu,drhor,drhoi,droldr,droldi,ds,ds0,
     *        ds1,ds2)
            if(ierrg.ne.0 .or. ierrc.ne.0 .or. ierrgd.ne.0 .or.ierrcd
     *        .ne.0) then
              write(*,5) ierrg,ierrgd,al,be,x
    5         format(/1x,'ierrg in gchri = ',i4,' ierrg in dgchri = ',
     *          i4,' for al = ',f6.2,' be = ',f6.2,' x = ',f7.4)
              write(*,6) ierrc,ierrcd,al,be,x
    6         format(1x,'ierrc in gchri = ',i4,' ierrc in dgchri = ',
     *          i4,' for al = ',f6.2,' be = ',f6.2,' x = ',f7.4/) 
              goto 20
            end if
c
c Generate the recurrence coefficients for the Jacobi weight function
c divided by a linear divisor, using the routines  chri,dchri.
c
            hr=real(rho(1))
            dhr=drhor(1)
            call chri(n,4,a,b,x,y,hr,hi,alphc,betc,ierr)
            call dchri(n,4,da,db,dx,dy,dhr,dhi,dalphc,dbetc,ierr)
c
c Do the reconstruction.
c
            call chri(nm1,1,alpha,beta,x,y,0.,0.,alphr,betr,ierr)
            call dchri(nm1,1,dalpha,dbeta,dx,dy,0.d0,0.d0,dalphr,dbetr,
     *        ierr)
            call chri(nm1,1,alphc,betc,x,y,0.,0.,alphcr,betcr,ierr)
            call dchri(nm1,1,dalphc,dbetc,dx,dy,0.d0,0.d0,dalcr,dbecr,
     *        ierr)
c
c Compute and print the maximum errors.
c
            erragm=0.
            errbgm=0.
            erracm=0.
            errbcm=0.
            erram=0.
            errbm=0.
            errdam=0.
            errdbm=0.
            eracrm=0.
            erbcrm=0.
            edacrm=0.
            edbcrm=0.
            do 10 k=1,n
              km1=k-1
              errag=abs(sngl(dble(alpha(k))-dalpha(k)))
              errbg=abs(sngl((dble(beta(k))-dbeta(k))/dbeta(k)))
              errac=abs(sngl(dble(alphc(k))-dalphc(k)))
              errbc=abs(sngl((dble(betc(k))-dbetc(k))/dbetc(k)))
              if(k.lt.n) then
                erra=abs(alphr(k)-a(k))
                errb=abs((betr(k)-b(k))/b(k))
                errda=abs(sngl(dalphr(k)-da(k)))
                errdb=abs(sngl((dbetr(k)-db(k))/db(k)))
                eracr=abs(alphcr(k)-a(k))
                erbcr=abs((betcr(k)-b(k))/b(k))
                edacr=abs(sngl(dalcr(k)-da(k)))
                edbcr=abs(sngl((dbecr(k)-db(k))/db(k)))
                if(erra.gt.erram) erram=erra
                if(errb.gt.errbm) errbm=errb
                if(errda.gt.errdam) errdam=errda
                if(errdb.gt.errdbm) errdbm=errdb
                if(eracr.gt.eracrm) eracrm=eracr
                if(erbcr.gt.erbcrm) erbcrm=erbcr
                if(edacr.gt.edacrm) edacrm=edacr
                if(edbcr.gt.edbcrm) edbcrm=edbcr
              end if
              if(errag.gt.erragm) erragm=errag
              if(errbg.gt.errbgm) errbgm=errbg
              if(errac.gt.erracm) erracm=errac
              if(errbc.gt.errbcm) errbcm=errbc
   10       continue
            write(*,7) x,nu0,nu0d,erragm,errbgm,erracm,errbcm
    7       format(/1x,f7.4,2i6,2e12.4,2x,2e12.4)
            if(ix.eq.1) then
              write(*,8) erram,errbm,errdam,errdbm
    8         format(11x,'reconstr.',2e12.4,2x,2e12.4)
              write(*,9) eracrm,erbcrm,edacrm,edbcrm
    9         format(12x,'errors',2x,2e12.4,2x,2e12.4)
            else
              write(*,11) erram,errbm,errdam,errdbm
   11         format(20x,2e12.4,2x,2e12.4)
              write(*,11) eracrm,erbcrm,edacrm,edbcrm
            end if
   20     continue
          write(*,1)
          ndiv=20
          ndivm1=ndiv-1
          fndiv=real(ndiv)
          fndm1=real(ndivm1)
          pi=4.*atan(1.)
          write(*,3)
          write(*,12)
   12     format(4x,'rho',4x,'nu0',2x,'nud0',4x,'erra',8x,'errb',10x,
     *      'erra',7x,'errb'/)
          do 50 ir=1,5
            r=rr(ir)
            agmv=0.
            bgmv=0.
            acmv=0.
            bcmv=0.
            amv=0.
            bmv=0.
            damv=0.
            dbmv=0.
            acrmv=0.
            bcrmv=0.
            dacrmv=0.
            dbcrmv=0.
            nu0v=0
            nu0dv=0
            do 40 ith=1,ndivm1
c
c Generate the points on the ellipse.
c
              theta=pi*real(ith)/fndiv
              e=cmplx(cos(theta),sin(theta)) 
              z=.5*(r*e+1./(r*e))
              x=real(z)
              y=aimag(z)
              dx=dble(x)
              dy=dble(y)
c
c Compute the starting index for backward recurrence.
c
              nu0=nu0jac(ndm1,z,eps)
              nu0d=nu0jac(ndm1,z,epsd)
c
c Generate the recurrence coefficients for the Jacobi weight function
c divided by a quadratic divisor, using the routines  gchri,dgchri.
c
              call gchri(n,2,nu0,numax,eps,a,b,x,y,alpha,beta,nu,ierrg,
     *          ierrc,fnu,rho,rold,s,s0,s1,s2)
              call dgchri(n,2,nu0d,numaxd,deps,da,db,dx,dy,dalpha,dbeta,
     *          nud,ierrgd,ierrcd,dnu,drhor,drhoi,droldr,droldi,ds,ds0,
     *          ds1,ds2)
              if(ierrg.ne.0 .or.ierrc.ne.0 .or. ierrgd.ne.0 .or. ierrcd
     *          .ne.0) then
                write(*,5) ierrg,ierrgd,al,be,x
                write(*,6) ierrc,ierrcd,al,be,x
                goto 40
              end if
              nu0v=nu0v+nu0
              nu0dv=nu0dv+nu0d
c
c Generate the recurrence coefficients for the Jacobi weight function
c divided by a quadratic divisor, using the routines  chri,dchri.
c
              hr=real(rho(1))
              hi=aimag(rho(1))
              dhr=drhor(1)
              dhi=drhoi(1)
              call chri(n,5,a,b,x,y,hr,hi,alphc,betc,ierr)
              call dchri(n,5,da,db,dx,dy,dhr,dhi,dalphc,dbetc,ierr)
c
c Do the reconstruction.
c
              call chri(nm1,2,alpha,beta,x,y,0.,0.,alphr,betr,ierr)
              call dchri(nm1,2,dalpha,dbeta,dx,dy,0.d0,0.d0,dalphr,
     *          dbetr,ierr)
              call chri(nm1,2,alphc,betc,x,y,0.,0.,alphcr,betcr,ierr)
              call dchri(nm1,2,dalphc,dbetc,dx,dy,0.d0,0.d0,dalcr,
     *          dbecr,ierr)
c
c Compute and print the maximum average errors.
c
              erragm=0.
              errbgm=0.
              erracm=0.
              errbcm=0.
              erram=0.
              errbm=0.
              errdam=0.
              errdbm=0.
              eracrm=0.
              erbcrm=0.
              edacrm=0.
              edbcrm=0.
              do 30 k=1,n
                km1=k-1
                errag=abs(sngl(dble(alpha(k))-dalpha(k)))
                errbg=abs(sngl((dble(beta(k))-dbeta(k))/dbeta(k)))
                errac=abs(sngl(dble(alphc(k))-dalphc(k)))
                errbc=abs(sngl((dble(betc(k))-dbetc(k))/dbetc(k)))
                if(k.lt.n) then
                  erra=abs(alphr(k)-a(k))
                  errb=abs((betr(k)-b(k))/b(k))
                  errda=abs(sngl(dalphr(k)-da(k)))
                  errdb=abs(sngl((dbetr(k)-db(k))/db(k)))
                  eracr=abs(alphcr(k)-a(k))
                  erbcr=abs((betcr(k)-b(k))/b(k))
                  edacr=abs(sngl(dalcr(k)-da(k)))
                  edbcr=abs(sngl((dbecr(k)-db(k))/db(k)))
                  if(erra.gt.erram) erram=erra
                  if(errb.gt.errbm) errbm=errb
                  if(errda.gt.errdam) errdam=errda
                  if(errdb.gt.errdbm) errdbm=errdb
                  if(eracr.gt.eracrm) eracrm=eracr
                  if(erbcr.gt.erbcrm) erbcrm=erbcr
                  if(edacr.gt.edacrm) edacrm=edacr
                  if(edbcr.gt.edbcrm) edbcrm=edbcr
                end if
                if(errag.gt.erragm) erragm=errag
                if(errbg.gt.errbgm) errbgm=errbg
                if(errac.gt.erracm) erracm=errac
                if(errbc.gt.errbcm) errbcm=errbc
   30         continue
              agmv=agmv+erragm
              bgmv=bgmv+errbgm
              acmv=acmv+erracm
              bcmv=bcmv+errbcm
              amv=amv+erram
              bmv=bmv+errbm
              damv=damv+errdam
              dbmv=dbmv+errdbm
              acrmv=acrmv+eracrm
              bcrmv=bcrmv+erbcrm
              dacrmv=dacrmv+edacrm
              dbcrmv=dbcrmv+edbcrm
   40       continue
            nu0=real(nu0v)/fndm1
            nu0d=real(nu0dv)/fndm1
            erragm=agmv/fndm1
            errbgm=bgmv/fndm1
            erracm=acmv/fndm1
            errbcm=bcmv/fndm1
            erram=amv/fndm1
            errbm=bmv/fndm1
            errdam=damv/fndm1
            errdbm=dbmv/fndm1
            eracrm=acrmv/fndm1
            erbcrm=bcrmv/fndm1
            edacrm=dacrmv/fndm1
            edbcrm=dbcrmv/fndm1
            if(ir.eq.1) then
              write(*,7) r,nu0,nu0d,erragm,errbgm,erracm,errbcm
              write(*,8) erram,errbm,errdam,errdbm
              write(*,9) eracrm,erbcrm,edacrm,edbcrm
            else
              write(*,7) r,nu0,nu0d,erragm,errbgm,erracm,errbcm
              write(*,11) erram,errbm,errdam,errdbm
              write(*,11) eracrm,erbcrm,edacrm,edbcrm
            end if
   50     continue
   60   continue
   70 continue
      stop
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > test11.out


 output of test11:


 al =  -0.80  be =  -0.80


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.2624E-05  0.3404E-04    0.1599E-06  0.1980E-04
           reconstr.  0.1436E-04  0.3843E-05    0.3320E-13  0.1239E-13
            errors    0.2980E-07  0.1792E-06    0.2220E-15  0.3336E-15

 -1.0100   130   193  0.2100E-06  0.6884E-06    0.3860E-03  0.6715E-03
                      0.6557E-06  0.4839E-06    0.5551E-15  0.1651E-14
                      0.5960E-07  0.1799E-06    0.1110E-15  0.4487E-15

 -1.0400   105   136  0.1509E-06  0.5688E-06    0.2078E+01  0.5484E+01
                      0.1192E-06  0.4433E-06    0.4441E-15  0.9909E-15
                      0.1073E-04  0.1622E-04    0.1665E-15  0.3365E-15

 -1.0700    99   123  0.9254E-07  0.1664E-06    0.2501E+01  0.1229E+02
                      0.1192E-06  0.2386E-06    0.1110E-15  0.3350E-15
                      0.2798E-01  0.4190E-01    0.1110E-15  0.3332E-15

 -1.1000    96   116  0.8038E-07  0.2107E-06    0.1004E+00  0.2032E+00
                      0.1192E-06  0.2282E-06    0.1388E-15  0.2427E-15
                      0.1391E-01  0.1734E-01    0.1665E-15  0.3332E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.1904E-04  0.2622E-04    0.4102E-06  0.1071E-05
           reconstr.  0.1942E-04  0.2463E-04    0.5695E-13  0.6761E-13
            errors    0.1443E-06  0.2414E-06    0.2556E-15  0.4820E-15

  1.1625   127   186  0.2973E-05  0.8070E-05    0.4004E-02  0.7152E-02
                      0.4202E-05  0.6630E-05    0.6233E-14  0.8932E-14
                      0.9686E-07  0.2643E-06    0.1731E-15  0.4810E-15

  1.2750   109   146  0.6683E-06  0.1982E-05    0.2381E+01  0.3582E+02
                      0.9162E-06  0.1836E-05    0.2811E-14  0.3567E-14
                      0.3899E-04  0.2571E-04    0.1833E-15  0.5126E-15

  1.3875   101   129  0.6152E-06  0.1623E-05    0.3134E+01  0.7978E+02
                      0.7819E-06  0.1396E-05    0.1945E-14  0.2461E-14
                      0.5514E+01  0.2190E+04    0.1611E-15  0.5542E-15

  1.5000    97   119  0.4752E-06  0.1119E-05    0.2096E+01  0.2318E+02
                      0.6551E-06  0.9123E-06    0.1307E-14  0.1558E-14
                      0.1323E+01  0.3840E+02    0.1870E-15  0.5594E-15



 al =  -0.80  be =  -0.40


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.3871E-06  0.2026E-05    0.2629E-06  0.5517E-06
           reconstr.  0.1016E-05  0.7163E-06    0.8882E-15  0.1454E-14
            errors    0.8322E-07  0.1789E-06    0.1621E-15  0.2223E-15

 -1.0100   130   193  0.1464E-06  0.4405E-06    0.6120E-03  0.1059E-02
                      0.2496E-06  0.2601E-06    0.2602E-15  0.4464E-15
                      0.6519E-07  0.2385E-06    0.1562E-15  0.3331E-15

 -1.0400   105   136  0.1189E-06  0.1894E-06    0.3923E-01  0.8153E-01
                      0.1192E-06  0.1789E-06    0.4163E-15  0.7268E-15
                      0.1884E-06  0.2385E-06    0.1621E-15  0.3334E-15

 -1.0700    99   123  0.1574E-06  0.2745E-06    0.6805E-01  0.1448E+00
                      0.7264E-07  0.1812E-06    0.1544E-15  0.3331E-15
                      0.7162E-05  0.9836E-05    0.1928E-15  0.3335E-15

 -1.1000    96   116  0.7204E-07  0.2033E-06    0.9716E-01  0.2093E+00
                      0.1043E-06  0.1431E-06    0.1348E-15  0.2223E-15
                      0.4507E-01  0.6481E-01    0.2629E-15  0.3332E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.2203E-04  0.3297E-04    0.4644E-06  0.9676E-06
           reconstr.  0.2005E-04  0.3969E-04    0.2304E-13  0.5254E-13
            errors    0.1017E-06  0.2308E-06    0.1450E-15  0.4713E-15

  1.1625   127   186  0.3724E-05  0.6724E-05    0.2147E-02  0.4000E-02
                      0.2944E-05  0.7952E-05    0.3497E-14  0.5900E-14
                      0.1009E-06  0.2640E-06    0.1870E-15  0.4988E-15

  1.2750   109   146  0.1516E-05  0.2057E-05    0.3342E+01  0.4620E+02
                      0.1262E-05  0.2861E-05    0.1906E-14  0.3603E-14
                      0.1593E-04  0.2501E-04    0.1845E-15  0.4944E-15

  1.3875   101   129  0.9723E-06  0.1392E-05    0.1248E+02  0.7176E+04
                      0.7896E-06  0.1897E-05    0.9630E-15  0.2142E-14
                      0.6428E-01  0.2584E+00    0.2042E-15  0.4859E-15

  1.5000    97   119  0.2917E-06  0.6123E-06    0.3660E+01  0.1094E+03
                      0.2598E-06  0.6297E-06    0.6907E-15  0.1399E-14
                      0.1988E+02  0.2105E+05    0.2284E-15  0.5639E-15



 al =  -0.80  be =   0.00


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.6113E-06  0.7181E-06    0.5517E-06  0.7181E-06
           reconstr.  0.2962E-06  0.4186E-06    0.5885E-15  0.1002E-14
            errors    0.8935E-07  0.1789E-06    0.1651E-15  0.3333E-15

 -1.0100   130   193  0.1441E-06  0.2187E-06    0.1969E-03  0.3417E-03
                      0.1310E-06  0.2981E-06    0.1849E-15  0.5563E-15
                      0.9968E-07  0.1788E-06    0.1331E-15  0.3331E-15

 -1.0400   105   136  0.1323E-06  0.2299E-06    0.2805E+01  0.1807E+02
                      0.1267E-06  0.1794E-06    0.1731E-15  0.4442E-15
                      0.5130E-03  0.7728E-03    0.1600E-15  0.2221E-15

 -1.0700    99   123  0.1048E-06  0.2179E-06    0.6895E-01  0.1439E+00
                      0.7311E-07  0.1204E-06    0.1213E-15  0.2243E-15
                      0.1278E-04  0.1752E-04    0.1887E-15  0.3335E-15

 -1.1000    96   116  0.1017E-06  0.1888E-06    0.2371E+01  0.9757E+01
                      0.8947E-07  0.1204E-06    0.1928E-15  0.2280E-15
                      0.9702E-01  0.2093E+00    0.2290E-15  0.3334E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.1052E-04  0.2047E-04    0.4288E-06  0.1091E-05
           reconstr.  0.1016E-04  0.2138E-04    0.2291E-13  0.2755E-13
            errors    0.9647E-07  0.2787E-06    0.1721E-15  0.5265E-15

  1.1625   127   186  0.2007E-05  0.3941E-05    0.2853E-02  0.4796E-02
                      0.1593E-05  0.5239E-05    0.1437E-13  0.4156E-13
                      0.1041E-06  0.2718E-06    0.1677E-15  0.4751E-15

  1.2750   109   146  0.2026E-05  0.5418E-05    0.3470E+01  0.7661E+02
                      0.2577E-05  0.5570E-05    0.2347E-14  0.5292E-14
                      0.1307E-03  0.2336E-03    0.2059E-15  0.5004E-15

  1.3875   101   129  0.7127E-06  0.1496E-05    0.6090E+01  0.6142E+03
                      0.5514E-06  0.1839E-05    0.8313E-15  0.2667E-14
                      0.1108E+00  0.3932E+00    0.2018E-15  0.5142E-15

  1.5000    97   119  0.2991E-06  0.7004E-06    0.2625E+01  0.3303E+02
                      0.2690E-06  0.7726E-06    0.6186E-15  0.1526E-14
                      0.2582E+01  0.1810E+03    0.2105E-15  0.5192E-15



 al =  -0.80  be =   0.40


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.3133E-06  0.5228E-06    0.3133E-06  0.5854E-06
           reconstr.  0.1557E-06  0.2386E-06    0.2800E-15  0.7782E-15
            errors    0.8510E-07  0.1791E-06    0.1407E-15  0.3332E-15

 -1.0100   130   193  0.2149E-06  0.3909E-06    0.5263E-03  0.9106E-03
                      0.9071E-07  0.3133E-06    0.1860E-15  0.4488E-15
                      0.8510E-07  0.1790E-06    0.2075E-15  0.4442E-15

 -1.0400   105   136  0.1236E-06  0.2609E-06    0.3926E-01  0.8149E-01
                      0.9814E-07  0.1789E-06    0.1707E-15  0.3299E-15
                      0.1175E-05  0.1729E-05    0.1527E-15  0.3332E-15

 -1.0700    99   123  0.1131E-06  0.2466E-06    0.6880E-01  0.1443E+00
                      0.6380E-07  0.1216E-06    0.1923E-15  0.2235E-15
                      0.2522E-02  0.3455E-02    0.2044E-15  0.2334E-15

 -1.1000    96   116  0.9628E-07  0.1806E-06    0.9773E-01  0.2088E+00
                      0.7742E-07  0.1195E-06    0.1305E-15  0.3331E-15
                      0.9578E-01  0.1035E+00    0.2148E-15  0.3331E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.1181E-04  0.3811E-04    0.6804E-06  0.1479E-05
           reconstr.  0.1294E-04  0.4005E-04    0.3438E-13  0.1609E-12
            errors    0.9348E-07  0.2698E-06    0.1483E-15  0.5000E-15

  1.1625   127   186  0.1924E-05  0.3169E-05    0.3002E-02  0.5436E-02
                      0.1917E-05  0.3057E-05    0.1092E-13  0.3961E-13
                      0.1032E-06  0.2741E-06    0.2165E-15  0.4998E-15

  1.2750   109   146  0.1201E-05  0.2768E-05    0.3635E+01  0.1031E+03
                      0.1327E-05  0.2691E-05    0.2431E-14  0.1178E-13
                      0.2353E-04  0.3349E-04    0.2144E-15  0.4858E-15

  1.3875   101   129  0.6809E-06  0.1695E-05    0.2729E+01  0.4015E+02
                      0.7075E-06  0.1841E-05    0.1150E-14  0.3547E-14
                      0.6156E-02  0.1655E-01    0.2434E-15  0.5500E-15

  1.5000    97   119  0.3511E-06  0.7523E-06    0.1386E+02  0.6769E+04
                      0.3112E-06  0.8675E-06    0.1007E-14  0.1974E-14
                      0.2122E+01  0.4450E+02    0.2149E-15  0.5309E-15



 al =  -0.80  be =   0.80


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.1751E-06  0.2594E-06    0.3300E-06  0.5567E-06
           reconstr.  0.1192E-06  0.2983E-06    0.2776E-15  0.6663E-15
            errors    0.5960E-07  0.1789E-06    0.5551E-16  0.3333E-15

 -1.0100   130   193  0.1126E-06  0.2747E-06    0.1015E-02  0.1775E-02
                      0.1490E-06  0.2983E-06    0.1665E-15  0.4443E-15
                      0.5960E-07  0.1789E-06    0.1110E-15  0.4445E-15

 -1.0400   105   136  0.8471E-07  0.1614E-06    0.3990E-01  0.8199E-01
                      0.5960E-07  0.1792E-06    0.1665E-15  0.3336E-15
                      0.1562E-04  0.2361E-04    0.1110E-15  0.3344E-15

 -1.0700    99   123  0.8547E-07  0.1928E-06    0.1019E+02  0.3714E+03
                      0.5960E-07  0.1789E-06    0.1665E-15  0.4444E-15
                      0.6843E-01  0.1452E+00    0.1110E-15  0.2256E-15

 -1.1000    96   116  0.1400E-06  0.2170E-06    0.2102E+01  0.4503E+01
                      0.1192E-06  0.1211E-06    0.1665E-15  0.2223E-15
                      0.9779E-01  0.2097E+00    0.1110E-15  0.3335E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.1313E-04  0.3446E-04    0.1100E-05  0.2073E-05
           reconstr.  0.1356E-04  0.3462E-04    0.3914E-13  0.7907E-13
            errors    0.8235E-07  0.2842E-06    0.1622E-15  0.4946E-15

  1.1625   127   186  0.4900E-05  0.1076E-04    0.5187E-02  0.1009E-01
                      0.4912E-05  0.1086E-04    0.1052E-13  0.2280E-13
                      0.9098E-07  0.2638E-06    0.1716E-15  0.5048E-15

  1.2750   109   146  0.1765E-05  0.4832E-05    0.8907E+02  0.5656E+06
                      0.2163E-05  0.4766E-05    0.2092E-14  0.4674E-14
                      0.3818E-01  0.3025E-01    0.1965E-15  0.5817E-15

  1.3875   101   129  0.7849E-06  0.1642E-05    0.2573E+01  0.3026E+02
                      0.7339E-06  0.1767E-05    0.1662E-14  0.3246E-14
                      0.4143E+00  0.1176E+02    0.2173E-15  0.5110E-15

  1.5000    97   119  0.3011E-06  0.6791E-06    0.6881E+01  0.5660E+03
                      0.2731E-06  0.7817E-06    0.6278E-15  0.1573E-14
                      0.4324E+01  0.4010E+03    0.1972E-15  0.5340E-15



 al =  -0.40  be =  -0.40


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.3271E-06  0.1063E-05    0.1599E-06  0.2404E-06
           reconstr.  0.5364E-06  0.8593E-06    0.1832E-14  0.2218E-14
            errors    0.5960E-07  0.2384E-06    0.2220E-15  0.4440E-15

 -1.0100   130   193  0.1503E-06  0.8233E-06    0.9456E-04  0.1641E-03
                      0.2086E-06  0.3437E-06    0.3331E-15  0.6615E-15
                      0.5960E-07  0.2384E-06    0.1110E-15  0.4440E-15

 -1.0400   105   136  0.8391E-07  0.1846E-06    0.5100E+01  0.8155E+02
                      0.8941E-07  0.2384E-06    0.1665E-15  0.4440E-15
                      0.1199E-02  0.1816E-02    0.1665E-15  0.4437E-15

 -1.0700    99   123  0.9916E-07  0.1703E-06    0.1116E+02  0.4490E+03
                      0.5960E-07  0.1192E-06    0.1665E-15  0.4439E-15
                      0.6957E-01  0.1431E+00    0.1110E-15  0.2220E-15

 -1.1000    96   116  0.8642E-07  0.1772E-06    0.9915E-01  0.2061E+00
                      0.5960E-07  0.1192E-06    0.1665E-15  0.2220E-15
                      0.7397E-01  0.1178E+00    0.1110E-15  0.4441E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.5545E-05  0.7803E-05    0.3935E-06  0.8545E-06
           reconstr.  0.5497E-05  0.7790E-05    0.1380E-13  0.2290E-13
            errors    0.7137E-07  0.2709E-06    0.1461E-15  0.5145E-15

  1.1625   127   186  0.1638E-05  0.2435E-05    0.1383E-02  0.2685E-02
                      0.1638E-05  0.2493E-05    0.2132E-14  0.3735E-14
                      0.8313E-07  0.3074E-06    0.1622E-15  0.4808E-15

  1.2750   109   146  0.6153E-06  0.1003E-05    0.1875E+01  0.1291E+02
                      0.6435E-06  0.8329E-06    0.6285E-15  0.1258E-14
                      0.6523E-05  0.1073E-04    0.1749E-15  0.5164E-15

  1.3875   101   129  0.3331E-06  0.6044E-06    0.3273E+01  0.5490E+02
                      0.3570E-06  0.5800E-06    0.7074E-15  0.1042E-14
                      0.5418E-02  0.5838E-02    0.1665E-15  0.5186E-15

  1.5000    97   119  0.2074E-06  0.4574E-06    0.1998E+01  0.1497E+02
                      0.2519E-06  0.4397E-06    0.6515E-15  0.9201E-15
                      0.1325E+01  0.1123E+02    0.1957E-15  0.5373E-15



 al =  -0.40  be =   0.00


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.1970E-06  0.4667E-06    0.1908E-06  0.4667E-06
           reconstr.  0.1795E-06  0.3576E-06    0.3511E-15  0.6660E-15
            errors    0.8233E-07  0.1192E-06    0.1617E-15  0.4440E-15

 -1.0100   130   193  0.1726E-06  0.2469E-06    0.2820E-03  0.4890E-03
                      0.1233E-06  0.2384E-06    0.1575E-15  0.4440E-15
                      0.1096E-06  0.2383E-06    0.1450E-15  0.4439E-15

 -1.0400   105   136  0.1331E-06  0.2350E-06    0.3985E-01  0.8033E-01
                      0.9759E-07  0.1192E-06    0.1893E-15  0.2220E-15
                      0.5703E-06  0.8344E-06    0.1874E-15  0.4440E-15

 -1.0700    99   123  0.1035E-06  0.2636E-06    0.5289E+01  0.8796E+02
                      0.7659E-07  0.1192E-06    0.1703E-15  0.2220E-15
                      0.2448E+01  0.7105E+00    0.2216E-15  0.4433E-15

 -1.1000    96   116  0.1167E-06  0.1996E-06    0.9848E-01  0.2069E+00
                      0.7136E-07  0.1192E-06    0.1249E-15  0.2220E-15
                      0.6353E-01  0.9709E-01    0.2258E-15  0.2220E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.7301E-05  0.1362E-04    0.3744E-06  0.9931E-06
           reconstr.  0.7211E-05  0.1393E-04    0.8843E-14  0.1825E-13
            errors    0.7191E-07  0.2697E-06    0.1201E-15  0.4888E-15

  1.1625   127   186  0.1301E-05  0.2275E-05    0.1882E-02  0.3291E-02
                      0.1240E-05  0.2391E-05    0.3146E-14  0.5666E-14
                      0.9056E-07  0.2750E-06    0.1813E-15  0.5140E-15

  1.2750   109   146  0.5737E-06  0.1287E-05    0.4358E+01  0.2551E+03
                      0.6150E-06  0.1260E-05    0.1096E-14  0.2378E-14
                      0.2394E-04  0.3999E-04    0.1843E-15  0.4781E-15

  1.3875   101   129  0.2218E-06  0.4216E-06    0.4583E+01  0.4074E+03
                      0.2350E-06  0.4248E-06    0.5382E-15  0.9290E-15
                      0.3106E-01  0.3646E-01    0.1775E-15  0.5041E-15

  1.5000    97   119  0.1858E-06  0.4970E-06    0.1658E+02  0.1629E+05
                      0.2043E-06  0.4443E-06    0.4739E-15  0.9342E-15
                      0.3062E+01  0.1296E+03    0.2170E-15  0.5497E-15



 al =  -0.40  be =   0.40


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.1677E-06  0.4369E-06    0.1750E-06  0.2307E-06
           reconstr.  0.2384E-06  0.3576E-06    0.2776E-15  0.6660E-15
            errors    0.2980E-07  0.2382E-06    0.1110E-15  0.4438E-15

 -1.0100   130   193  0.1007E-06  0.2316E-06    0.4032E-04  0.6989E-04
                      0.8941E-07  0.3567E-06    0.2220E-15  0.4441E-15
                      0.5960E-07  0.2328E-06    0.5551E-16  0.2220E-15

 -1.0400   105   136  0.1047E-06  0.2445E-06    0.3973E-01  0.8114E-01
                      0.8941E-07  0.2384E-06    0.2220E-15  0.4440E-15
                      0.1550E-05  0.2384E-05    0.1110E-15  0.4440E-15

 -1.0700    99   123  0.8133E-07  0.2052E-06    0.1440E+02  0.7672E+03
                      0.8941E-07  0.2384E-06    0.1665E-15  0.2220E-15
                      0.1209E-01  0.1724E-01    0.1665E-15  0.4440E-15

 -1.1000    96   116  0.8672E-07  0.2575E-06    0.2124E+01  0.5292E+01
                      0.8941E-07  0.2384E-06    0.1665E-15  0.2220E-15
                      0.9882E-01  0.2073E+00    0.1665E-15  0.2220E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.5685E-05  0.1539E-04    0.4136E-06  0.9652E-06
           reconstr.  0.5627E-05  0.1547E-04    0.1229E-13  0.2277E-13
            errors    0.6823E-07  0.2648E-06    0.1256E-15  0.4588E-15

  1.1625   127   186  0.1330E-05  0.2627E-05    0.2316E-02  0.3687E-02
                      0.1271E-05  0.2694E-05    0.1624E-14  0.3566E-14
                      0.8509E-07  0.2762E-06    0.1665E-15  0.5258E-15

  1.2750   109   146  0.4619E-06  0.1060E-05    0.9813E+01  0.3037E+04
                      0.4313E-06  0.1120E-05    0.1094E-14  0.2478E-14
                      0.1037E-02  0.1393E-02    0.1695E-15  0.5568E-15

  1.3875   101   129  0.2018E-06  0.5610E-06    0.2936E+01  0.6642E+02
                      0.2608E-06  0.5329E-06    0.6975E-15  0.1568E-14
                      0.5121E-02  0.7295E-02    0.1808E-15  0.5373E-15

  1.5000    97   119  0.2122E-06  0.5423E-06    0.5813E+01  0.6414E+03
                      0.2351E-06  0.5669E-06    0.3166E-15  0.7427E-15
                      0.1340E+01  0.5427E+01    0.2092E-15  0.5338E-15



 al =  -0.40  be =   0.80


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.2597E-06  0.3249E-06    0.4299E-06  0.6192E-06
           reconstr.  0.1608E-06  0.3577E-06    0.3857E-15  0.5552E-15
            errors    0.1185E-06  0.2385E-06    0.1470E-15  0.4444E-15

 -1.0100   130   193  0.1793E-06  0.2481E-06    0.9155E-04  0.1586E-03
                      0.1372E-06  0.2385E-06    0.2463E-15  0.4479E-15
                      0.8455E-07  0.1789E-06    0.1147E-15  0.3344E-15

 -1.0400   105   136  0.1413E-06  0.2183E-06    0.3997E-01  0.8179E-01
                      0.9011E-07  0.1788E-06    0.1861E-15  0.3335E-15
                      0.1159E-04  0.1764E-04    0.1977E-15  0.3381E-15

 -1.0700    99   123  0.1520E-06  0.1987E-06    0.6887E-01  0.1455E+00
                      0.7432E-07  0.1202E-06    0.1874E-15  0.4441E-15
                      0.3809E-02  0.5304E-02    0.2111E-15  0.3335E-15

 -1.1000    96   116  0.1550E-06  0.2175E-06    0.1004E+00  0.2042E+00
                      0.7078E-07  0.1788E-06    0.1328E-15  0.2223E-15
                      0.2355E+01  0.9485E+01    0.1763E-15  0.3335E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.8037E-05  0.1938E-04    0.6456E-06  0.1270E-05
           reconstr.  0.7854E-05  0.1943E-04    0.1877E-13  0.3422E-13
            errors    0.8420E-07  0.2406E-06    0.1485E-15  0.4459E-15

  1.1625   127   186  0.1547E-05  0.3106E-05    0.4189E-02  0.7083E-02
                      0.1562E-05  0.2974E-05    0.1710E-14  0.4237E-14
                      0.9677E-07  0.2663E-06    0.1963E-15  0.5290E-15

  1.2750   109   146  0.6331E-06  0.1640E-05    0.3005E+01  0.7397E+02
                      0.6476E-06  0.1631E-05    0.1017E-14  0.1986E-14
                      0.2922E-04  0.1963E-04    0.1798E-15  0.4784E-15

  1.3875   101   129  0.4519E-06  0.8163E-06    0.4588E+01  0.1566E+03
                      0.4259E-06  0.8324E-06    0.8601E-15  0.1776E-14
                      0.1595E+00  0.9122E+00    0.2122E-15  0.5438E-15

  1.5000    97   119  0.2410E-06  0.5182E-06    0.5863E+01  0.4798E+03
                      0.2337E-06  0.5085E-06    0.5290E-15  0.1252E-14
                      0.2418E+01  0.9490E+02    0.2012E-15  0.5111E-15



 al =   0.00  be =   0.00


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.2561E-06  0.8055E-06    0.2062E-06  0.8055E-06
           reconstr.  0.2086E-06  0.4766E-06    0.4441E-15  0.9992E-15
            errors    0.2980E-07  0.2384E-06    0.1110E-15  0.4440E-15

 -1.0100   130   193  0.1505E-06  0.2447E-06    0.5077E-03  0.8786E-03
                      0.1192E-06  0.2384E-06    0.2776E-15  0.4440E-15
                      0.5960E-07  0.2384E-06    0.1110E-15  0.4439E-15

 -1.0400   105   136  0.1010E-06  0.1792E-06    0.4868E+01  0.7324E+02
                      0.8941E-07  0.2384E-06    0.1665E-15  0.2220E-15
                      0.4559E-03  0.6868E-03    0.1665E-15  0.4440E-15

 -1.0700    99   123  0.6130E-07  0.1700E-06    0.3416E+01  0.3050E+02
                      0.8941E-07  0.1192E-06    0.1110E-15  0.4163E-15
                      0.6017E-01  0.1047E+00    0.1665E-15  0.4410E-15

 -1.1000    96   116  0.6680E-07  0.2381E-06    0.2422E+01  0.1058E+02
                      0.8941E-07  0.2384E-06    0.1110E-15  0.2220E-15
                      0.9864E-01  0.2074E+00    0.1665E-15  0.4436E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.2916E-05  0.5755E-05    0.4015E-06  0.7897E-06
           reconstr.  0.2881E-05  0.5753E-05    0.8342E-14  0.1325E-13
            errors    0.6902E-07  0.2763E-06    0.1322E-15  0.5255E-15

  1.1625   127   186  0.6871E-06  0.1488E-05    0.1784E-02  0.3165E-02
                      0.6462E-06  0.1537E-05    0.1429E-14  0.3167E-14
                      0.7451E-07  0.2759E-06    0.1607E-15  0.4462E-15

  1.2750   109   146  0.3816E-06  0.7193E-06    0.4939E+01  0.4155E+03
                      0.4082E-06  0.7185E-06    0.8349E-15  0.1378E-14
                      0.2249E-03  0.3527E-03    0.1684E-15  0.4783E-15

  1.3875   101   129  0.2188E-06  0.3737E-06    0.2609E+01  0.5206E+02
                      0.2231E-06  0.4329E-06    0.2947E-15  0.7178E-15
                      0.6214E-02  0.6531E-02    0.1680E-15  0.5368E-15

  1.5000    97   119  0.1204E-06  0.3013E-06    0.4150E+01  0.1983E+03
                      0.1437E-06  0.3591E-06    0.2794E-15  0.7202E-15
                      0.5566E+01  0.1541E+04    0.1746E-15  0.5361E-15



 al =   0.00  be =   0.40


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.2193E-06  0.3643E-06    0.2364E-06  0.3072E-06
           reconstr.  0.1827E-06  0.4767E-06    0.3335E-15  0.6660E-15
            errors    0.8832E-07  0.2384E-06    0.1521E-15  0.4440E-15

 -1.0100   130   193  0.2050E-06  0.2542E-06    0.6954E-03  0.1202E-02
                      0.1584E-06  0.2384E-06    0.2938E-15  0.4440E-15
                      0.1186E-06  0.2384E-06    0.1954E-15  0.4282E-15

 -1.0400   105   136  0.1549E-06  0.1905E-06    0.6908E+01  0.1609E+03
                      0.9883E-07  0.1265E-06    0.1838E-15  0.2220E-15
                      0.4224E-03  0.6363E-03    0.1930E-15  0.2220E-15

 -1.0700    99   123  0.1525E-06  0.2243E-06    0.1954E+02  0.1442E+04
                      0.9511E-07  0.1192E-06    0.1509E-15  0.2356E-15
                      0.2074E+01  0.4525E+01    0.2211E-15  0.4440E-15

 -1.1000    96   116  0.1386E-06  0.2532E-06    0.9943E-01  0.2048E+00
                      0.7440E-07  0.1265E-06    0.1255E-15  0.2220E-15
                      0.1745E+00  0.1691E+00    0.2171E-15  0.2220E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.3495E-05  0.6532E-05    0.4029E-06  0.1102E-05
           reconstr.  0.3535E-05  0.6435E-05    0.9339E-14  0.1992E-13
            errors    0.7009E-07  0.2508E-06    0.1362E-15  0.4695E-15

  1.1625   127   186  0.7673E-06  0.1724E-05    0.1725E-02  0.3418E-02
                      0.8026E-06  0.1647E-05    0.1211E-14  0.2298E-14
                      0.9110E-07  0.2697E-06    0.1668E-15  0.4674E-15

  1.2750   109   146  0.3634E-06  0.7652E-06    0.7051E+01  0.4945E+03
                      0.3258E-06  0.7681E-06    0.6718E-15  0.1351E-14
                      0.9211E-04  0.8405E-04    0.1923E-15  0.5014E-15

  1.3875   101   129  0.1695E-06  0.4707E-06    0.2787E+01  0.4509E+02
                      0.1799E-06  0.4072E-06    0.3731E-15  0.8584E-15
                      0.1789E+00  0.7867E-01    0.1918E-15  0.5008E-15

  1.5000    97   119  0.1610E-06  0.4007E-06    0.1521E+02  0.7879E+04
                      0.1583E-06  0.3446E-06    0.2985E-15  0.7237E-15
                      0.2524E+01  0.2037E+03    0.2110E-15  0.5037E-15



 al =   0.00  be =   0.80


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.1735E-06  0.3410E-06    0.7749E-06  0.1330E-05
           reconstr.  0.1844E-06  0.2980E-06    0.3091E-15  0.4442E-15
            errors    0.1061E-06  0.1789E-06    0.1518E-15  0.3335E-15

 -1.0100   130   193  0.1436E-06  0.3161E-06    0.1732E-02  0.3044E-02
                      0.1441E-06  0.1789E-06    0.2128E-15  0.4447E-15
                      0.1042E-06  0.1789E-06    0.1509E-15  0.3332E-15

 -1.0400   105   136  0.1339E-06  0.3349E-06    0.3240E+01  0.2696E+02
                      0.9653E-07  0.2385E-06    0.1742E-15  0.3331E-15
                      0.2340E-03  0.3531E-03    0.2567E-15  0.3333E-15

 -1.0700    99   123  0.1133E-06  0.1932E-06    0.7026E-01  0.1413E+00
                      0.6694E-07  0.1788E-06    0.1933E-15  0.3331E-15
                      0.5441E-03  0.7488E-03    0.1947E-15  0.3339E-15

 -1.1000    96   116  0.1214E-06  0.2266E-06    0.9821E-01  0.2100E+00
                      0.8660E-07  0.1193E-06    0.1202E-15  0.3332E-15
                      0.8857E+00  0.4786E+00    0.2275E-15  0.3333E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.4176E-05  0.8802E-05    0.5414E-06  0.1155E-05
           reconstr.  0.4179E-05  0.8838E-05    0.7735E-14  0.1502E-13
            errors    0.7350E-07  0.2461E-06    0.1297E-15  0.4806E-15

  1.1625   127   186  0.6526E-06  0.1309E-05    0.1923E-02  0.3463E-02
                      0.6734E-06  0.1246E-05    0.1730E-14  0.3397E-14
                      0.9188E-07  0.2800E-06    0.1747E-15  0.5106E-15

  1.2750   109   146  0.3073E-06  0.7256E-06    0.2320E+01  0.2423E+02
                      0.3007E-06  0.7699E-06    0.9139E-15  0.2082E-14
                      0.1742E-04  0.3170E-04    0.1975E-15  0.5039E-15

  1.3875   101   129  0.1720E-06  0.4473E-06    0.2347E+01  0.2888E+02
                      0.1639E-06  0.3881E-06    0.4836E-15  0.9635E-15
                      0.6440E-02  0.9185E-02    0.1937E-15  0.5221E-15

  1.5000    97   119  0.1715E-06  0.3960E-06    0.2160E+01  0.2513E+02
                      0.1755E-06  0.3856E-06    0.3072E-15  0.7202E-15
                      0.1383E+01  0.1173E+02    0.1951E-15  0.5399E-15



 al =   0.40  be =   0.40


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.2819E-06  0.6788E-06    0.2421E-06  0.6788E-06
           reconstr.  0.2086E-06  0.4766E-06    0.3886E-15  0.4441E-15
            errors    0.2980E-07  0.2384E-06    0.1110E-15  0.4440E-15

 -1.0100   130   193  0.1128E-06  0.2395E-06    0.1450E-03  0.2522E-03
                      0.8941E-07  0.2365E-06    0.2776E-15  0.4440E-15
                      0.8941E-07  0.2384E-06    0.1110E-15  0.4427E-15

 -1.0400   105   136  0.1274E-06  0.2889E-06    0.6984E+01  0.1649E+03
                      0.1192E-06  0.1192E-06    0.1665E-15  0.2220E-15
                      0.6663E-03  0.1008E-02    0.1110E-15  0.4406E-15

 -1.0700    99   123  0.8626E-07  0.2553E-06    0.2484E+01  0.1198E+02
                      0.8941E-07  0.1192E-06    0.1110E-15  0.2220E-15
                      0.4792E+00  0.3508E+00    0.1665E-15  0.4438E-15

 -1.1000    96   116  0.7536E-07  0.2603E-06    0.2103E+01  0.4507E+01
                      0.5960E-07  0.1192E-06    0.1110E-15  0.2220E-15
                      0.9925E-01  0.1911E+00    0.1665E-15  0.4440E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.1946E-05  0.4030E-05    0.4345E-06  0.9018E-06
           reconstr.  0.1928E-05  0.4067E-05    0.4736E-14  0.1054E-13
            errors    0.6666E-07  0.2440E-06    0.1220E-15  0.4785E-15

  1.1625   127   186  0.3932E-06  0.9289E-06    0.1775E-02  0.3627E-02
                      0.4117E-06  0.9448E-06    0.1292E-14  0.2544E-14
                      0.8862E-07  0.2572E-06    0.1468E-15  0.4557E-15

  1.2750   109   146  0.1807E-06  0.5067E-06    0.4115E+01  0.1659E+03
                      0.2174E-06  0.4619E-06    0.5708E-15  0.1108E-14
                      0.1365E-03  0.1772E-03    0.1687E-15  0.5255E-15

  1.3875   101   129  0.1648E-06  0.3586E-06    0.4194E+01  0.1399E+03
                      0.1780E-06  0.4151E-06    0.3250E-15  0.7900E-15
                      0.3014E-01  0.4424E-01    0.1779E-15  0.5254E-15

  1.5000    97   119  0.1244E-06  0.3188E-06    0.6650E+01  0.8327E+03
                      0.1339E-06  0.3256E-06    0.2699E-15  0.6190E-15
                      0.1748E+01  0.5624E+02    0.1855E-15  0.5258E-15



 al =   0.40  be =   0.80


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.1951E-06  0.3374E-06    0.4973E-06  0.9095E-06
           reconstr.  0.1187E-06  0.2982E-06    0.3480E-15  0.6668E-15
            errors    0.8772E-07  0.1789E-06    0.1574E-15  0.3335E-15

 -1.0100   130   193  0.1704E-06  0.4211E-06    0.3387E-02  0.6033E-02
                      0.1605E-06  0.2387E-06    0.1795E-15  0.3331E-15
                      0.8987E-07  0.2401E-06    0.1456E-15  0.3370E-15

 -1.0400   105   136  0.1907E-06  0.3063E-06    0.3991E-01  0.8183E-01
                      0.7373E-07  0.1830E-06    0.1818E-15  0.3332E-15
                      0.5895E-05  0.8703E-05    0.1827E-15  0.3408E-15

 -1.0700    99   123  0.1764E-06  0.2346E-06    0.7006E-01  0.1432E+00
                      0.6886E-07  0.1194E-06    0.1318E-15  0.2222E-15
                      0.1152E-02  0.1593E-02    0.2000E-15  0.2224E-15

 -1.1000    96   116  0.1723E-06  0.2914E-06    0.1306E+02  0.6241E+03
                      0.7288E-07  0.1196E-06    0.1375E-15  0.3332E-15
                      0.9995E-01  0.2049E+00    0.1823E-15  0.3331E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.2593E-05  0.4992E-05    0.4152E-06  0.1056E-05
           reconstr.  0.2583E-05  0.4939E-05    0.5371E-14  0.1174E-13
            errors    0.7578E-07  0.2485E-06    0.1280E-15  0.4768E-15

  1.1625   127   186  0.4379E-06  0.9910E-06    0.2059E-02  0.3639E-02
                      0.4428E-06  0.9955E-06    0.1002E-14  0.2168E-14
                      0.8810E-07  0.2854E-06    0.1728E-15  0.4887E-15

  1.2750   109   146  0.2712E-06  0.6950E-06    0.4403E+01  0.1052E+03
                      0.2588E-06  0.6291E-06    0.5571E-15  0.1179E-14
                      0.1152E-03  0.1653E-03    0.1727E-15  0.5486E-15

  1.3875   101   129  0.2156E-06  0.5433E-06    0.3003E+01  0.6994E+02
                      0.2057E-06  0.4380E-06    0.3185E-15  0.7546E-15
                      0.2538E-01  0.2050E-01    0.1891E-15  0.5094E-15

  1.5000    97   119  0.1555E-06  0.4031E-06    0.5084E+01  0.7406E+03
                      0.1335E-06  0.3315E-06    0.3114E-15  0.6587E-15
                      0.1310E+01  0.1233E+02    0.2115E-15  0.5384E-15



 al =   0.80  be =   0.80


                              gchri                    chri
     x     nu0  nud0    erra        errb          erra       errb


 -1.0010   240   439  0.1289E-06  0.1986E-06    0.6080E-06  0.1028E-05
           reconstr.  0.1192E-06  0.2982E-06    0.2776E-15  0.6670E-15
            errors    0.2980E-07  0.1792E-06    0.5551E-16  0.3342E-15

 -1.0100   130   193  0.1180E-06  0.1683E-06    0.1135E-02  0.1986E-02
                      0.5960E-07  0.1803E-06    0.2220E-15  0.3335E-15
                      0.5960E-07  0.1800E-06    0.5551E-16  0.4493E-15

 -1.0400   105   136  0.8218E-07  0.1771E-06    0.3389E+01  0.3034E+02
                      0.8941E-07  0.1790E-06    0.1110E-15  0.3389E-15
                      0.1520E-04  0.2283E-04    0.1110E-15  0.3338E-15

 -1.0700    99   123  0.9163E-07  0.1358E-06    0.2185E+01  0.7034E+01
                      0.5960E-07  0.1789E-06    0.1110E-15  0.2230E-15
                      0.5248E+00  0.3699E+00    0.1665E-15  0.2259E-15

 -1.1000    96   116  0.7408E-07  0.1564E-06    0.2883E+01  0.1881E+02
                      0.5960E-07  0.1789E-06    0.1110E-15  0.2259E-15
                      0.2176E+01  0.6419E+01    0.1665E-15  0.4445E-15


                              gchri                    chri
    rho    nu0  nud0    erra        errb          erra       errb


  1.0500   226   409  0.1767E-05  0.3868E-05    0.4543E-06  0.1043E-05
           reconstr.  0.1762E-05  0.3843E-05    0.3980E-14  0.8449E-14
            errors    0.6902E-07  0.2630E-06    0.1169E-15  0.4485E-15

  1.1625   127   186  0.4433E-06  0.8477E-06    0.2390E-02  0.5566E-02
                      0.4404E-06  0.8573E-06    0.7450E-15  0.1476E-14
                      0.8156E-07  0.2560E-06    0.1680E-15  0.5255E-15

  1.2750   109   146  0.1919E-06  0.4108E-06    0.3447E+02  0.3360E+05
                      0.1927E-06  0.4288E-06    0.4346E-15  0.9947E-15
                      0.5482E-01  0.5903E-01    0.1676E-15  0.5020E-15

  1.3875   101   129  0.1324E-06  0.3254E-06    0.5517E+01  0.1918E+03
                      0.1429E-06  0.3925E-06    0.2589E-15  0.6328E-15
                      0.3578E-01  0.4241E-01    0.1731E-15  0.4691E-15

  1.5000    97   119  0.1201E-06  0.2831E-06    0.2453E+01  0.3077E+02
                      0.1312E-06  0.3117E-06    0.2597E-15  0.6858E-15
                      0.1696E+01  0.2069E+02    0.1892E-15  0.5201E-15


C-END-OF-FILE

##################################
#                                #
# 2. CLASSICAL WEIGHT FUNCTIONS  #
#                                #
##################################

cat <<C-END-OF-FILE > recur.f
c
c
      subroutine recur(n,ipoly,al,be,a,b,ierr)
c
c This subroutine generates the coefficients  a(k),b(k), k=0,1,...,n-1,
c in the recurrence relation
c
c       p(k+1)(x)=(x-a(k))*p(k)(x)-b(k)*p(k-1)(x),
c                            k=0,1,...,n-1,
c
c       p(-1)(x)=0,  p(0)(x)=1,
c
c for some classical (monic) orthogonal polynomials, and sets  b(0)
c equal to the total mass of the weight distribution. The results are
c stored in the arrays  a,b,  which hold, respectively, the coefficients
c a(k-1),b(k-1), k=1,2,...,n.
c
c       Input:  n - - the number of recursion coefficients desired
c               ipoly-integer identifying the polynomial as follows:
c                     1=Legendre polynomial on (-1,1)
c                     2=Legendre polynomial on (0,1)
c                     3=Chebyshev polynomial of the first kind
c                     4=Chebyshev polynomial of the second kind
c                     5=Jacobi polynomial with parameters  al=-.5,be=.5
c                     6=Jacobi polynomial with parameters  al,be
c                     7=generalized Laguerre polynomial with
c                       parameter  al
c                     8=Hermite polynomial
c               al,be-input parameters for Jacobi and generalized
c                     Laguerre polynomials
c
c       Output: a,b - arrays containing, respectively, the recursion
c                     coefficients  a(k-1),b(k-1), k=1,2,...,n.
c               ierr -an error flag, equal to  0  on normal return, 
c                     equal to  1  if  al  or  be  are out of range 
c                     when  ipoly=6  or  ipoly=7, equal to  2  if  b(0) 
c                     overflows when  ipoly=6  or  ipoly=7, equal to  3 
c                     if  n  is out of range, and equal to  4  if  ipoly
c                     is not an admissible integer. In the case  ierr=2,
c                     the coefficient  b(0)  is set equal to the largest
c                     machine-representable number.
c
c The subroutine calls for the function subroutines  r1mach,gamma  and 
c alga. The routines  gamma  and  alga , which are included in this
c file, evaluate respectively the gamma function and its logarithm for
c positive arguments. They are used only in the cases  ipoly=6  and 
c ipoly=7.
c
      external gamma
      dimension a(n),b(n)
      if(n.lt.1) then
        ierr=3
        return
      end if
      almach=alog(r1mach(2))
      ierr=0
      do 10 k=1,n
        a(k)=0.
   10 continue
      if(ipoly.eq.1) then
        b(1)=2.
        if (n.eq.1) return
        do 20 k=2,n
          fkm1=real(k-1)
          b(k)=1./(4.-1./(fkm1*fkm1))
   20   continue
        return
      else if (ipoly.eq.2) then
        a(1)=.5
        b(1)=1.
        if(n.eq.1) return
        do 30 k=2,n
          a(k)=.5
          fkm1=real(k-1)
          b(k)=.25/(4.-1./(fkm1*fkm1))
   30   continue
        return
      else if(ipoly.eq.3) then
        b(1)=4.*atan(1.)
        if(n.eq.1) return
        b(2)=.5
        if(n.eq.2) return
        do 40 k=3,n
          b(k)=.25
   40   continue
        return
      else if(ipoly.eq.4) then
        b(1)=2.*atan(1.)
        if(n.eq.1) return
        do 50 k=2,n
          b(k)=.25
   50   continue
        return
      else if(ipoly.eq.5) then
        b(1)=4.*atan(1.)
        a(1)=.5
        if(n.eq.1) return
        do 60 k=2,n
          b(k)=.25
   60   continue
        return
      else if(ipoly.eq.6) then
        if(al.le.-1. .or. be.le.-1.) then
          ierr=1
          return
        else
          alpbe=al+be
          a(1)=(be-al)/(alpbe+2.)
          t=(alpbe+1.)*alog(2.)+alga(al+1.)+alga(be+1.)-
     *      alga(alpbe+2.)
          if(t.gt.almach) then
            ierr=2
            b(1)=r1mach(2)
          else
            b(1)=exp(t)
          end if
          if(n.eq.1) return
          al2=al*al
          be2=be*be
          a(2)=(be2-al2)/((alpbe+2.)*(alpbe+4.))
          b(2)=4.*(al+1.)*(be+1.)/((alpbe+3.)*(alpbe+2.)**2)
          if(n.eq.2) return
          do 70 k=3,n
            fkm1=real(k-1)
            a(k)=.25*(be2-al2)/(fkm1*fkm1*(1.+.5*alpbe/fkm1)*
     *        (1.+.5*(alpbe+2.)/fkm1))
            b(k)=.25*(1.+al/fkm1)*(1.+be/fkm1)*(1.+alpbe/fkm1)/
     *      ((1.+.5*(alpbe+1.)/fkm1)*(1.+.5*(alpbe-1.)/fkm1)
     *      *(1.+.5*alpbe/fkm1)**2)
   70     continue
          return
        end if
      else if(ipoly.eq.7) then
        if(al.le.-1.) then
          ierr=1
          return
        else
          a(1)=al+1.
          b(1)=gamma(al+1.,ierr)
          if(ierr.eq.2) b(1)=r1mach(2)
          if(n.eq.1) return
          do 80 k=2,n
            fkm1=real(k-1)
            a(k)=2.*fkm1+al+1.
            b(k)=fkm1*(fkm1+al)
   80     continue
          return
        end if
      else if(ipoly.eq.8) then
        b(1)=sqrt(4.*atan(1.))
        if(n.eq.1) return
        do 90 k=2,n
          b(k)=.5*real(k-1)
   90   continue
        return
      else
        ierr=4
      end if
      end

      function alga(x)
c 
c This is an auxiliary function subroutine (not optimized in any
c sense) evaluating the logarithm of the gamma function for positive
c arguments  x. It is called by the subroutine  gamma. The integer  m0 
c in the first executable statement is the smallest integer  m  such 
c that  1*3*5* ... *(2*m+1)/(2**m)  is greater than or equal to the 
c largest machine-representable number. The routine is based on a 
c rational approximation valid on [.5,1.5] due to W.J. Cody and 
c K.E. Hillstrom; see Math. Comp. 21, 1967, 198-203, in particular the 
c case  n=7  in Table II. For the computation of  m0  it calls upon the 
c function subroutines  t  and  r1mach. The former, appended below,
c evaluates the inverse function  t = t(y)  of  y = t ln t.
c 
      dimension cnum(8),cden(8) 
      data cnum/4.120843185847770,85.68982062831317,243.175243524421, 
     *-261.7218583856145,-922.2613728801522,-517.6383498023218, 
     *-77.41064071332953,-2.208843997216182/, 
     *cden/1.,45.64677187585908,377.8372484823942,951.323597679706, 
     *846.0755362020782,262.3083470269460,24.43519662506312,
     *.4097792921092615/
c
c The constants in the statement below are  exp(1.)  and  .5*alog(8.).
c
      m0=2.71828*t((alog(r1mach(2))-1.03972)/2.71828)
      xi=aint(x)
      if(x-xi.gt..5) xi=xi+1. 
      m=ifix(xi)-1
c
c Computation of log gamma on the standard interval (1/2,3/2]
c
      xe=x-real(m)
      snum=cnum(1)
      sden=cden(1)
      do 10 k=2,8 
        snum=xe*snum+cnum(k)
        sden=xe*sden+cden(k)
   10 continue
      alga=(xe-1.)*snum/sden
c
c Computation of log gamma on (0,1/2]
c
      if(m.eq.-1) then
        alga=alga-alog(x)
        return
      else if(m.eq.0) then
        return
      else
c
c Computation of log gamma on (3/2,5/2]
c
        p=xe
        if(m.eq.1) then
          alga=alga+alog(p)
          return
        else
c
c Computation of log gamma for arguments larger than 5/2
c
          mm1=m-1 
c
c The else-clause in the next statement is designed to avoid possible
c overflow in the computation of  p  in the if-clause, at the expense 
c of computing many logarithms.
c
          if(m.lt.m0) then
            do 20 k=1,mm1 
              p=(xe+real(k))*p 
   20       continue
            alga=alga+alog(p) 
            return
          else
            alga=alga+alog(xe)
            do 30 k=1,mm1 
              alga=alga+alog(xe+real(k)) 
   30       continue
            return
          end if
        end if
      end if
      end

      function gamma(x,ierr)
c
c This evaluates the gamma function for real positive  x, using the
c function subroutines  alga  and  r1mach. In case of overflow, the
c routine returns the largest machine-representable number and the 
c error flag  ierr=2.
c
      almach=alog(r1mach(2))
      ierr=0
      t=alga(x)
      if(t.ge.almach) then
        ierr=2
        gamma=r1mach(2)
        return
      else
        gamma=exp(t)
        return
      end if
      end

      function t(y)
c
c This evaluates the inverse function  t = t(y)  of y = t ln t  for
c nonnegative  y  to an accuracy of about one percent. For the
c approximation used, see pp. 51-52 in W. Gautschi,``Computational
c aspects of three-term recurrence relations'', SIAM Rev. 9, 1967,
c 24-82.
c
      if(y.le.10.) then
        p=.000057941*y-.00176148
        p=y*p+.0208645
        p=y*p-.129013
        p=y*p+.85777
        t=y*p+1.0125
      else
        z=alog(y)-.775
        p=(.775-alog(z))/(1.+z)
        p=1./(1.+p)
        t=y*p/z
      end if
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > drecur.f
c
c
      subroutine drecur(n,ipoly,dal,dbe,da,db,iderr)
c
c This is a double-precision version of the routine  recur.
c
      external dgamma
      double precision dal,dbe,da,db,dlmach,d1mach,dkm1,dalpbe,dt,
     *dlga,dal2,dbe2,dgamma
      dimension da(n),db(n)
      if(n.lt.1) then
        iderr=3
        return
      end if
      dlmach=dlog(d1mach(2))
      iderr=0
      do 10 k=1,n
        da(k)=0.d0
   10 continue
      if(ipoly.eq.1) then
        db(1)=2.d0
        if (n.eq.1) return
        do 20 k=2,n
          dkm1=dble(k-1)
          db(k)=1.d0/(4.d0-1.d0/(dkm1*dkm1))
   20   continue
        return
      else if(ipoly.eq.2) then
        da(1)=.5d0
        db(1)=1.d0
        if(n.eq.1) return
        do 30 k=2,n
          da(k)=.5d0
          dkm1=dble(k-1)
          db(k)=.25d0/(4.d0-1.d0/(dkm1*dkm1))
   30   continue
        return
      else if(ipoly.eq.3) then
        db(1)=4.d0*datan(1.d0)
        if(n.eq.1) return
        db(2)=.5d0
        if(n.eq.2) return
        do 40 k=3,n
          db(k)=.25d0
   40   continue
        return
      else if(ipoly.eq.4) then
        db(1)=2.d0*datan(1.d0)
        if(n.eq.1) return
        do 50 k=2,n
          db(k)=.25d0
   50   continue
        return
      else if(ipoly.eq.5) then
        db(1)=4.d0*datan(1.d0)
        da(1)=.5d0
        if(n.eq.1) return
        do 60 k=2,n
          db(k)=.25d0
   60   continue
        return
      else if(ipoly.eq.6) then
        if(dal.le.-1.d0 .or. dbe.le.-1.d0) then
          iderr=1
          return
        else
          dalpbe=dal+dbe
          da(1)=(dbe-dal)/(dalpbe+2.d0)
          dt=(dalpbe+1.d0)*dlog(2.d0)+dlga(dal+1.d0)+dlga(dbe+1.d0)-
     *      dlga(dalpbe+2.d0)
          if(dt.gt.dlmach) then
            iderr=2
            db(1)=d1mach(2)
          else
            db(1)=dexp(dt)
          end if
          if(n.eq.1) return
          dal2=dal*dal
          dbe2=dbe*dbe
          da(2)=(dbe2-dal2)/((dalpbe+2.d0)*(dalpbe+4.d0))
          db(2)=4.d0*(dal+1.d0)*(dbe+1.d0)/((dalpbe+3.d0)*(dalpbe+
     *      2.d0)**2)
          if(n.eq.2) return
          do 70 k=3,n
            dkm1=dble(k-1)
            da(k)=.25d0*(dbe2-dal2)/(dkm1*dkm1*(1.d0+.5d0*dalpbe/dkm1)
     *        *(1.d0+.5d0*(dalpbe+2.d0)/dkm1))
            db(k)=.25d0*(1.d0+dal/dkm1)*(1.d0+dbe/dkm1)*(1.d0+dalpbe/
     *        dkm1)/((1.d0+.5d0*(dalpbe+1.d0)/dkm1)*(1.d0+.5d0*(dalpbe
     *      -1.d0)/dkm1)*(1.d0+.5d0*dalpbe/dkm1)**2)
   70     continue
          return
        end if
      else if(ipoly.eq.7) then
        if(dal.le.-1.d0) then
          iderr=1
          return
        else
          da(1)=dal+1.d0
          db(1)=dgamma(dal+1.d0,iderr)
          if(iderr.eq.2) db(1)=d1mach(2)
          if(n.eq.1) return
          do 80 k=2,n
            dkm1=dble(k-1)
            da(k)=2.d0*dkm1+dal+1.d0
            db(k)=dkm1*(dkm1+dal)
   80     continue
          return
        end if
      else if(ipoly.eq.8) then
        db(1)=dsqrt(4.d0*datan(1.d0))
        if(n.eq.1) return
        do 90 k=2,n
          db(k)=.5d0*dble(k-1)
   90   continue
        return
      else
        iderr=4
      end if
      end

      double precision function dlga(dx)
      double precision dbnum,dbden,dx,d1mach,dc,dp,dy,dt,ds
      dimension dbnum(8),dbden(8)
c 
c This routine evaluates the logarithm of the gamma function by a
c combination of recurrence and asymptotic approximation.
c
c The entries in the next data statement are the numerators and
c denominators, respectively, of the quantities B[16]/(16*15),
c B[14]/(14*13),..., B[2]/(2*1), where B[2n] are the Bernoulli
c numbers.
c
      data dbnum/-3.617d3,1.d0,-6.91d2,1.d0,-1.d0,1.d0,-1.d0,1.d0/,
     *     dbden/1.224d5,1.56d2,3.6036d5,1.188d3,1.68d3,1.26d3,3.6d2,
     *1.2d1/
c
c The quantity  dprec  in the next statement is the number of decimal
c digits carried in double-precision floating-point arithmetic.
c
      dprec=-alog10(sngl(d1mach(3)))
      dc=.5d0*dlog(8.d0*datan(1.d0))
      dp=1.d0
      dy=dx
      y=sngl(dy)
c
c The quantity  y0  below is the threshold value beyond which asymptotic
c evaluation gives sufficient accuracy; see Eq. 6.1.42 in M. Abramowitz
c and I.A. Stegun,``Handbook of Mathematical Functions''. The constants 
c are .12118868... = ln(10)/19 and .05390522... = ln(|B[20]|/190)/19.
c
      y0=exp(.121189*dprec+.053905)
   10 if(y.gt.y0) goto 20
      dp=dy*dp
      dy=dy+1.d0
      y=sngl(dy)
      goto 10
   20 dt=1.d0/(dy*dy)
c
c The right-hand side of the next assignment statement is B[18]/(18*17).
c
      ds=4.3867d4/2.44188d5
      do 30 i=1,8
        ds=dt*ds+dbnum(i)/dbden(i)
   30 continue
      dlga=(dy-.5d0)*dlog(dy)-dy+dc+ds/dy-dlog(dp)
      return
      end

      double precision function dgamma(dx,iderr)
c
c This evaluates the gamma function for real positive  dx, using the
c function subroutine  dlga.
c
      double precision dx,dlmach,d1mach,dt,dlga
      dlmach=dlog(d1mach(2))
      iderr=0
      dt=dlga(dx)
      if(dt.ge.dlmach) then
        iderr=2
        dgamma=d1mach(2)
        return
      else
        dgamma=dexp(dt)
        return
      end if
      end

C-END-OF-FILE

##############################
#                            #
# 3. MOMENT-RELATED METHODS  #
#                            #
##############################

cat <<C-END-OF-FILE > cheb.f
c
c
      subroutine cheb(n,a,b,fnu,alpha,beta,s,ierr,s0,s1,s2)
c
c Given a set of polynomials  p(0),p(1),...,p(2*n-1)  satisfying
c
c        p(k+1)(x)=(x-a(k))*p(k)(x)-b(k)*p(k-1)(x),
c                        k=0,1,...,2*n-2,
c
c        p(-1)(x)=0,  p(0)(x)=1,
c
c and associated modified moments
c
c           fnu(k)=integral of p(k)(x)*dlambda(x),
c                        k=0,1,...,2*n-1,
c
c this subroutine uses the modified Chebyshev algorithm (see, e.g.,
c Section 2.4 of W. Gautschi,``On generating orthogonal polynomials'',
c SIAM J. Sci. Statist. Comput. 3, 1982, 289-317) to generate the
c recursion coefficients  alpha(k),beta(k), k=0,1,...,n-1, for the
c polynomials  pi(k)  orthogonal with respect to the integration
c measure  dlambda(x), i.e.,
c
c        pi(k+1)(x)=(x-alpha(k))*pi(k)(x)-beta(k)*pi(k-1)(x),
c                          k=0,1,...,n-1,
c
c        pi(-1)(x)=0,  pi(0)(x)=1.
c
c     Input:    n - - the number of recursion coefficients desired
c               a,b-- arrays of dimension 2*n-1 to be filled with the
c                     values of  a(k-1),b(k-1), k=1,2,...,2*n-1
c               fnu-- array of dimension  2*n  to be filled with the 
c                     values of the modified moments  fnu(k-1), k=1,2,
c                     ...,2*n
c     Output:   alpha,beta-- arrays containing, respectively, the
c                     recursion coefficients  alpha(k-1),beta(k-1),
c                     k=1,2,...,n, where  beta(0)  is the total mass.
c               s - - array containing the normalization factors
c                     s(k)=integral [pi(k)(x)]**2 dlambda(x), k=0,1,
c                     2,...,n-1.
c               ierr- an error flag, equal to  0  on normal return, 
c                     equal to  1  if  abs(fnu(0))  is less than the 
c                     machine zero, equal to  2  if  n  is out of range,
c                     equal to  -k  if  s(k), k=0,1,2,...,n-1, is about 
c                     to underflow, and equal to  +k  if it is about to 
c                     overflow.
c
c The arrays  s0,s1,s2  are needed for working space.
c
c On machines with limited exponent range, the occurrence of underflow
c [overflow] in the computation of the  alpha's  and  beta's  can often 
c be avoided by multiplying all modified moments by a sufficiently large
c [small] scaling factor and dividing the new  beta(0)  by the same 
c scaling factor.
c
c The routine uses the function subroutine  r1mach.
c
      dimension a(*),b(*),fnu(*),alpha(n),beta(n),s(n),s0(*),s1(*),
     *s2(*)
c
c The arrays  a,b  are assumed to have dimension  2*n-1, the arrays
c fnu,s0,s1,s2  dimension  2*n.
c
      nd=2*n
      tiny=10.*r1mach(1)
      huge=.1*r1mach(2)
      ierr=0
      if(abs(fnu(1)).lt.tiny) then
        ierr=1
        return
      end if
      if(n.lt.1) then
        ierr=2
        return
      end if
c
c Initialization
c
      alpha(1)=a(1)+fnu(2)/fnu(1)
      beta(1)=fnu(1)
      if(n.eq.1) return
      s(1)=fnu(1)
      do 10 l=1,nd
        s0(l)=0.
        s1(l)=fnu(l)
   10 continue
c
c Continuation
c
      do 40 k=2,n
        lk=nd-k+1
        do 20 l=k,lk
c
c The quantities  s2(l)  for l > k are auxiliary quantities which may
c be zero or may become so small as to underflow, without however
c causing any harm.
c
          s2(l)=s1(l+1)-(alpha(k-1)-a(l))*s1(l)-beta(k-1)*s0(l)
     *      +b(l)*s1(l-1)
          if(l.eq.k) s(k)=s2(k)
c
c Check impending underflow or overflow
c
          if(abs(s(k)).lt.tiny) then
            ierr=-(k-1)
            return
          else if(abs(s(k)).gt.huge) then
            ierr=k-1
            return
          end if
   20   continue
c
c Compute the alpha- and beta-coefficient
c
        alpha(k)=a(k)+(s2(k+1)/s2(k))-(s1(k)/s1(k-1))
        beta(k)=s2(k)/s1(k-1)
        do 30 l=k,lk
          s0(l)=s1(l)
          s1(l)=s2(l)
   30   continue
   40 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dcheb.f
c
c
      subroutine dcheb(n,da,db,dnu,dalpha,dbeta,ds,iderr,ds0,ds1,ds2)
c
c This is a double-precision version of the routine  cheb.
c
      double precision da,db,dnu,dalpha,dbeta,ds,ds0,ds1,ds2,dtiny,
     *d1mach,dhuge
      dimension da(*),db(*),dnu(*),dalpha(n),dbeta(n),ds(n),
     *ds0(*),ds1(*),ds2(*)
c
c The arrays  da,db  are assumed to have dimension  2*n-1, the arrays
c dnu,ds0,ds1,ds2  dimension  2*n.
c
      nd=2*n
      dtiny=10.d0*d1mach(1)
      dhuge=.1d0*d1mach(2)
      iderr=0
      if(dabs(dnu(1)).lt.dtiny) then
        iderr=1
        return
      end if
      if(n.lt.1) then
        iderr=2
        return
      end if
      dalpha(1)=da(1)+dnu(2)/dnu(1)
      dbeta(1)=dnu(1)
      if(n.eq.1) return
      ds(1)=dnu(1)
      do 10 l=1,nd
        ds0(l)=0.d0
        ds1(l)=dnu(l)
   10 continue
      do 40 k=2,n
        lk=nd-k+1
        do 20 l=k,lk
          ds2(l)=ds1(l+1)-(dalpha(k-1)-da(l))*ds1(l)-dbeta(k-1)*ds0(l)
     *      +db(l)*ds1(l-1)
        if(l.eq.k) ds(k)=ds2(k)
   20   continue
        if(dabs(ds(k)).lt.dtiny) then
          iderr=-(k-1)
          return
        else if(dabs(ds(k)).gt.dhuge) then
          iderr=k-1
          return
        end if
        dalpha(k)=da(k)+(ds2(k+1)/ds2(k))-(ds1(k)/ds1(k-1))
        dbeta(k)=ds2(k)/ds1(k-1)
        do 30 l=k,lk
          ds0(l)=ds1(l)
          ds1(l)=ds2(l)
   30   continue
   40 continue
      return
      end

C-END-OF-FILE

######################################################################
#                                                                    #
# 4. STIELTJES, ORTHOGONAL REDUCTION, AND DISCRETIZATION PROCEDURES  #
#                                                                    #
######################################################################

cat <<C-END-OF-FILE > sti.f
c
c
      subroutine sti(n,ncap,x,w,alpha,beta,ierr,p0,p1,p2)
c
c This routine applies ``Stieltjes's procedure'' (cf. Section 2.1 of
c W. Gautschi,``On generating orthogonal polynomials'', SIAM J. Sci.
c Statist. Comput. 3, 1982, 289-317) to generate the recursion
c coefficients  alpha(k), beta(k) , k=0,1,...,n-1, for the discrete
c (monic) orthogonal polynomials associated with the inner product
c
c     (f,g)=sum over k from 1 to ncap of w(k)*f(x(k))*g(x(k)).
c
c The integer  n  must be between  1  and  ncap, inclusive; otherwise,
c there is an error exit with  ierr=1. The results are stored in the
c arrays  alpha, beta; the arrays  p0, p1, p2  are working arrays.
c
c If there is a threat of underflow or overflow in the calculation
c of the coefficients  alpha(k)  and  beta(k), the routine exits with
c the error flag  ierr  set equal to  -k  (in the case of underflow) 
c or  +k  (in the case of overflow), where  k  is the recursion index 
c for which the problem occurs. The former [latter] can often be avoided
c by multiplying all weights  w(k)  by a sufficiently large [small]
c scaling factor prior to entering the routine, and, upon exit, divide
c the coefficient  beta(0)  by the same factor.
c
c This routine should be used with caution if  n  is relatively close 
c to  ncap, since there is a distinct possibility of numerical 
c instability developing. (See W. Gautschi,``Is the recurrence relation 
c for orthogonal polynomials always stable?'', BIT, 1993, to appear.) 
c In that case, the routine  lancz  should be used.
c
c The routine uses the function subroutine  r1mach.
c
      dimension x(ncap),w(ncap),alpha(n),beta(n),p0(ncap),p1(ncap),
     *p2(ncap)
      tiny=10.*r1mach(1)
      huge=.1*r1mach(2)
      ierr=0
      if(n.le.0 .or. n.gt.ncap) then
        ierr=1
        return
      end if
      nm1=n-1
c
c Compute the first alpha- and beta-coefficient.
c
      sum0=0.
      sum1=0.
      do 10 m=1,ncap
        sum0=sum0+w(m)
        sum1=sum1+w(m)*x(m)
   10 continue
      alpha(1)=sum1/sum0
      beta(1)=sum0
      if(n.eq.1) return
c
c Compute the remaining alpha- and beta-coefficients.
c
      do 20 m=1,ncap
        p1(m)=0.
        p2(m)=1.
   20 continue
      do 40 k=1,nm1
        sum1=0.
        sum2=0.
        do 30 m=1,ncap
c
c The following statement is designed to avoid an overflow condition
c in the computation of  p2(m)  when the weights  w(m)  go to zero 
c faster (and underflow) than the  p2(m)  grow. 
c
          if(w(m).eq.0.) goto 30
          p0(m)=p1(m)
          p1(m)=p2(m)
          p2(m)=(x(m)-alpha(k))*p1(m)-beta(k)*p0(m)
c
c Check for impending overflow.
c
          if(abs(p2(m)).gt.huge .or. abs(sum2).gt.huge) then
            ierr=k
            return
          end if
          t=w(m)*p2(m)*p2(m)
          sum1=sum1+t
          sum2=sum2+t*x(m)
   30   continue
c
c Check for impending underflow.
c
        if(abs(sum1).lt.tiny) then
          ierr=-k
          return
        end if
        alpha(k+1)=sum2/sum1
        beta(k+1)=sum1/sum0
        sum0=sum1
   40 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dsti.f
c
c
      subroutine dsti(n,ncap,dx,dw,dalpha,dbeta,ierr,dp0,dp1,dp2)
c
c This is a double-precision version of the routine  sti.
c
      double precision dx,dw,dalpha,dbeta,dp0,dp1,dp2,dtiny,d1mach,
     *dhuge,dsum0,dsum1,dsum2,dt
      dimension dx(ncap),dw(ncap),dalpha(n),dbeta(n),dp0(ncap),
     *dp1(ncap),dp2(ncap)
      dtiny=10.d0*d1mach(1)
      dhuge=.1d0*d1mach(2)
      ierr=0
      if(n.le.0 .or. n.gt.ncap) then
        ierr=1
        return
      end if
      nm1=n-1
      dsum0=0.d0
      dsum1=0.d0
      do 10 m=1,ncap
        dsum0=dsum0+dw(m)
        dsum1=dsum1+dw(m)*dx(m)
   10 continue
      dalpha(1)=dsum1/dsum0
      dbeta(1)=dsum0
      if(n.eq.1) return
      do 20 m=1,ncap
        dp1(m)=0.d0
        dp2(m)=1.d0
   20 continue
      do 40 k=1,nm1
        dsum1=0.d0
        dsum2=0.d0
        do 30 m=1,ncap
          if(dw(m).eq.0.d0) goto 30
          dp0(m)=dp1(m)
          dp1(m)=dp2(m)
          dp2(m)=(dx(m)-dalpha(k))*dp1(m)-dbeta(k)*dp0(m)
          if(dabs(dp2(m)).gt.dhuge .or. dabs(dsum2).gt.dhuge) then
            ierr=k
            return
          end if
          dt=dw(m)*dp2(m)*dp2(m)
          dsum1=dsum1+dt
          dsum2=dsum2+dt*dx(m)
   30   continue
        if(dabs(dsum1).lt.dtiny) then
          ierr=-k
          return
        end if
        dalpha(k+1)=dsum2/dsum1
        dbeta(k+1)=dsum1/dsum0
        dsum0=dsum1
   40 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > lancz.f
c
c
      subroutine lancz(n,ncap,x,w,alpha,beta,ierr,p0,p1)
c
c This routine carries out the same task as the routine  sti, but
c uses the more stable Lanczos method. The meaning of the input 
c and output parameters is the same as in the routine  sti. (This
c routine is adapted from the routine RKPW in W.B. Gragg and 
c W.J. Harrod,``The numerically stable reconstruction of Jacobi 
c matrices from spectral data'', Numer. Math. 44, 1984, 317-335.)
c
      dimension x(ncap),w(ncap),alpha(n),beta(n),p0(ncap),p1(ncap) 
      if(n.le.0 .or. n.gt.ncap) then
        ierr=1
        return
      else
        ierr=0
      end if
      do 10 i=1,ncap
        p0(i)=x(i)
        p1(i)=0.
   10 continue
      p1(1)=w(1)
      do 30 i=1,ncap-1
        pi=w(i+1)
        gam=1.
        sig=0.
        t=0.
        xlam=x(i+1)
        do 20 k=1,i+1
          rho=p1(k)+pi
          tmp=gam*rho
          tsig=sig
          if(rho.le.0.) then
            gam=1.
            sig=0.
          else
            gam=p1(k)/rho
            sig=pi/rho
          end if
          tk=sig*(p0(k)-xlam)-gam*t
          p0(k)=p0(k)-(tk-t)
          t=tk
          if(sig.le.0.) then
            pi=tsig*p1(k)
          else
            pi=(t**2)/sig
          end if
          tsig=sig
          p1(k)=tmp
   20   continue
   30 continue
      do 40 k=1,n
        alpha(k)=p0(k)
        beta(k)=p1(k)
   40 continue
      return
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > dlancz.f
c
c
      subroutine dlancz(n,ncap,dx,dw,dalpha,dbeta,ierr,dp0,dp1)
c
c This is a double-precision version of the routine  lancz.
c
      double precision dx(ncap),dw(ncap),dalpha(n),dbeta(n),
     *dp0(ncap),dp1(ncap),dpi,dgam,dsig,dt,dxlam,drho,dtmp,
     *dtsig,dtk
      if(n.le.0 .or. n.gt.ncap) then
        ierr=1
        return
      else
        ierr=0
      end if
      do 10 i=1,ncap
        dp0(i)=dx(i)
        dp1(i)=0.d0
   10 continue
      dp1(1)=dw(1)
      do 30 i=1,ncap-1
        dpi=dw(i+1)
        dgam=1.d0
        dsig=0.d0
        dt=0.d0
        dxlam=dx(i+1)
        do 20 k=1,i+1
          drho=dp1(k)+dpi
          dtmp=dgam*drho
          dtsig=dsig
          if(drho.le.0.d0) then
            dgam=1.d0
            dsig=0.d0
          else
            dgam=dp1(k)/drho
            dsig=dpi/drho
          end if
          dtk=dsig*(dp0(k)-dxlam)-dgam*dt
          dp0(k)=dp0(k)-(dtk-dt)
          dt=dtk
          if(dsig.le.0.d0) then
            dpi=dtsig*dp1(k)
          else
            dpi=(dt**2)/dsig
          end if
          dtsig=dsig
          dp1(k)=dtmp
   20   continue
   30 continue
      do 40 k=1,n
        dalpha(k)=dp0(k)
        dbeta(k)=dp1(k)
   40 continue
      return
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > mcdis.f
c
c
      subroutine mcdis(n,ncapm,mc,mp,xp,yp,quad,eps,iq,idelta,irout,
     *finl,finr,endl,endr,xfer,wfer,alpha,beta,ncap,kount,ierr,ie,
     *be,x,w,xm,wm,p0,p1,p2)
c
c This is a multiple-component discretization procedure as described in
c Section 4.3 of the companion paper. It generates to a relative
c accuracy of  eps  the recursion coefficients  alpha(k), beta(k),
c k=0,1,...,n-1, for the polynomials orthogonal with respect to a
c weight distribution consisting of the sum of  mc  continuous
c components and a discrete component with  mp  points. The continuous
c part of the spectrum is made up of  mc  weight functions, each
c supported on its own interval. These intervals may or may not be
c disjoint. The discretization of the inner product on the i-th
c interval is furnished either by a user-supplied subroutine  quad,
c or by the general-purpose subroutine  qgp  provided in this package,
c depending on whether  iq  is equal, or not equal, to  1, respectively.
c The user-supplied routine must have the form  quad(n,x,w,i,ierr)  and
c is assumed to supply the abscissas  x(k)  and weights  w(k), k=1,2,
c ...,n, to be used in approximating the i-th inner product
c
c               integral of p(x)*q(x)*wf(x,i)dx
c
c by the
c
c       sum over k from 1 to n of w(k)*p(x(k))*q(x(k)),
c
c                                        i=1,2,...,mc.
c
c The desired recurrence coefficients are then approximated by the
c recursion coefficients of the discrete orthogonal polynomials 
c belonging to the discretized inner product, which in turn are 
c computed by either the Stieltjes procedure or the Lanczos algorithm 
c according as  irout  is equal to, or not equal to  1, respectively.
c Two error flags  ierr,ie  are provided which signal the occurrence 
c of an error condition in the quadrature process, or in the routine 
c sti  or  lancz  (whichever is used), respectively. The point spectrum 
c is given through its abscissas  xp  and jumps  yp.
c
c If the quadrature routine  quad  has polynomial degree of exactness
c at least  id(n)  for each i, and if  id(n)/n = idelta + O(1/n)  as 
c n  goes to infinity, then the procedure is designed to converge after
c one iteration, provided  idelta  is set with the appropriate
c integer. Normally,  idelta=1 (for interpolatory rules) or  idelta=2
c (for Gaussian rules). The default value is  idelta=1.
c
c    Input:  n    - - the number of recursion coefficients desired;
c                     type integer
c            ncapm  - a discretization parameter indicating an upper
c                     limit of the fineness of the discretization;
c                     ncapm=500  will usually be satisfactory; type
c                     integer
c            mc  - -  the number of disjoint intervals in the
c                     continuous part of the spectrum; type integer
c            mp  - -  the number of points in the discrete part of
c                     the spectrum; type integer. If there is no
c                     point spectrum, set  mp=0.
c            xp  - -  an array of dimension  mp  containing the
c                     abscissas of the point spectrum
c            yp  - -  an array of dimension  mp  containing the jumps
c                     of the point spectrum
c            quad  -  a subroutine determining the discretization of
c                     the inner product on each component interval,
c                     or a dummy routine if  iq  is not equal to  1
c                     (see below)
c            eps  - - the desired relative accuracy of the nonzero
c                     recursion coefficients; type real
c            iq   - - an integer selecting a user-supplied quadrature
c                     routine  quad  if  iq=1  or the ORTHPOL routine 
c                     qgp  otherwise
c            idelta - a nonzero integer, typically  1  or  2, inducing
c                     fast convergence in the case of special quadrature
c                     routines
c            irout  - an integer selecting the routine for generating
c                     the recursion coefficients from the discrete
c                     inner product. Specifically,  irout=1  selects the
c                     routine  sti, whereas any other value selects the
c                     routine  lancz
c            
c The logical variables  finl,finr, the arrays  endl,endr  of 
c dimension  mc, and the arrays  xfer,wfer  of dimension  ncapm  are 
c input variables to the subroutine  qgp  and are used (and hence need
c to be properly dimensioned) only if  iq  is not equal to  1.
c
c    Output:  alpha,beta - arrays of dimension n, holding as k-th
c                     element  alpha(k-1), beta(k-1), k=1,2,...,n,
c                     respectively
c             ncap  - an integer indicating the fineness of the
c                     discretization that yields convergence within
c                     the eps-tolerance
c             kount - the number of iterations used
c             ierr  - an error flag, equal to  0  on normal return,
c                     equal to  -1  if  n  is not in the proper range,
c                     equal to  i  if there is an error condition in
c                     the discretization of the i-th interval,
c                     and equal to  ncapm  if the discretized 
c                     Stieltjes procedure does not converge within the
c                     discretization resolution specified by  ncapm
c             ie - -  an error flag inherited from the routine  sti
c                     or  lancz  (whichever is used)
c
c The array  be  of dimension  n, the arrays  x,w  of dimension  ncapm,
c and the arrays  xm,wm,p0,p1,p2  of dimension mc*ncapm+mp  are used 
c for working space. The routine calls upon the subroutine  sti  or
c lancz, depending on the choice of  irout.
c
      dimension xp(*),yp(*),endl(mc),endr(mc),xfer(ncapm),wfer(ncapm),
     *alpha(n),beta(n),be(n),x(ncapm),w(ncapm),xm(*),wm(*),p0(*),p1(*),
     *p2(*)
      logical finl,finr
c
c The arrays  xp,yp  are assumed to have dimension  mp  if mp > 0, and
c the arrays  xm,wm,p0,p1,p2  dimension  mc*ncapm+mp.
c
      if(idelta.le.0) idelta=1
      if(n.lt.1) then
        ierr=-1
        return
      end if
c
c Initialization
c
      incap=1
      kount=-1
      ierr=0
      do 10 k=1,n
        beta(k)=0.
   10 continue
      ncap=(2*n-1)/idelta
   20 do 30 k=1,n
        be(k)=beta(k)
   30 continue
      kount=kount+1
      if(kount.gt.1) incap=2**(kount/5)*n
      ncap=ncap+incap
      if(ncap.gt.ncapm) then
        ierr=ncapm
        return
      end if
c
c Discretization of the inner product
c
      mtncap=mc*ncap
      do 50 i=1,mc
        im1tn=(i-1)*ncap
        if(iq.eq.1) then
          call quad(ncap,x,w,i,ierr)
        else
          call qgp(ncap,x,w,i,ierr,mc,finl,finr,endl,endr,xfer,
     *      wfer)
        end if
        if(ierr.ne.0) then
          ierr=i
          return
        end if
        do 40 k=1,ncap
          xm(im1tn+k)=x(k)
          wm(im1tn+k)=w(k)
   40   continue
   50 continue
      if(mp.ne.0) then
        do 60 k=1,mp
          xm(mtncap+k)=xp(k)
          wm(mtncap+k)=yp(k)
   60   continue
      end if
c
c Computation of the desired recursion coefficients
c
      if(irout.eq.1) then
        call sti(n,mtncap+mp,xm,wm,alpha,beta,ie,p0,p1,p2)
      else
        call lancz(n,mtncap+mp,xm,wm,alpha,beta,ie,p0,p1)
      end if 
c
c In the following statement, the absolute value of the beta's is
c used to guard against failure in cases where the routine is applied
c to variable-sign weight functions and hence the positivity of the
c beta's is not guaranteed.
c
      do 70 k=1,n
        if(abs(beta(k)-be(k)).gt.eps*abs(beta(k))) goto 20
   70 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dmcdis.f
c
c
      subroutine dmcdis(n,ncapm,mc,mp,dxp,dyp,dquad,deps,iq,idelta,
     *irout,finld,finrd,dendl,dendr,dxfer,dwfer,dalpha,dbeta,ncap,
     *kount,ierrd,ied,dbe,dx,dw,dxm,dwm,dp0,dp1,dp2)
c
c This is a double-precision version of the routine  mcdis.
c
      double precision dxp,dyp,deps,dendl,dendr,dxfer,dwfer,dalpha,
     *dbeta,dbe,dx,dw,dxm,dwm,dp0,dp1,dp2
      dimension dxp(*),dyp(*),dendl(mc),dendr(mc),dxfer(ncapm),
     *dwfer(ncapm),dalpha(n),dbeta(n),dbe(n),dx(ncapm),dw(ncapm),
     *dxm(*),dwm(*),dp0(*),dp1(*),dp2(*)
      logical finld,finrd
c
c The arrays  dxp,dyp  are assumed to have dimension  mp  if mp > 0,
c the arrays  dxm,dwm,dp0,dp1,dp2  dimension  mc*ncapm+mp.
c
      if(idelta.le.0) idelta=1
      if(n.lt.1) then
        ierrd=-1
        return
      end if
      incap=1
      kount=-1
      ierr=0
      do 10 k=1,n
        dbeta(k)=0.d0
   10 continue
      ncap=(2*n-1)/idelta
   20 do 30 k=1,n
        dbe(k)=dbeta(k)
   30 continue
      kount=kount+1
      if(kount.gt.1) incap=2**(kount/5)*n
      ncap=ncap+incap
      if(ncap.gt.ncapm) then
        ierrd=ncapm
        return
      end if
      mtncap=mc*ncap
      do 50 i=1,mc
        im1tn=(i-1)*ncap
        if(iq.eq.1) then
          call dquad(ncap,dx,dw,i,ierr)
        else
          call dqgp(ncap,dx,dw,i,ierr,mc,finld,finrd,dendl,dendr,dxfer,
     *      dwfer)
        end if
        if(ierr.ne.0) then
          ierrd=i
          return
        end if
        do 40 k=1,ncap
          dxm(im1tn+k)=dx(k)
          dwm(im1tn+k)=dw(k)
   40   continue
   50 continue
      if(mp.ne.0) then
        do 60 k=1,mp
          dxm(mtncap+k)=dxp(k)
          dwm(mtncap+k)=dyp(k)
   60   continue
      end if
      if(irout.eq.1) then
        call dsti(n,mtncap+mp,dxm,dwm,dalpha,dbeta,ied,dp0,dp1,dp2)
      else
        call dlancz(n,mtncap+mp,dxm,dwm,dalpha,dbeta,ied,dp0,dp1)
      end if
      do 70 k=1,n
        if(dabs(dbeta(k)-dbe(k)).gt.deps*dabs(dbeta(k))) goto 20
   70 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > qgp.f
c
c
      subroutine qgp(n,x,w,i,ierr,mc,finl,finr,endl,endr,xfer,wfer)
c
c This is a general-purpose discretization routine that can be used
c as an alternative to the routine  quad  in the multiple-component 
c discretization procedure  mcdis. It takes no account of the special
c nature of the weight function involved and hence may result in slow 
c convergence of the discretization procedure. This routine, therefore, 
c should be used only as a last resort, when no better, more natural 
c discretization can be found.
c
c It is assumed that there are  mc.ge.1  disjoint component intervals.
c The discretization is effected by the Fejer quadrature rule,
c suitably transformed to the respective interval. An interval that
c extends to minus infinity has to be indexed by  1; one that extends
c to plus infinity has to be indexed by  mc.
c
c The output variable  ierr  is given the value  0. Additional input 
c parameters and working space used by this routine are as follows:
c
c          mc      - the number of component intervals; type integer
c          finl    - a logical variable to be set .true. if the
c                    extreme left interval is finite, and .false.
c                    otherwise
c          finr    - a logical variable to be set .true. if the
c                    extreme right interval is finite, and .false.
c                    otherwise
c          endl    - an array of dimension  mc  containing the left
c                    endpoints of the component intervals; if the
c                    first of these extends to minus infinity,  endl(1)
c                    can be set to an arbitrary value
c          endr    - an array of dimension  mc  containing the right
c                    endpoints of the component intervals; if the
c                    last of these extends to plus infinity,  endr(mc)
c                    can be set to an arbitrary value
c          xfer,wfer-working arrays holding the Fejer nodes and
c                    weights, respectively, for the interval [-1,1].
c
c The user has to supply the routine 
c
c                     function wf(x,i),
c
c which evaluates the weight function at the point  x  on the i-th 
c component interval. The routine also uses the subroutines  fejer,
c symtr  and  tr, which are appended.
c
      dimension x(n),w(n),endl(mc),endr(mc),xfer(*),wfer(*)
      logical finl,finr
c
c The arrays  xfer,wfer  are dimensioned in the routine  mcdis.
c
      ierr=0
      if(i.eq.1) call fejer(n,xfer,wfer)
      if(i.gt.1 .and. i.lt.mc) goto 60
      if(mc.eq.1) then
        if(finl.and.finr) goto 60
        if(finl) goto 20
        if(finr) goto 40
        do 10 k=1,n
          call symtr(xfer(k),phi,phi1)
          x(k)=phi
          w(k)=wfer(k)*wf(phi,i)*phi1
   10   continue
        return
      else
        if((i.eq.1.and.finl).or.(i.eq.mc.and.finr)) goto 60
        if(i.eq.1) goto 40
      end if
   20 do 30 k=1,n
        call tr(xfer(k),phi,phi1)
        x(k)=endl(mc)+phi
        w(k)=wfer(k)*wf(x(k),mc)*phi1
   30 continue
      return
   40 do 50 k=1,n
        call tr(-xfer(k),phi,phi1)
        x(k)=endr(1)-phi
        w(k)=wfer(k)*wf(x(k),1)*phi1
   50 continue
      return
   60 do 70 k=1,n
        x(k)=.5*((endr(i)-endl(i))*xfer(k)+endr(i)+endl(i))
        w(k)=.5*(endr(i)-endl(i))*wfer(k)*wf(x(k),i)
   70 continue
      return
      end

      subroutine symtr(t,phi,phi1)
c
c This implements a particular transformation  x=phi(t)  mapping
c the t-interval [-1,1] to the x-interval [-oo,oo].
c
c        input:   t
c        output:  phi=phi(t)
c                 phi1=derivative of phi(t)
c
      t2=t*t
      phi=t/(1.-t2)
      phi1=(t2+1.)/(t2-1.)**2
      return
      end

      subroutine tr(t,phi,phi1)
c
c This implements a particular transformation  x=phi(t)  mapping
c the t-interval [-1,1] to the x-interval [0,oo].
c
c         input:   t
c         output:  phi=phi(t)
c                  phi1=derivative of phi(t)
c
      phi=(1.+t)/(1.-t)
      phi1=2./(t-1.)**2
      return
      end

      subroutine fejer(n,x,w)
c
c This routine generates the n-point Fejer quadrature rule.
c
c         input:   n   - the number of quadrature nodes
c         output:  x,w - arrays of dimension  n  holding the quadrature
c                        nodes and weights, respectively; the nodes
c                        are ordered increasingly
c
      dimension x(n),w(n)
      pi=4.*atan(1.)
      nh=n/2
      np1h=(n+1)/2
      fn=real(n)
      do 10 k=1,nh
        x(n+1-k)=cos(.5*real(2*k-1)*pi/fn)
        x(k)=-x(n+1-k)
   10 continue
      if(2*nh.ne.n) x(np1h)=0.
      do 30 k=1,np1h
        c1=1.
        c0=2.*x(k)*x(k)-1.
        t=2.*c0
        sum=c0/3.
        do 20 m=2,nh
          c2=c1
          c1=c0
          c0=t*c1-c2
          sum=sum+c0/real(4*m*m-1)
   20   continue
        w(k)=2.*(1.-2.*sum)/fn
        w(n+1-k)=w(k)
   30 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dqgp.f
c
c
      subroutine dqgp(n,dx,dw,i,ierr,mcd,finld,finrd,dendl,dendr,
     *  dxfer,dwfer)
c
c This is a double-precision version of the routine  qgp. The user
c has to supply the routine
c
c              double precision function dwf(dx,i),
c
c which evaluates the weight function in double precision at the
c point  dx  on the i-th component interval.
c
      double precision dx,dw,dendl,dendr,dxfer,dwfer,dphi,dphi1,dwf
      dimension dx(n),dw(n),dendl(mcd),dendr(mcd),dxfer(*),dwfer(*)
      logical finld,finrd
c
c The arrays  dxfer,dwfer  are dimensioned in the routine  dmcdis.
c
      ierr=0
      if(i.eq.1) call dfejer(n,dxfer,dwfer)
      if(i.gt.1 .and. i.lt.mcd) goto 60
      if(mcd.eq.1) then
        if(finld.and.finrd) goto 60
        if(finld) goto 20
        if(finrd) goto 40
        do 10 k=1,n
          call dsymtr(dxfer(k),dphi,dphi1)
          dx(k)=dphi
          dw(k)=dwfer(k)*dwf(dphi,i)*dphi1
   10   continue
        return
      else
        if((i.eq.1.and.finld).or.(i.eq.mcd.and.finrd)) goto 60
        if(i.eq.1) goto 40
      end if
   20 do 30 k=1,n
        call dtr(dxfer(k),dphi,dphi1)
        dx(k)=dendl(mcd)+dphi
        dw(k)=dwfer(k)*dwf(dx(k),mcd)*dphi1
   30 continue
      return
   40 do 50 k=1,n
        call dtr(-dxfer(k),dphi,dphi1)
        dx(k)=dendr(1)-dphi
        dw(k)=dwfer(k)*dwf(dx(k),1)*dphi1
   50 continue
      return
   60 do 70 k=1,n
        dx(k)=.5d0*((dendr(i)-dendl(i))*dxfer(k)+dendr(i)+dendl(i))
        dw(k)=.5d0*(dendr(i)-dendl(i))*dwfer(k)*dwf(dx(k),i)
   70 continue
      return
      end

      subroutine dsymtr(dt,dphi,dphi1)
c
c This is a double-precision version of  symtr.
c
      double precision dt,dphi,dphi1,dt2
      dt2=dt*dt
      dphi=dt/(1.d0-dt2)
      dphi1=(dt2+1.d0)/(dt2-1.d0)**2
      return
      end

      subroutine dtr(dt,dphi,dphi1)
c
c This is a double-precision version of  tr.
c
      double precision dt,dphi,dphi1
      dphi=(1.d0+dt)/(1.d0-dt)
      dphi1=2.d0/(dt-1.d0)**2
      return
      end

      subroutine dfejer(n,dx,dw)
c
c This is a double-precision version of  fejer.
c
      double precision dx,dw,dpi,dn,dc1,dc0,dt,dsum,dc2
      dimension dx(n),dw(n)
      dpi=4.d0*datan(1.d0)
      nh=n/2
      np1h=(n+1)/2
      dn=dble(n)
      do 10 k=1,nh
        dx(n+1-k)=dcos(.5d0*dble(2*k-1)*dpi/dn)
        dx(k)=-dx(n+1-k)
   10 continue
      if(2*nh.ne.n) dx(np1h)=0.d0
      do 30 k=1,np1h
        dc1=1.d0
        dc0=2.d0*dx(k)*dx(k)-1.d0
        dt=2.d0*dc0
        dsum=dc0/3.d0
        do 20 m=2,nh
          dc2=dc1
          dc1=dc0
          dc0=dt*dc1-dc2
          dsum=dsum+dc0/dble(4*m*m-1)
   20   continue
        dw(k)=2.d0*(1.d0-2.d0*dsum)/dn
        dw(n+1-k)=dw(k)
   30 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > mccheb.f
c
c
      subroutine mccheb(n,ncapm,mc,mp,xp,yp,quad,eps,iq,idelta,
     *finl,finr,endl,endr,xfer,wfer,a,b,fnu,alpha,beta,ncap,kount,
     *ierr,be,x,w,xm,wm,s,s0,s1,s2)
c
c This is a multiple-component discretized modified Chebyshev
c algorithm, basically a modified Chebyshev algorithm in which the
c modified moments are discretized in the same manner as the inner
c product in the discretization procedure  mcdis. The input and
c output parameters are as in  mcdis. In addition, the arrays  a,b
c must be filled with the recursion coefficients  a(k-1),b(k-1),
c k=1,2,...,2*n-1, defining the modified moments. The arrays
c be,x,w,xm,wm,s,s0,s1,s2  are used for working space. The routine
c calls upon the subroutine  cheb. The routine exits immediately with
c ierr=-1  if  n  is not in range.
c
      dimension xp(*),yp(*),endl(mc),endr(mc),xfer(ncapm),
     *wfer(ncapm),a(*),b(*),fnu(*),alpha(n),beta(n),be(n),x(ncapm),
     *w(ncapm),xm(*),wm(*),s(n),s0(*),s1(*),s2(*)
      logical finl,finr
c
c The arrays  xp,yp  are assumed to have dimension  mp  if mp > 0, 
c the arrays  a,b  dimension 2*n-1, the arrays  fnu,s0,s1,s2  dimension 
c 2*n, and the arrays  xm,wm  dimension  mc*ncapm+mp.
c
      nd=2*n
      if(idelta.le.0) idelta=1
      if(n.lt.1) then
        ierr=-1
        return
      end if
c
c Initialization
c
      incap=1
      kount=-1
      ierr=0
      do 10 k=1,n
        beta(k)=0.
   10 continue
      ncap=(nd-1)/idelta
   20 do 30 k=1,n
        be(k)=beta(k)
   30 continue
      kount=kount+1
      if(kount.gt.1) incap=2**(kount/5)*n
      ncap=ncap+incap
      if(ncap.gt.ncapm) then
        ierr=ncapm
        return
      end if
c
c Discretization of the modified moments
c
      mtncap=mc*ncap
      do 50 i=1,mc
        im1tn=(i-1)*ncap
        if(iq.eq.1) then
          call quad(ncap,x,w,i,ierr)
        else
          call qgp(ncap,x,w,i,ierr,mc,finl,finr,endl,endr,xfer,wfer)
        end if
        if(ierr.ne.0) then
          ierr=i
          return
        end if
        do 40 k=1,ncap
          xm(im1tn+k)=x(k)
          wm(im1tn+k)=w(k)
   40   continue
   50 continue
      if(mp.ne.0) then
        do 60 k=1,mp
          xm(mtncap+k)=xp(k)
          wm(mtncap+k)=yp(k)
   60   continue
      end if
      mtnpmp=mtncap+mp
      do 90 k=1,nd
        km1=k-1
        sum=0.
        do 80 i=1,mtnpmp
          p1=0.
          p=1.
          if(k.gt.1) then
            do 70 l=1,km1
              pm1=p1
              p1=p
              p=(xm(i)-a(l))*p1-b(l)*pm1
   70       continue
          end if
          sum=sum+wm(i)*p
   80   continue
        fnu(k)=sum
   90 continue
c
c Computation of the desired recursion coefficients
c
      call cheb(n,a,b,fnu,alpha,beta,s,ierr,s0,s1,s2)
c
c In the following statement, the absolute value of the beta's is
c used to guard against failure in cases where the routine is applied
c to variable-sign weight functions and hence the positivity of the
c beta's is not guaranteed.
c
      do 100 k=1,n
        if(abs(beta(k)-be(k)).gt.eps*abs(beta(k))) goto 20
  100 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dmcheb.f
c
c
      subroutine dmcheb(n,ncapm,mcd,mp,dxp,dyp,dquad,deps,iq,
     *idelta,finld,finrd,dendl,dendr,dxfer,dwfer,da,db,dnu,dalpha,
     *dbeta,ncap,kount,ierrd,dbe,dx,dw,dxm,dwm,ds,ds0,ds1,ds2)
c
c This is a double-precision version of the routine  mccheb.
c
      double precision dxp,dyp,deps,dendl,dendr,dxfer,dwfer,da,db,
     *dnu,dalpha,dbeta,dbe,dx,dw,dxm,dwm,ds,ds0,ds1,ds2,dsum,dp1,
     *dp,dpm1
      dimension dxp(*),dyp(*),dendl(mcd),dendr(mcd),dxfer(ncapm),
     *dwfer(ncapm),da(*),db(*),dnu(*),dalpha(n),dbeta(n),dbe(n),
     *dx(ncapm),dw(ncapm),dxm(*),dwm(*),ds(n),ds0(*),ds1(*),ds2(*)
      logical finld,finrd
c
c The arrays  dxp,dyp  are assumed to have dimension  mp  if mp > 0,
c the arrays  da,db  dimension 2*n-1, the arrays  dnu,ds0,ds1,ds2
c dimension  2*n, and the arrays  dxm,dwm  dimension  mc*ncapm+mp.
c
      nd=2*n
      if(idelta.le.0) idelta=1
      if(n.lt.1) then
        ierrd=-1
        return
      end if
      incap=1
      kount=-1
      ierrd=0
      do 10 k=1,n
        dbeta(k)=0.d0
   10 continue
      ncap=(nd-1)/idelta
   20 do 30 k=1,n
        dbe(k)=dbeta(k)
   30 continue
      kount=kount+1
      if(kount.gt.1) incap=2**(kount/5)*n
      ncap=ncap+incap
      if(ncap.gt.ncapm) then
        ierrd=ncapm
        return
      end if
      mtncap=mcd*ncap
      do 50 i=1,mcd
        im1tn=(i-1)*ncap
        if(iq.eq.1) then
          call dquad(ncap,dx,dw,i,ierr)
        else
          call dqgp(ncap,dx,dw,i,ierr,mcd,finld,finrd,dendl,dendr,
     *      dxfer,dwfer)
        end if
        if(ierr.ne.0) then
          ierrd=i
          return
        end if
        do 40 k=1,ncap
          dxm(im1tn+k)=dx(k)
          dwm(im1tn+k)=dw(k)
   40   continue
   50 continue
      if(mp.ne.0) then
        do 60 k=1,mp
          dxm(mtncap+k)=dxp(k)
          dwm(mtncap+k)=dyp(k)
   60   continue
      end if
      mtnpmp=mtncap+mp
      do 90 k=1,nd
        km1=k-1
        dsum=0.d0
        do 80 i=1,mtnpmp
          dp1=0.d0
          dp=1.d0
          if(k.gt.1) then
            do 70 l=1,km1
              dpm1=dp1
              dp1=dp
              dp=(dxm(i)-da(l))*dp1-db(l)*dpm1
   70       continue
          end if
          dsum=dsum+dwm(i)*dp
   80   continue
        dnu(k)=dsum
   90 continue
      call dcheb(n,da,db,dnu,dalpha,dbeta,ds,ierr,ds0,ds1,ds2)
      do 100 k=1,n
        if(dabs(dbeta(k)-dbe(k)).gt.deps*dabs(dbeta(k))) goto 20
  100 continue
      return
      end

C-END-OF-FILE

###############################
#                             #
# 5. MODIFICATION ALGORITHMS  #
#                             #
###############################

cat <<C-END-OF-FILE > chri.f
c
c
      subroutine chri(n,iopt,a,b,x,y,hr,hi,alpha,beta,ierr)
c
c This subroutine implements the Christoffel or generalized Christoffel
c theorem. In all cases except  iopt=7, it uses nonlinear recurrence
c algorithms described in W. Gautschi,``An algorithmic implementation
c of the generalized Christoffel theorem'', Numerical Integration
c (G. Haemmerlin, ed.), Birkhaeuser, Basel, 1982, pp. 89-106. The case
c iopt=7  incorporates a QR step with shift  x  in the manner of
c J. Kautsky and G.H. Golub, ``On the calculation of Jacobi matrices'',
c Linear Algebra Appl. 52/53, 1983, 439-455, using the algorithm of
c Eq. (67.11) on p. 567 in J.H. Wilkinson,``The Algebraic Eigenvalue
c Problem'', Clarendon Press, Oxford, 1965. Given the recursion
c coefficients  a(k),b(k), k=0,1,...,n, for the (monic) orthogonal
c polynomials with respect to some measure  dlambda(t), it generates
c the recursion coefficients  alpha(k),beta(k), k=0,1,...,n-1, for the
c measure
c
c              (t-x)dlambda(t)               if  iopt=1
c              [(t-x)**2+y**2]dlambda(t)     if  iopt=2
c              (t**2+y**2)dlambda(t) with    if  iopt=3
c                dlambda(t) and supp(dlambda)
c                symmetric  with respect to
c                the origin
c              dlambda(t)/(t-x)              if  iopt=4
c              dlambda(t)/[(t-x)**2+y**2]    if  iopt=5
c              dlambda(t)/(t**2+y**2) with   if  iopt=6
c                dlambda(t) and supp(dlambda)
c                symmetric with respect to
c                the origin
c              [(t-x)**2]dlambda(t)          if  iopt=7
c
c
c      Input:   n  - - - the number of recurrence coefficients
c                        desired; type integer
c               iopt - - an integer selecting the desired weight
c                        distribution
c               a,b  - - arrays of dimension  n+1  containing the
c                        recursion coefficients a(k-1),b(k-1),k=1,2,
c                        ...,n+1, of the polynomials orthogonal with
c                        respect to the given measure  dlambda(t)
c               x,y  - - real parameters defining the linear and 
c                        quadratic factors, or divisors, of  dlambda(t)
c               hr,hi  - the real and imaginary part, respectively, of
c                        the integral of dlambda(t)/(z-t), where z=x+iy;
c                        the parameter  hr  is used only if  iopt=4 or 
c                        5, the parameter  hi  only if  iopt=5 or 6
c
c      Output:  alpha,beta - - arrays of dimension  n  containing the
c                         desired recursion coefficients  alpha(k-1),
c                         beta(k-1), k=1,2,...,n
c
c It is assumed that  n  is larger than or equal to 2. Otherwise, the
c routine exits immediately with the error flag  ierr  set equal to 1.
c If  iopt  is not between 1 and 7, the routine exits with  ierr=2. 
c 
c The routine uses the function subroutine  r1mach  to evaluate the
c constant  eps , which is used only if  iopt=7.
c
      dimension a(*),b(*),alpha(n),beta(n)
c
c The arrays  a,b  are assumed to have dimension  n+1.
c
      eps=5.*r1mach(3)
c
c The quantity  eps  is a constant slightly larger than the machine
c precision.
c
      ierr=0
      if(n.lt.2) then
        ierr=1
        return
      end if
c
c What follows implements Eq. (3.7) of W. Gautschi, op. cit.
c
      if (iopt.eq.1) then
        e=0.
        do 10 k=1,n
          q=a(k)-e-x
          beta(k)=q*e
          e=b(k+1)/q
          alpha(k)=x+q+e
   10   continue
c
c Set the first beta-coefficient as discussed in Section 5.1 of the
c companion paper.
c
        beta(1)=b(1)*(a(1)-x)
        return
c
c What follows implements Eq. (4.7) of W. Gautschi, op. cit.
c
      else if(iopt.eq.2) then
        s=x-a(1)
        t=y
        eio=0.
        do 20 k=1,n
          d=s*s+t*t
          er=-b(k+1)*s/d
          ei=b(k+1)*t/d
          s=x+er-a(k+1)
          t=y+ei
          alpha(k)=x+t*er/ei-s*ei/t
          beta(k)=t*eio*(1.+(er/ei)**2)
          eio=ei
   20   continue
c
c Set the first beta-coefficient.
c
        beta(1)=b(1)*(b(2)+(a(1)-x)**2+y*y)
        return
c
c What follows implements Eq. (4.8) of W. Gautschi, op. cit.
c
      else if(iopt.eq.3) then
        t=y
        eio=0.
        do 30 k=1,n
          ei=b(k+1)/t
          t=y+ei
          alpha(k)=0.
          beta(k)=t*eio
          eio=ei
   30   continue
c
c Set the first beta-coefficient.
c
        beta(1)=b(1)*(b(2)+y*y)
        return
c
c What follows implements Eqs. (5.1),(5.2) of W. Gautschi, op. cit.
c
      else if(iopt.eq.4) then
        alpha(1)=x-b(1)/hr
        beta(1)=-hr
        q=-b(1)/hr
        do 40 k=2,n
          e=a(k-1)-x-q
          beta(k)=q*e
          q=b(k)/e
          alpha(k)=q+e+x
   40   continue
        return
c
c What follows implements Eq. (5.8) of W. Gautschi, op. cit.
c
      else if(iopt.eq.5) then
        nm1=n-1
        d=hr*hr+hi*hi
        eroo=a(1)-x+b(1)*hr/d
        eioo=-b(1)*hi/d-y
        alpha(1)=x+hr*y/hi
        beta(1)=-hi/y
        alpha(2)=x-b(1)*hi*eroo/(d*eioo)+hr*eioo/hi
        beta(2)=y*eioo*(1.+(hr/hi)**2)
        if(n.eq.2) return
        so=b(2)/(eroo**2+eioo**2)
        ero=a(2)-x-so*eroo
        eio=so*eioo-y
        alpha(3)=x+eroo*eio/eioo+so*eioo*ero/eio
        beta(3)=-b(1)*hi*eio*(1.+(eroo/eioo)**2)/d
        if(n.eq.3) return
        do 50 k=3,nm1
          s=b(k)/(ero**2+eio**2)
          er=a(k)-x-s*ero
          ei=s*eio-y
          alpha(k+1)=x+ero*ei/eio+s*eio*er/ei
          beta(k+1)=so*eioo*ei*(1.+(ero/eio)**2)
          eroo=ero
          eioo=eio
          ero=er
          eio=ei
          so=s
   50   continue
        return
c
c What follows implements Eq. (5.9) of W. Gautschi, op. cit.
c
      else if(iopt.eq.6) then
        nm1=n-1
        eoo=-b(1)/hi-y
        eo=b(2)/eoo-y
        alpha(1)=0.
        beta(1)=-hi/y
        alpha(2)=0.
        beta(2)=y*eoo
        if(n.eq.2) return
        alpha(3)=0.
        beta(3)=-b(1)*eo/hi
        if(n.eq.3) return
        do 60 k=3,nm1
          e=b(k)/eo-y
          beta(k+1)=b(k-1)*e/eoo
          alpha(k+1)=0.
          eoo=eo
          eo=e
   60   continue
        return
c
c What follows implements a QR step with shift  x.
c
      else if(iopt.eq.7) then
        u=0.
        c=1.
        c0=0.
        do 70 k=1,n
          gamma=a(k)-x-u
          cm1=c0
          c0=c
          if(abs(c0).gt.eps) then
            p2=(gamma**2)/c0
          else
            p2=cm1*b(k)
          end if
          if(k.gt.1) beta(k)=s*(p2+b(k+1))
          s=b(k+1)/(p2+b(k+1))
          c=p2/(p2+b(k+1))
          u=s*(gamma+a(k+1)-x)
          alpha(k)=gamma+u+x
   70   continue
        beta(1)=b(1)*(b(2)+(x-a(1))**2)
        return
      else
        ierr=2
        return
      end if
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dchri.f
c
c
      subroutine dchri(n,iopt,da,db,dx,dy,dhr,dhi,dalpha,dbeta,ierr)
c
c This is a double-precision version of the routine  chri.
c
      double precision da,db,dx,dy,dhr,dhi,dalpha,dbeta,deps,d1mach,
     *de,dq,ds,dt,deio,dd,der,dei,deroo,deioo,dso,dero,deoo,deo,du,dc,
     *dc0,dgam,dcm1,dp2
      dimension da(*),db(*),dalpha(n),dbeta(n)
c
c The arrays  da,db  are assumed to have dimension  n+1.
c
      deps=5.d0*d1mach(3)
      ierr=0
      if(n.lt.2) then
        ierr=1
        return
      end if
      if(iopt.eq.1) then
        de=0.d0
        do 10 k=1,n
          dq=da(k)-de-dx
          dbeta(k)=dq*de
          de=db(k+1)/dq
          dalpha(k)=dx+dq+de
   10   continue
        dbeta(1)=db(1)*(da(1)-dx)
        return
      else if(iopt.eq.2) then
        ds=dx-da(1)
        dt=dy
        deio=0.d0
        do 20 k=1,n
          dd=ds*ds+dt*dt
          der=-db(k+1)*ds/dd
          dei=db(k+1)*dt/dd
          ds=dx+der-da(k+1)
          dt=dy+dei
          dalpha(k)=dx+dt*der/dei-ds*dei/dt
          dbeta(k)=dt*deio*(1.d0+(der/dei)**2)
          deio=dei
   20   continue
        dbeta(1)=db(1)*(db(2)+(da(1)-dx)**2+dy*dy)
        return
      else if(iopt.eq.3) then
        dt=dy
        deio=0.d0
        do 30 k=1,n
          dei=db(k+1)/dt
          dt=dy+dei
          dalpha(k)=0.d0
          dbeta(k)=dt*deio
          deio=dei
   30   continue
        dbeta(1)=db(1)*(db(2)+dy*dy)
        return
      else if(iopt.eq.4) then
        dalpha(1)=dx-db(1)/dhr
        dbeta(1)=-dhr
        dq=-db(1)/dhr
        do 40 k=2,n
          de=da(k-1)-dx-dq
          dbeta(k)=dq*de
          dq=db(k)/de
          dalpha(k)=dq+de+dx
   40   continue
        return
      else if(iopt.eq.5) then
        nm1=n-1
        dd=dhr*dhr+dhi*dhi
        deroo=da(1)-dx+db(1)*dhr/dd
        deioo=-db(1)*dhi/dd-dy
        dalpha(1)=dx+dhr*dy/dhi
        dbeta(1)=-dhi/dy
        dalpha(2)=dx-db(1)*dhi*deroo/(dd*deioo)+dhr*deioo/dhi
        dbeta(2)=dy*deioo*(1.d0+(dhr/dhi)**2)
        if(n.eq.2) return
        dso=db(2)/(deroo**2+deioo**2)
        dero=da(2)-dx-dso*deroo
        deio=dso*deioo-dy
        dalpha(3)=dx+deroo*deio/deioo+dso*deioo*dero/deio
        dbeta(3)=-db(1)*dhi*deio*(1.d0+(deroo/deioo)**2)/dd
        if(n.eq.3) return
        do 50 k=3,nm1
          ds=db(k)/(dero**2+deio**2)
          der=da(k)-dx-ds*dero
          dei=ds*deio-dy
          dalpha(k+1)=dx+dero*dei/deio+ds*deio*der/dei
          dbeta(k+1)=dso*deioo*dei*(1.d0+(dero/deio)**2)
          deroo=dero
          deioo=deio
          dero=der
          deio=dei
          dso=ds
   50   continue
        return
      else if(iopt.eq.6) then
        nm1=n-1
        deoo=-db(1)/dhi-dy
        deo=db(2)/deoo-dy
        dalpha(1)=0.d0
        dbeta(1)=-dhi/dy
        dalpha(2)=0.d0
        dbeta(2)=dy*deoo
        if(n.eq.2) return
        dalpha(3)=0.d0
        dbeta(3)=-db(1)*deo/dhi
        if(n.eq.3) return
        do 60 k=3,nm1
          de=db(k)/deo-dy
          dbeta(k+1)=db(k-1)*de/deoo
          dalpha(k+1)=0.d0
          deoo=deo
          deo=de
   60   continue
        return
      else if(iopt.eq.7) then
        du=0.d0
        dc=1.d0
        dc0=0.d0
        do 70 k=1,n
          dgam=da(k)-dx-du
          dcm1=dc0
          dc0=dc
          if(dabs(dc0).gt.deps) then
            dp2=(dgam**2)/dc0
          else
            dp2=dcm1*db(k)
          end if
          if(k.gt.1) dbeta(k)=ds*(dp2+db(k+1))
          ds=db(k+1)/(dp2+db(k+1))
          dc=dp2/(dp2+db(k+1))
          du=ds*(dgam+da(k+1)-dx)
          dalpha(k)=dgam+du+dx
   70   continue
        dbeta(1)=db(1)*(db(2)+(dx-da(1))**2)
        return
      else
        ierr=2
        return
      end if
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > knum.f
c
c
      subroutine knum(n,nu0,numax,z,eps,a,b,rho,nu,ierr,rold)
c
c This routine generates
c
c   rho(k)(z)=integral pi(k)(t)dlambda(t)/(z-t), k=0,1,2,...,n,
c
c where  pi(k)(t)  is the (monic) k-th degree orthogonal polynomial
c with respect to the measure  dlambda(t), and the integral is extended
c over the support of  dlambda. It is assumed that  z  is a complex
c number outside the smallest interval containing the support of
c dlambda. The quantities  rho(k)(z)  are computed as the first  n+1
c members of the minimal solution of the basic three-term recurrence
c relation
c
c      y(k+1)(z)=(z-a(k))y(k)(z)-b(k)y(k-1)(z), k=0,1,2,...,
c
c satisfied by the orthogonal polynomials  pi(k)(z).
c
c   Input:  n  - -  the largest integer  k  for which  rho(k)  is 
c                   desired
c           nu0  -  an estimate of the starting backward recurrence 
c                   index; if no better estimate is known, set 
c                   nu0 = 3*n/2; for Jacobi, Laguerre and Hermite
c                   weight functions, estimates of  nu0  are generated
c                   respectively by the routines  nu0jac,nu0lag  and
c                   nu0her
c           numax - an integer larger than  n  cutting off backward 
c                   recursion in case of nonconvergence; if  nu0  
c                   exceeds  numax, then the routine aborts with the 
c                   error flag  ierr  set equal to  nu0
c           z - - - the variable in  rho(k)(z); type complex
c           eps - - the relative accuracy to which the  rho(k)  are
c                   desired
c           a,b - - arrays of dimension  numax  to be supplied with the
c                   recurrence coefficients  a(k-1), b(k-1), k=1,2,...,
c                   numax.
c
c   Output: rho - - an array of dimension  n+1  containing the results
c                   rho(k)=rho(k-1)(z), k=1,2,...,n+1; type complex
c           nu  - - the starting backward recurrence index that yields
c                   convergence
c           ierr  - an error flag equal to zero on normal return, equal 
c                   to  nu0  if  nu0 > numax, and equal to  numax in 
c                   case of nonconvergence.
c
c The complex array  rold  of dimension  n+1  is used for working space.
c            
      complex z,rho,rold,r
      dimension a(numax),b(numax),rho(*),rold(*)
c
c The arrays  rho,rold  are assumed to have dimension  n+1.
c
      ierr=0
      np1=n+1
      if(nu0.gt.numax) then
        ierr=nu0
        return
      end if
      if(nu0.lt.np1) nu0=np1
      nu=nu0-5
      do 10 k=1,np1
        rho(k)=(0.,0.)
   10 continue
   20 nu=nu+5
      if(nu.gt.numax) then
        ierr=numax
        goto 60
      end if
      do 30 k=1,np1
        rold(k)=rho(k)
   30 continue
      r=(0.,0.)
      do 40 j=1,nu
        j1=nu-j+1
        r=cmplx(b(j1),0.)/(z-cmplx(a(j1),0.)-r)
        if(j1.le.np1) rho(j1)=r
   40 continue
      do 50 k=1,np1
        if(cabs(rho(k)-rold(k)).gt.eps*cabs(rho(k))) goto 20
   50 continue
   60 if(n.eq.0) return
      do 70 k=2,np1
        rho(k)=rho(k)*rho(k-1)
   70 continue
      return
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > nu0jac.f
c
c
      function nu0jac(n,z,eps)
c
c This is an auxiliary function routine providing a starting backward
c recurrence index for the Jacobi measure that can be used in place
c of  nu0  in the routines  knum  and  dknum.
c
      complex z
      pi=4.*atan(1.)
      x=real(z)
      y=abs(aimag(z))
      if(x.lt.1.) then
        if(x.lt.-1.) angle=.5*(2.*pi+atan(y/(x-1.))+atan(y/(x+1.)))
        if(x.eq.-1.) angle=.5*(1.5*pi-atan(.5*y))
        if(x.gt.-1.) angle=.5*(pi+atan(y/(x-1.))+atan(y/(x+1.)))
      else
        if(x.eq.1.) angle=.5*(.5*pi+atan(.5*y))
        if(x.gt.1.) angle=.5*(atan(y/(x-1.))+atan(y/(x+1.)))
      end if
      x2=x*x
      y2=y*y
      r=((x2-y2-1.)**2+4.*x2*y2)**.25
      r=sqrt((x+r*cos(angle))**2+(y+r*sin(angle))**2)
      nu0jac=real(n+1)+.5*alog(1./eps)/alog(r)
      return
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > nu0lag.f
c
c
      function nu0lag(n,z,al,eps)
c
c This is an auxiliary function routine providing a starting backward
c recurrence index for the Laguerre measure that can be used in place
c of  nu0  in the routines  knum  and  dknum.
c
      complex z
      pi=4.*atan(1.)
      x=real(z)
      y=aimag(z)
      phi=.5*pi
      if(y.lt.0.) phi=1.5*pi
      if(x.eq.0.) goto 10
      phi=atan(y/x)
      if(y.gt.0. .and. x.gt.0.) goto 10
      phi=phi+pi
      if(x.lt.0.) goto 10
      phi=phi+pi
   10 nu0lag=(sqrt(real(n+1)+.5*(al+1.))+alog(1./eps)/(4.*(x*x+
     *  y*y)**.25*cos(.5*(phi-pi))))**2-.5*(al+1.)
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > nu0her.f
c
c
      function nu0her(n,z,eps)
c
c This is an auxiliary function routine providing a starting backward
c recurrence index for the Hermite measure that can be used in place
c of  nu0  in the routines  knum  and  dknum.
c
      complex z
      nu0her=2.*(sqrt(.5*real(n+1))+.25*alog(1./eps)/
     *  abs(aimag(z)))**2
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dknum.f
c
c
      subroutine dknum(n,nu0,numax,dx,dy,deps,da,db,drhor,drhoi,nu,
     *ierr,droldr,droldi)
c
c This is a double-precision version of the routine  knum.
c
      double precision dx,dy,deps,da(numax),db(numax),drhor(*),
     *drhoi(*),droldr(*),droldi(*),drr,dri,dden,dt
c
c The arrays  drhor,drhoi,droldr,droldi  are assumed to have
c dimension  n+1.
c
      ierr=0
      np1=n+1
      if(nu0.gt.numax) then
        ierr=nu0
        return
      end if
      if(nu0.lt.np1) nu0=np1
      nu=nu0-5
      do 10 k=1,np1
        drhor(k)=0.d0
        drhoi(k)=0.d0
   10 continue
   20 nu=nu+5
      if(nu.gt.numax) then
        ierr=numax
        goto 60
      end if
      do 30 k=1,np1
        droldr(k)=drhor(k)
        droldi(k)=drhoi(k)
   30 continue
      drr=0.d0
      dri=0.d0
      do 40 j=1,nu
        j1=nu-j+1
        dden=(dx-da(j1)-drr)**2+(dy-dri)**2
        drr=db(j1)*(dx-da(j1)-drr)/dden
        dri=-db(j1)*(dy-dri)/dden
        if(j1.le.np1) then
          drhor(j1)=drr
          drhoi(j1)=dri
        end if
   40 continue
      do 50 k=1,np1
        if((drhor(k)-droldr(k))**2+(drhoi(k)-droldi(k))**2.gt.
     *    deps*(drhor(k)**2+drhoi(k)**2)) goto 20
   50 continue
   60 if(n.eq.0) return
      do 70 k=2,np1
        dt=drhor(k)*drhor(k-1)-drhoi(k)*drhoi(k-1)
        drhoi(k)=drhor(k)*drhoi(k-1)+drhoi(k)*drhor(k-1)
        drhor(k)=dt
   70 continue
      return
      end 

C-END-OF-FILE

cat <<C-END-OF-FILE > kern.f
c
c
      subroutine kern(n,nu0,numax,z,eps,a,b,ker,nu,ierr,rold)
c
c This routine generates the kernels in the Gauss quadrature remainder
c term, namely
c
c           K(k)(z)=rho(k)(z)/pi(k)(z), k=0,1,2,...,n,
c
c where  rho(k)  are the output quantities of the routine  knum, and 
c pi(k)  the (monic) orthogonal polynomials. The results are returned 
c in the array  ker  as ker(k)=K(k-1)(z), k=1,2,...,n+1. All the other 
c input and output parameters have the same meaning as in the routine 
c knum.
c
      complex z,ker,rold,p0,p,pm1
      dimension a(numax),b(numax),ker(*),rold(*)
c
c The arrays  ker,rold  are assumed to have dimension  n+1.
c
      call knum(n,nu0,numax,z,eps,a,b,ker,nu,ierr,rold)
      p0=(0.,0.)
      p=(1.,0.)
      do 10 k=1,n
        pm1=p0
        p0=p
        p=(z-a(k))*p0-b(k)*pm1
        ker(k+1)=ker(k+1)/p
   10 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dkern.f
c
c
      subroutine dkern(n,nu0,numax,dx,dy,deps,da,db,dkerr,dkeri,
     *  nu,ierr,droldr,droldi)
c
c This is a double-precision version of the routine  kern.
c
      double precision dx,dy,deps,da(numax),db(numax),dkerr(*),
     *  dkeri(*),droldr(*),droldi(*),dp0r,dp0i,dpr,dpi,dpm1r,
     *  dpm1i,dden,dt
c
c The arrays  dkerr,dkeri,droldr,droldi  are assumed to have
c dimension  n+1.
c
      call dknum(n,nu0,numax,dx,dy,deps,da,db,dkerr,dkeri,nu,ierr,
     *  droldr,droldi)
      if(ierr.ne.0) return
      dp0r=0.d0
      dp0i=0.d0
      dpr=1.d0
      dpi=0.d0
      do 10 k=1,n
        dpm1r=dp0r
        dpm1i=dp0i
        dp0r=dpr
        dp0i=dpi
        dpr=(dx-da(k))*dp0r-dy*dp0i-db(k)*dpm1r
        dpi=(dx-da(k))*dp0i+dy*dp0r-db(k)*dpm1i
        dden=dpr**2+dpi**2
        dt=(dkerr(k+1)*dpr+dkeri(k+1)*dpi)/dden
        dkeri(k+1)=(dkeri(k+1)*dpr-dkerr(k+1)*dpi)/dden
        dkerr(k+1)=dt
   10 continue
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > gchri.f
c
c
      subroutine gchri(n,iopt,nu0,numax,eps,a,b,x,y,alpha,beta,nu,
     *  ierr,ierrc,fnu,rho,rold,s,s0,s1,s2)
c
c This routine implements the generalized Christoffel theorem, using
c the method of modified moments (cf. Section 4 of W. Gautschi,
c ``Minimal solutions of three-term recurrence relations and orthogonal
c polynomials'', Math. Comp. 36, 1981, 547-554). Given the recursion
c coefficients  a(k), b(k), k=0,1,...n, for the (monic) orthogonal
c polynomials with respect to some measure  dlambda(t), it generates
c the recursion coefficients  alpha(k), beta(k), k=0,1,2,...,n-1 for
c the measure
c
c         dlambda(t)/(t-x)        if iopt=1
c         dlambda(t)/{(t-x)**2+y**2} if iopt=2
c
c   Input:  n   - - the number of recurrence coefficients desired;
c                   type integer
c           iopt  - an integer selecting the desired weight distribution
c           nu0   - an integer estimating the starting backward 
c                   recurrence index; in the absence of any better
c                   choice, take  nu0 = 3*n
c           numax - an integer controlling termination of backward
c                   recursion in case of nonconvergence; a conservative 
c                   choice is  numax = 500
c           eps - - a relative error tolerance; type real
c           a,b - - arrays of dimension numax to be supplied with the
c                   recursion coefficients a(k)=alpha(k-1),b(k)=beta(k),
c                   k=1,2,...,numax, for the measure  dlambda
c           x,y - - real parameters defining the linear and quadratic
c                   divisors of  dlambda
c
c   Output: alpha,beta - arrays of dimension  n  containing the desired
c                   recursion coefficients  alpha(k-1), beta(k-1), k=1,
c                   2,...,n
c           nu  - - the backward recurrence index yielding convergence; 
c                   in case of nonconvergence,  nu  will have the value 
c                   numax
c           ierr  - an error flag, where
c                   ierr=0     on normal return
c                   ierr=1     if  iopt  is neither 1 nor 2
c                   ierr=nu0   if  nu0 > numax
c                   ierr=numax if the backward recurrence algorithm does
c                              not converge
c                   ierr=-1    if  n  is not in range
c           ierrc - an error flag inherited from the routine  cheb
c
c The arrays  fnu,s,s0,s1,s2  are working space. The routine calls
c upon the routines  knum  and  cheb.
c
      complex rho,rold,z
      dimension a(numax),b(numax),alpha(n),beta(n),fnu(*),rho(*),
     *rold(*),s(n),s0(*),s1(*),s2(*)
c
c The arrays  fnu,rho,rold,s0,s1,s2  are assumed to have dimension  2*n.
c
      if(n.lt.1) then
        ierr=-1
        return
      end if
      ierr=0
      nd=2*n
      ndm1=nd-1
c
c Linear divisor
c
      if(iopt.eq.1) then
c
c Generate the modified moments of  dlambda.
c
        z=cmplx(x,0.)
        call knum(ndm1,nu0,numax,z,eps,a,b,rho,nu,ierr,rold)
        do 10 k=1,nd
          fnu(k)=-real(rho(k))
   10   continue
c
c Compute the desired recursion coefficients by means of the modified
c Chebyshev algorithm.
c
        call cheb(n,a,b,fnu,alpha,beta,s,ierrc,s0,s1,s2)
        return
c
c Quadratic divisor
c
      else if(iopt.eq.2) then
c
c Generate the modified moments of  dlambda.
c
        y=abs(y)
        z=cmplx(x,y)
        call knum(ndm1,nu0,numax,z,eps,a,b,rho,nu,ierr,rold)
        do 20 k=1,nd
          fnu(k)=-aimag(rho(k))/y
   20   continue
c
c Compute the desired recursion coefficients by means of the modified
c Chebyshev algorithm.
c
        call cheb(n,a,b,fnu,alpha,beta,s,ierrc,s0,s1,s2)
        return
      else
        ierr=1
        return
      end if
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dgchri.f
c
c
      subroutine dgchri(n,iopt,nu0,numax,deps,da,db,dx,dy,dalpha,dbeta,
     *nu,ierr,ierrc,dnu,drhor,drhoi,droldr,droldi,ds,ds0,ds1,ds2)
c
c This is a double-precision version of the routine  gchri.
c
      double precision deps,da(numax),db(numax),dx,dy,dalpha(n),
     *dbeta(n),dnu(*),drhor(*),drhoi(*),droldr(*),droldi(*),
     *ds(n),ds0(*),ds1(*),ds2(*)
c
c The arrays  dnu,drhor,drhoi,droldr,droldi,ds0,ds1,ds2  are assumed
c to have dimension  2*n.
c
      if(n.lt.1) then
        ierr=-1
        return
      end if
      ierr=0
      nd=2*n
      ndm1=nd-1
      if(iopt.eq.1) then
        call dknum(ndm1,nu0,numax,dx,dy,deps,da,db,drhor,drhoi,nu,
     *    ierr,droldr,droldi)
        do 10 k=1,nd
          dnu(k)=-drhor(k)
   10   continue
        call dcheb(n,da,db,dnu,dalpha,dbeta,ds,ierrc,ds0,ds1,ds2)
        return
      else if(iopt.eq.2) then
        dy=dabs(dy)
        call dknum(ndm1,nu0,numax,dx,dy,deps,da,db,drhor,drhoi,nu,
     *    ierr,droldr,droldi)
        do 20 k=1,nd
          dnu(k)=-drhoi(k)/dy
   20   continue
        call dcheb(n,da,db,dnu,dalpha,dbeta,ds,ierrc,ds0,ds1,ds2)
        return
      else
        ierr=1
        return
      end if
      end

C-END-OF-FILE

###################################
#                                 #
# 6. GAUSS-TYPE QUADRATURE RULES  #
#                                 #
###################################

cat <<C-END-OF-FILE > gauss.f
c
c
      subroutine gauss(n,alpha,beta,eps,zero,weight,ierr,e)
c
c Given  n  and a measure  dlambda, this routine generates the n-point
c Gaussian quadrature formula
c 
c     integral over supp(dlambda) of f(x)dlambda(x)
c
c        = sum from k=1 to k=n of w(k)f(x(k)) + R(n;f).
c 
c The nodes are returned as  zero(k)=x(k) and the weights as 
c weight(k)=w(k), k=1,2,...,n. The user has to supply the recursion 
c coefficients  alpha(k), beta(k), k=0,1,2,...,n-1, for the measure 
c dlambda. The routine computes the nodes as eigenvalues, and the 
c weights in term of the first component of the respective normalized 
c eigenvectors of the n-th order Jacobi matrix associated with  dlambda.
c It uses a translation and adaptation of the algol procedure  imtql2,
c Numer. Math. 12, 1968, 377-383, by Martin and Wilkinson, as modified 
c by Dubrulle, Numer. Math. 15, 1970, 450. See also Handbook for 
c Autom. Comput., vol. 2 - Linear Algebra, pp.241-248, and the eispack
c routine  imtql2.
c
c        Input:  n - - the number of points in the Gaussian quadrature	
c                      formula; type integer
c                alpha,beta - - arrays of dimension  n  to be filled 
c                      with the values of  alpha(k-1), beta(k-1), k=1,2,
c                      ...,n
c                eps - the relative accuracy desired in the nodes
c                      and weights
c
c        Output: zero- array of dimension  n  containing the Gaussian 
c                      nodes (in increasing order)  zero(k)=x(k), k=1,2,
c                      ...,n
c                weight - array of dimension  n  containing the 
c                      Gaussian weights  weight(k)=w(k), k=1,2,...,n
c                ierr- an error flag equal to  0  on normal return,
c                      equal to  i  if the QR algorithm does not
c                      converge within 30 iterations on evaluating the 
c                      i-th eigenvalue, equal to  -1  if  n  is not in
c                      range, and equal to  -2  if one of the beta's is 
c                      negative.
c
c The array  e  is needed for working space.
c
      dimension alpha(n),beta(n),zero(n),weight(n),e(n)
      if(n.lt.1) then
        ierr=-1
        return
      end if
      ierr=0
      zero(1)=alpha(1)
      if(beta(1).lt.0.) then
        ierr=-2
        return
      end if
      weight(1)=beta(1)
      if (n.eq.1) return
      weight(1)=1.
      e(n)=0.
      do 100 k=2,n
        zero(k)=alpha(k)
        if(beta(k).lt.0.) then
          ierr=-2
          return
        end if
        e(k-1)=sqrt(beta(k))
        weight(k)=0.
  100 continue
      do 240 l=1,n
        j=0
c
c Look for a small subdiagonal element.
c
  105   do 110 m=l,n
          if(m.eq.n) goto 120
          if(abs(e(m)).le.eps*(abs(zero(m))+abs(zero(m+1)))) goto 120
  110   continue
  120   p=zero(l)
        if(m.eq.l) goto 240
        if(j.eq.30) goto 400
        j=j+1
c
c Form shift.
c
        g=(zero(l+1)-p)/(2.*e(l))
        r=sqrt(g*g+1.)
        g=zero(m)-p+e(l)/(g+sign(r,g))
        s=1.
        c=1.
        p=0.
        mml=m-l
c
c For i=m-1 step -1 until l do ...
c
        do 200 ii=1,mml
          i=m-ii
          f=s*e(i)
          b=c*e(i)
          if(abs(f).lt.abs(g)) goto 150
          c=g/f
          r=sqrt(c*c+1.)
          e(i+1)=f*r
          s=1./r
          c=c*s
          goto 160
  150     s=f/g
          r=sqrt(s*s+1.)
          e(i+1)=g*r
          c=1./r
          s=s*c
  160     g=zero(i+1)-p
          r=(zero(i)-g)*s +2.*c*b
          p=s*r
          zero(i+1)=g+p
          g=c*r-b
c
c Form first component of vector.
c
          f=weight(i+1)
          weight(i+1)=s*weight(i)+c*f
          weight(i)=c*weight(i)-s*f
  200   continue
        zero(l)=zero(l)-p
        e(l)=g
        e(m)=0.
        goto 105
  240 continue
c
c Order eigenvalues and eigenvectors.
c
      do 300 ii=2,n
        i=ii-1
        k=i
        p=zero(i)
        do 260 j=ii,n
          if(zero(j).ge.p) goto 260
          k=j
          p=zero(j)
  260   continue
        if(k.eq.i) goto 300
        zero(k)=zero(i)
        zero(i)=p
        p=weight(i)
        weight(i)=weight(k)
        weight(k)=p
  300 continue
      do 310 k=1,n
        weight(k)=beta(1)*weight(k)*weight(k)
  310 continue
      return
c
c Set error - no convergence to an eigenvalue after 30 iterations.
c
  400 ierr=l
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dgauss.f
c
c
      subroutine dgauss(n,dalpha,dbeta,deps,dzero,dweigh,ierr,de)
c
c This is a double-precision version of the routine  gauss.
c
      double precision dalpha,dbeta,deps,dzero,dweigh,de,dp,dg,dr,
     *ds,dc,df,db
      dimension dalpha(n),dbeta(n),dzero(n),dweigh(n),de(n)
      if(n.lt.1) then
        ierr=-1
        return
      end if
      ierr=0
      dzero(1)=dalpha(1)
      if(dbeta(1).lt.0.d0) then
        ierr=-2
        return
      end if
      dweigh(1)=dbeta(1)
      if (n.eq.1) return
      dweigh(1)=1.d0
      de(n)=0.d0
      do 100 k=2,n
        dzero(k)=dalpha(k)
        if(dbeta(k).lt.0.d0) then
          ierr=-2
          return
        end if
        de(k-1)=dsqrt(dbeta(k))
        dweigh(k)=0.d0
  100 continue
      do 240 l=1,n
        j=0
  105   do 110 m=l,n
          if(m.eq.n) goto 120
          if(dabs(de(m)).le.deps*(dabs(dzero(m))+dabs(dzero(m+1)))) 
     *      goto 120
  110   continue
  120   dp=dzero(l)
        if(m.eq.l) goto 240
        if(j.eq.30) goto 400
        j=j+1
        dg=(dzero(l+1)-dp)/(2.d0*de(l))
        dr=dsqrt(dg*dg+1.d0)
        dg=dzero(m)-dp+de(l)/(dg+dsign(dr,dg))
        ds=1.d0
        dc=1.d0
        dp=0.d0
        mml=m-l
        do 200 ii=1,mml
          i=m-ii
          df=ds*de(i)
          db=dc*de(i)
          if(dabs(df).lt.dabs(dg)) goto 150
          dc=dg/df
          dr=dsqrt(dc*dc+1.d0)
          de(i+1)=df*dr
          ds=1.d0/dr
          dc=dc*ds
          goto 160
  150     ds=df/dg
          dr=dsqrt(ds*ds+1.d0)
          de(i+1)=dg*dr
          dc=1.d0/dr
          ds=ds*dc
  160     dg=dzero(i+1)-dp
          dr=(dzero(i)-dg)*ds+2.d0*dc*db
          dp=ds*dr
          dzero(i+1)=dg+dp
          dg=dc*dr-db
          df=dweigh(i+1)
          dweigh(i+1)=ds*dweigh(i)+dc*df
          dweigh(i)=dc*dweigh(i)-ds*df
  200   continue
        dzero(l)=dzero(l)-dp
        de(l)=dg
        de(m)=0.d0
        goto 105
  240 continue
      do 300 ii=2,n
        i=ii-1
        k=i
        dp=dzero(i)
        do 260 j=ii,n
          if(dzero(j).ge.dp) goto 260
          k=j
          dp=dzero(j)
  260   continue
        if(k.eq.i) goto 300
        dzero(k)=dzero(i)
        dzero(i)=dp
        dp=dweigh(i)
        dweigh(i)=dweigh(k)
        dweigh(k)=dp
  300 continue
      do 310 k=1,n
        dweigh(k)=dbeta(1)*dweigh(k)*dweigh(k)
  310 continue
      return
  400 ierr=l
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > radau.f
c
c
      subroutine radau(n,alpha,beta,end,zero,weight,ierr,e,a,b)
c
c Given  n  and a measure  dlambda, this routine generates the 
c (n+1)-point Gauss-Radau quadrature formula
c
c   integral over supp(dlambda) of f(t)dlambda(t)
c
c     = w(0)f(x(0)) + sum from k=1 to k=n of w(k)f(x(k)) + R(n;f).
c
c The nodes are returned as  zero(k)=x(k), the weights as  weight(k)
c =w(k), k=0,1,2,...,n. The user has to supply the recursion 
c coefficients  alpha(k), beta(k), k=0,1,2,...,n, for the measure
c dlambda. The nodes and weights are computed as eigenvalues and
c in terms of the first component of the respective normalized
c eigenvectors of a slightly modified Jacobi matrix of order  n+1.
c To do this, the routine calls upon the subroutine  gauss. It also
c uses the function subroutine  r1mach.
c
c    Input:  n - -  the number of interior points in the Gauss-Radau
c                   formula; type integer
c            alpha,beta - arrays of dimension  n+1  to be supplied with
c                   the recursion coefficients  alpha(k-1), beta(k-1),
c                   k=1,2,...,n+1; the coefficient  alpha(n+1)  is not
c                   used by the routine
c            end -  the prescribed endpoint  x(0)  of the Gauss-Radau
c                   formula; type real
c
c    Output: zero - array of dimension  n+1  containing the nodes (in
c                   increasing order)  zero(k)=x(k), k=0,1,2,...,n
c            weight-array of dimension  n+1  containing the weights
c                   weight(k)=w(k), k=0,1,2,...,n
c            ierr - an error flag inherited from the routine  gauss
c
c The arrays  e,a,b  are needed for working space.
c
      dimension alpha(*),beta(*),zero(*),weight(*),e(*),a(*),b(*)
c
c The arrays  alpha,beta,zero,weight,e,a,b  are assumed to have
c dimension  n+1.
c
      epsma=r1mach(3)
c
c epsma is the machine single precision.
c
      np1=n+1
      do 10 k=1,np1
        a(k)=alpha(k)
        b(k)=beta(k)
   10 continue
      p0=0.
      p1=1.
      do 20 k=1,n
        pm1=p0
        p0=p1
        p1=(end-a(k))*p0-b(k)*pm1
   20 continue
      a(np1)=end-b(np1)*p0/p1
      call gauss(np1,a,b,epsma,zero,weight,ierr,e)
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dradau.f
c
c
      subroutine dradau(n,dalpha,dbeta,dend,dzero,dweigh,ierr,de,
     *da,db)
c
c This is a double-precision version of the routine  radau.
c
      double precision dend,depsma,dp0,dp1,dpm1,dalpha(*),dbeta(*),
     *dzero(*),dweigh(*),de(*),da(*),db(*),d1mach
c
c The arrays  dalpha,dbeta,dzero,dweigh,de,da,db  are assumed to have
c dimension  n+1.
c
      depsma=d1mach(3)
c
c depsma is the machine double precision.
c
      np1=n+1
      do 10 k=1,np1
        da(k)=dalpha(k)
        db(k)=dbeta(k)
   10 continue
      dp0=0.d0
      dp1=1.d0
      do 20 k=1,n
        dpm1=dp0
        dp0=dp1
        dp1=(dend-da(k))*dp0-db(k)*dpm1
   20 continue
      da(np1)=dend-db(np1)*dp0/dp1
      call dgauss(np1,da,db,depsma,dzero,dweigh,ierr,de)
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > lob.f
c
c
      subroutine lob(n,alpha,beta,aleft,right,zero,weight,ierr,e,a,b)
c
c Given  n  and a measure  dlambda, this routine generates the 
c (n+2)-point Gauss-Lobatto quadrature formula
c 
c   integral over supp(dlambda) of f(x)dlambda(x)
c
c      = w(0)f(x(0)) + sum from k=1 to k=n of w(k)f(x(k))  
c
c              + w(n+1)f(x(n+1)) + R(n;f).
c
c The nodes are returned as  zero(k)=x(k), the weights as  weight(k)
c =w(k), k=0,1,...,n,n+1. The user has to supply the recursion
c coefficients  alpha(k), beta(k), k=0,1,...,n,n+1, for the measure
c dlambda. The nodes and weights are computed in terms of the
c eigenvalues and first component of the normalized eigenvectors of
c a slightly modified Jacobi matrix of order  n+2. The routine calls 
c upon the subroutine  gauss  and the function subroutine  r1mach.
c
c   Input:  n - -  the number of interior points in the Gauss-Lobatto
c                  formula; type integer
c           alpha,beta - arrays of dimension  n+2  to be supplied with
c                  the recursion coefficients  alpha(k-1), beta(k-1),
c                  k=1,2,...,n+2, of the underlying measure; the
c                  routine does not use  alpha(n+2), beta(n+2)
c           aleft,right - the prescribed left and right endpoints 
c                  x(0)  and  x(n+1)  of the Gauss-Lobatto formula
c
c   Output: zero - an array of dimension  n+2  containing the nodes (in 
c                  increasing order)  zero(k)=x(k), k=0,1,...,n,n+1
c           weight-an array of dimension  n+2  containing the weights 
c                  weight(k)=w(k), k=0,1,...,n,n+1
c           ierr - an error flag inherited from the routine  gauss
c
c The arrays  e,a,b  are needed for working space.
c
      dimension alpha(*),beta(*),zero(*),weight(*),e(*),a(*),b(*)
c
c The arrays  alpha,beta,zero,weight,e,a,b  are assumed to have
c dimension  n+2.
c
      epsma=r1mach(3)
c
c epsma is the machine single precision.
c
      np1=n+1
      np2=n+2
      do 10 k=1,np2
        a(k)=alpha(k)
        b(k)=beta(k)
   10 continue
      p0l=0.
      p0r=0.
      p1l=1.
      p1r=1.
      do 20 k=1,np1
        pm1l=p0l
        p0l=p1l
        pm1r=p0r
        p0r=p1r
        p1l=(aleft-a(k))*p0l-b(k)*pm1l
        p1r=(right-a(k))*p0r-b(k)*pm1r
   20 continue
      det=p1l*p0r-p1r*p0l
      a(np2)=(aleft*p1l*p0r-right*p1r*p0l)/det
      b(np2)=(right-aleft)*p1l*p1r/det
      call gauss(np2,a,b,epsma,zero,weight,ierr,e)
      return
      end

C-END-OF-FILE

cat <<C-END-OF-FILE > dlob.f
c
c

      subroutine dlob(n,dalpha,dbeta,dleft,dright,dzero,dweigh,
     *ierr,de,da,db)
c
c This is a double-precision version of the routine  lob.
c
      double precision dleft,dright,depsma,dp0l,dp0r,dp1l,dp1r,dpm1l,
     *dpm1r,ddet,dalpha(*),dbeta(*),dzero(*),dweigh(*),de(*),da(*),
     *db(*),d1mach
c
c The arrays  dalpha,dbeta,dzero,dweigh,de,da,db  are assumed to have
c dimension  n+2.
c
      depsma=d1mach(3)
c
c depsma is the machine double precision.
c
      np1=n+1
      np2=n+2
      do 10 k=1,np2
        da(k)=dalpha(k)
        db(k)=dbeta(k)
   10 continue
      dp0l=0.d0
      dp0r=0.d0
      dp1l=1.d0
      dp1r=1.d0
      do 20 k=1,np1
        dpm1l=dp0l
        dp0l=dp1l
        dpm1r=dp0r
        dp0r=dp1r
        dp1l=(dleft-da(k))*dp0l-db(k)*dpm1l
        dp1r=(dright-da(k))*dp0r-db(k)*dpm1r
   20 continue
      ddet=dp1l*dp0r-dp1r*dp0l
      da(np2)=(dleft*dp1l*dp0r-dright*dp1r*dp0l)/ddet
      db(np2)=(dright-dleft)*dp1l*dp1r/ddet
      call dgauss(np2,da,db,depsma,dzero,dweigh,ierr,de)
      return
      end

C-END-OF-FILE
