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

NAG FL Interface Introduction
Example description
    Program e01bhfe

!     E01BHF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: e01bhf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: a, b, pint
      Integer                          :: ifail, ioerr, n, r
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: d(:), f(:), x(:)
!     .. Executable Statements ..
      Write (nout,*) 'E01BHF Example Program Results'

!     Skip heading in data file
      Read (nin,*)

      Read (nin,*) n
      Allocate (d(n),f(n),x(n))

      Do r = 1, n
        Read (nin,*) x(r), f(r), d(r)
      End Do

      Write (nout,*)
      Write (nout,*) '                               Integral'
      Write (nout,*) '          A            B     over (A,B)'

data: Do
        Read (nin,*,Iostat=ioerr) a, b

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call e01bhf(n,x,f,d,a,b,pint,ifail)

        Write (nout,99999) a, b, pint
      End Do data

99999 Format (1X,3F13.4)
    End Program e01bhfe