PROGRAM c05avfe ! C05AVF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : c05avf, nag_wp ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: boundl, boundu, fx, h, x, y INTEGER :: ifail, ind ! .. Local Arrays .. REAL (KIND=nag_wp) :: c(11) ! .. Executable Statements .. WRITE (nout,*) 'C05AVF Example Program Results' WRITE (nout,*) x = 3.0E0_nag_wp h = 0.1E0_nag_wp boundl = 0.0E0_nag_wp boundu = 4.0E0_nag_wp ind = 1 ifail = -1 REVCOMM: DO CALL c05avf(x,fx,h,boundl,boundu,y,c,ind,ifail) IF (ind==0) THEN EXIT REVCOMM END IF fx = x*x - 3.0E0_nag_wp*x + 2.0E0_nag_wp END DO REVCOMM IF (ifail==0) THEN WRITE (nout,*) 'Interval containing root is [X,Y], where' WRITE (nout,99999) 'X =', x, ' Y =', y WRITE (nout,*) 'Values of f at X and Y are' WRITE (nout,99999) 'f(X) =', fx, ' f(Y) =', c(1) END IF 99999 FORMAT (1X,2(A,F12.4)) END PROGRAM c05avfe