Program c05avfe
! C05AVF Example Program Text
! Mark 26.1 Release. NAG Copyright 2016.
! .. 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