PROGRAM e01bgfe ! E01BGF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e01bgf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: step INTEGER :: i, ifail, m, n, r ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: d(:), f(:), pd(:), pf(:), px(:), x(:) ! .. Intrinsic Functions .. INTRINSIC min, real ! .. Executable Statements .. WRITE (nout,*) 'E01BGF 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 READ (nin,*) m ALLOCATE (pd(m),pf(m),px(m)) ! Compute M equally spaced points from X(1) to X(N). step = (x(n)-x(1))/real(m-1,kind=nag_wp) DO i = 1, m px(i) = min(x(1)+real(i-1,kind=nag_wp)*step,x(n)) END DO ifail = 0 CALL e01bgf(n,x,f,d,m,px,pf,pd,ifail) WRITE (nout,*) WRITE (nout,*) ' Interpolated Interpolated' WRITE (nout,*) ' Abscissa Value Derivative' DO i = 1, m WRITE (nout,99999) px(i), pf(i), pd(i) END DO 99999 FORMAT (1X,2F15.4,1P,E15.3) END PROGRAM e01bgfe