! C05ADF Example Program Text ! Mark 24 Release. NAG Copyright 2012. Module c05adfe_mod ! C05ADF Example Program Module: ! Parameters and User-defined Routines ! .. Use Statements .. Use nag_library, Only: nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nout = 6 Contains Function f(x) ! .. Function Return Value .. Real (Kind=nag_wp) :: f ! .. Scalar Arguments .. Real (Kind=nag_wp), Intent (In) :: x ! .. Intrinsic Procedures .. Intrinsic :: exp ! .. Executable Statements .. f = exp(-x) - x Return End Function f End Module c05adfe_mod Program c05adfe ! C05ADF Example Main Program ! .. Use Statements .. Use nag_library, Only: c05adf, nag_wp Use c05adfe_mod, Only: f, nout ! .. Implicit None Statement .. Implicit None ! .. Local Scalars .. Real (Kind=nag_wp) :: a, b, eps, eta, x Integer :: ifail ! .. Executable Statements .. Write (nout,*) 'C05ADF 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 c05adf(a,b,eps,eta,f,x,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 c05adfe