Program e02akfe

!     E02AKF Example Program Text

!     Mark 25 Release. NAG Copyright 2014.

!     .. Use Statements ..
      Use nag_library, Only: 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
      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)               :: res, x
      Integer                          :: i, ifail, m
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'E02AKF Example Program Results'

      m = 4

      Do i = 1, m
        x = (xmin*real(m-i,kind=nag_wp)+xmax*real(i-1,kind=nag_wp))/ &
          real(m-1,kind=nag_wp)

        ifail = 0
        Call e02akf(np1,xmin,xmax,a,1,la,x,res,ifail)

        If (i==1) Then
          Write (nout,*)
          Write (nout,*) '   I   Argument  Value of polynomial'
        End If

        Write (nout,99999) i, x, res
      End Do

99999 Format (1X,I4,F10.4,4X,F9.4)
    End Program e02akfe