NAG Library Manual, Mark 27.2
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program e02ajfe

!     E02AJF Example Program Text

!     Mark 27.2 Release. NAG Copyright 2021.

!     .. 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)               :: aintc(laint)
!     .. Executable Statements ..
      Write (nout,*) 'E02AJF Example Program Results'

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

      xa = 0.0E0_nag_wp
      xb = 2.0E0_nag_wp

      ifail = 0
      Call e02akf(np1+1,xmin,xmax,aintc,1,laint,xa,ra,ifail)

      ifail = 0
      Call e02akf(np1+1,xmin,xmax,aintc,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