! C05AYF Example Program Text
! Mark 30.2 Release. NAG Copyright 2024.
Module c05ayfe_mod
! C05AYF Example Program Module:
! Parameters and User-defined Routines
! .. Use Statements ..
Use nag_library, Only: nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Accessibility Statements ..
Private
Public :: f
! .. Parameters ..
Integer, Parameter, Public :: nout = 6
Contains
Function f(x,iuser,ruser)
! .. Function Return Value ..
Real (Kind=nag_wp) :: f
! .. Scalar Arguments ..
Real (Kind=nag_wp), Intent (In) :: x
! .. Array Arguments ..
Real (Kind=nag_wp), Intent (Inout) :: ruser(*)
Integer, Intent (Inout) :: iuser(*)
! .. Intrinsic Procedures ..
Intrinsic :: exp
! .. Executable Statements ..
f = exp(-x) - x
Return
End Function f
End Module c05ayfe_mod
Program c05ayfe
! C05AYF Example Main Program
! .. Use Statements ..
Use c05ayfe_mod, Only: f, nout
Use nag_library, Only: c05ayf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Local Scalars ..
Real (Kind=nag_wp) :: a, b, eps, eta, x
Integer :: ifail
! .. Local Arrays ..
Real (Kind=nag_wp) :: ruser(1)
Integer :: iuser(1)
! .. Executable Statements ..
Write (nout,*) 'C05AYF Example Program Results'
a = 0.0E0_nag_wp
b = 1.0E0_nag_wp
eps = 1.0E-5_nag_wp
eta = 0.0E0_nag_wp
ifail = -1
Call c05ayf(a,b,eps,eta,f,x,iuser,ruser,ifail)
Write (nout,*)
Select Case (ifail)
Case (0)
Write (nout,99999) 'Zero at x =', x
Case (2,3)
Write (nout,99999) 'Final point = ', x
End Select
99999 Format (1X,A,F12.5)
End Program c05ayfe