    PROGRAM e02ajfe

!      E02AJF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : e02ajf, e02akf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       REAL (KIND=nag_wp), PARAMETER   :: xmax = 2.5E0_nag_wp
       REAL (KIND=nag_wp), PARAMETER   :: xmin = -0.5E0_nag_wp
       INTEGER, PARAMETER              :: nout = 6, np1 = 7
       INTEGER, PARAMETER              :: la = np1
       INTEGER, PARAMETER              :: laint = np1 + 1
       REAL (KIND=nag_wp), PARAMETER   :: a(la) = (/ 2.53213E0_nag_wp,         &
                                          1.13032E0_nag_wp, 0.27150E0_nag_wp,  &
                                          0.04434E0_nag_wp, 0.00547E0_nag_wp,  &
                                          0.00054E0_nag_wp, 0.00004E0_nag_wp/)
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: ra, rb, res, xa, xb
       INTEGER                         :: ifail
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: aint(laint)
!      .. Executable Statements ..
       WRITE (nout,*) 'E02AJF Example Program Results'

       ifail = 0
       CALL e02ajf(np1,xmin,xmax,a,1,la,0.0E0_nag_wp,aint,1,laint,ifail)

       xa = 0.0E0_nag_wp
       xb = 2.0E0_nag_wp

       ifail = 0
       CALL e02akf(np1+1,xmin,xmax,aint,1,laint,xa,ra,ifail)

       ifail = 0
       CALL e02akf(np1+1,xmin,xmax,aint,1,laint,xb,rb,ifail)

       res = rb - ra

       WRITE (nout,*)
       WRITE (nout,99999) 'Value of definite integral is ', res

99999  FORMAT (1X,A,F10.4)
    END PROGRAM e02ajfe
