Program d01gafe
! D01GAF Example Program Text
! Mark 30.0 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: d01gaf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: ans, er
Integer :: i, ifail, n
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: x(:), y(:)
! .. Executable Statements ..
Write (nout,*) 'D01GAF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n
Allocate (x(n),y(n))
Read (nin,*)(x(i),y(i),i=1,n)
ifail = -1
Call d01gaf(x,y,n,ans,er,ifail)
Select Case (ifail)
Case (0)
Write (nout,*)
Write (nout,99999) 'Integral = ', ans, ' Estimated error = ', er
Case (1)
Write (nout,*)
Write (nout,*) 'Less than 4 points supplied'
Case (2)
Write (nout,*)
Write (nout,*) 'Points not in increasing or decreasing order'
Case (3)
Write (nout,*)
Write (nout,*) 'Points not all distinct'
End Select
99999 Format (1X,A,F7.4,A,F7.4)
End Program d01gafe