PROGRAM e02acfe ! E02ACF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : e02acf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: m1 = 6, n = 21, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: ref, s, t, z INTEGER :: i, j ! .. Local Arrays .. REAL (KIND=nag_wp) :: a(m1), x(n), y(n) ! .. Intrinsic Functions .. INTRINSIC exp, real ! .. Executable Statements .. WRITE (nout,*) 'E02ACF Example Program Results' x(1:n) = real((/(i-1,i=1,n)/),kind=nag_wp)/real(n-1,kind=nag_wp) y(1:n) = exp(x(1:n)) CALL e02acf(x,y,n,a,m1,ref) WRITE (nout,*) WRITE (nout,*) ' Polynomial coefficients' WRITE (nout,99998) (a(i),i=1,m1) WRITE (nout,*) WRITE (nout,99997) ' Reference deviation = ', ref WRITE (nout,*) WRITE (nout,*) ' X exp(X) Fit Residual' DO j = 1, 11 z = real(j-1,kind=nag_wp)*0.1E0_nag_wp s = a(m1) DO i = m1 - 1, 1, -1 s = s*z + a(i) END DO t = exp(z) WRITE (nout,99999) z, s, t, s - t END DO 99999 FORMAT (1X,F5.2,2F9.4,E11.2) 99998 FORMAT (6X,E12.4) 99997 FORMAT (1X,A,E10.2) END PROGRAM e02acfe