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

NAG FL Interface Introduction
Example description
    Program e01abfe

!     E01ABF Example Program Text

!     Mark 30.2 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: e01abf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: p
      Integer                          :: i, ifail, n, n1, n2, r
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:), g(:)
!     .. Executable Statements ..
      Write (nout,*) 'E01ABF Example Program Results'

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

      Read (nin,*) n, p
      n1 = 2*n
      n2 = n1 + 1
      Allocate (a(n1),g(n2))

      Read (nin,*)(a(i),i=1,n1)

      ifail = 0
      Call e01abf(n,p,a,g,n1,n2,ifail)

      Write (nout,*)

      Do r = 0, n - 1
        Write (nout,99999) 'Central differences order ', r, ' of Y0 =',        &
          g(2*r+1)
        Write (nout,99998) '                               Y1 =', g(2*r+2)
      End Do

      Write (nout,*)
      Write (nout,99998) 'Function value at interpolation point =', g(n2)

99999 Format (1X,A,I1,A,F12.5)
99998 Format (1X,A,F12.5)
    End Program e01abfe