NAG Library Manual, Mark 30
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program g01mufe

!     G01MUF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g01muf, g01zuf, nag_wp, x02alf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: mode = 0, nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: beta2, c1, c2, rkappa, x, xl, xu, y
      Integer                          :: ifail
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: rcomm(322)
!     .. Executable Statements ..
      Write (nout,*) 'G01MUF Example Program Results'
      Write (nout,*)

!     Skip heading in data file
      Read (nin,*)
      c1 = -x02alf()
      c2 = -x02alf()

!     Display titles
      Write (nout,*) '  X     RKAPPA    BETA2        Y        IFAIL'
      Write (nout,*)

d_lp: Do
        Read (nin,*,Iostat=ifail) x, rkappa, beta2
        If (ifail/=0) Then
          Exit d_lp
        End If

        If ((rkappa/=c1) .Or. (beta2/=c2)) Then
!         Initialize the RCOMM array if RKAPPA or BETA2 has changed
          ifail = 0
          Call g01zuf(rkappa,beta2,mode,xl,xu,rcomm,ifail)
        End If

!       Compute the value of the Vavilov density function
        ifail = 0
        y = g01muf(x,rcomm,ifail)

!       Display results
        Write (nout,99999) x, rkappa, beta2, y, ifail
        c1 = rkappa
        c2 = beta2
      End Do d_lp

99999 Format (1X,F4.1,5X,F4.1,5X,F4.1,3X,1P,E12.4,I6)
    End Program g01mufe