PROGRAM e01befe ! E01BEF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e01bef, e01bff, 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(:), pf(:), px(:), x(:) ! .. Intrinsic Functions .. INTRINSIC min, real ! .. Executable Statements .. WRITE (nout,*) 'E01BEF 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) END DO ifail = 0 CALL e01bef(n,x,f,d,ifail) READ (nin,*) m ALLOCATE (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 e01bff(n,x,f,d,m,px,pf,ifail) WRITE (nout,*) WRITE (nout,*) ' Interpolated' WRITE (nout,*) ' Abscissa Value' DO i = 1, m WRITE (nout,99999) px(i), pf(i) END DO 99999 FORMAT (1X,F13.4,2X,F13.4) END PROGRAM e01befe