C$TEST BURB
C TO RUN AS A MAIN PROGRAM REMOVE NEXT LINE
      SUBROUTINE BURB
C***********************************************************************
C
C  EXAMPLE OF USE OF THE PORT PROGRAM BURM1
C
C***********************************************************************
      INTEGER IWRITE,I,ITOL,MAXITR
      REAL XMESH(11), F(11), P(3), Q(3), DELTA, STEP, X, XL, XR,
     1 ERR1(11), ERR2(11), TCHBP
C
      DATAP(1)/ 25.0/,  P(2)/ 12.0/,  P(3)/ 1.0/
      DATAQ(1)/ 25.0/,  Q(2)/-12.0/,  Q(3)/ 1.0/
C
      IWRITE = I1MACH(2)
C
      XL = -1.0E0
      XR = 1.0E0
      STEP = (XR-XL)/FLOAT(10)
      DO 10 I=1,11
         XMESH(I) = XL + FLOAT(I-1)*STEP
         F(I) = EXP(XMESH(I))
  10  CONTINUE
C
C    COMPUTE THE ERROR IN THE INITIAL APPROXIMATION.
C    USE THE FUNCTION TCHBP TO EVALUATE A POLYNOMIAL
C    GIVEN IN TERMS OF ITS TCHEBYCHEFF EXPANSION.
C
      DO 20 I=1,11
         X = XMESH(I)
  20     ERR1(I) = F(I) - TCHBP(2,P,X,XL,XR)/TCHBP(2,Q,X,XL,XR)
C
C    COMPUTE THE APPROXIMATION.  USE NO MORE THAN 10 ITERATIONS
C    AND STOP WHEN THE EXTREMALS AGREE TO 10 PER CENT.
C
      MAXITR = 10
      ITOL = 1
      CALL BURM1(11, XMESH, F, MAXITR, ITOL, 2, 2, P, Q, DELTA)
C
C    PRINT OUT THE ERRORS.
C
      WRITE (IWRITE,99)
  99  FORMAT (7H   MESH, 4X, 3HEXP, 7X, 4HERR1, 8X, 4HERR2)
      DO 30 I=1,11
         X = XMESH(I)
         ERR2(I) = F(I) - TCHBP(2,P,X,XL,XR)/TCHBP(2,Q,X,XL,XR)
         WRITE (IWRITE,98) XMESH(I), F(I), ERR1(I), ERR2(I)
  98      FORMAT (2F8.4,1P2E12.2)
  30  CONTINUE
      STOP
      END
