PROGRAM e01aafe ! E01AAF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e01aaf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: x INTEGER :: i, j, k, n, n1, n2 ! .. Local Arrays .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:), b(:), c(:) ! .. Executable Statements .. WRITE (nout,*) 'E01AAF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n, x n1 = n + 1 n2 = n*(n+1)/2 ALLOCATE (a(n1),b(n1),c(n2)) READ (nin,*) (a(i),i=1,n1) READ (nin,*) (b(i),i=1,n1) CALL e01aaf(a,b,c,n1,n2,n,x) WRITE (nout,*) WRITE (nout,*) 'Interpolated values' k = 1 DO i = 1, n - 1 WRITE (nout,99999) (c(j),j=k,k+n-i) k = k + n - i + 1 END DO WRITE (nout,*) WRITE (nout,99998) 'Interpolation point = ', x WRITE (nout,*) WRITE (nout,99998) 'Function value at interpolation point = ', c(n2) 99999 FORMAT (1X,6F12.5) 99998 FORMAT (1X,A,F12.5) END PROGRAM e01aafe