Try out NAG Library functions

Explore NAG maths and stats routines with interactive demos
Function ID
G01EAF
Name
nagf_stat_prob_normal
Description
Probabilities for the standard Normal distribution
Keywords
CDF, cumulative distribution function | Normal distribution | lower tail probability | probability | two-tail probability | upper tail probability
Four values of TAIL and X are input and the probabilities calculated and printed.
The example data reflects that shown in the "Example" section of the routine documentation. You can change this here to try alternative inputs. The formatting will need to be kept as it is here, otherwise the program is likely to fail to run correctly.

Please note that incompatible data will however cause the example output to display an error message. These error messages are fully explained in the Routine document
    Program g01eafe

!     G01EAF Example Program Text

!     Mark 26 Release. NAG Copyright 2016.

!     .. Use Statements ..
      Use nag_library, Only: g01eaf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: prob, x
      Integer                          :: ifail
      Character (1)                    :: tail
!     .. Executable Statements ..
      Write (nout,*) 'G01EAF Example Program Results'
      Write (nout,*)

!     Skip heading in data file
      Read (nin,*)

!     Display title
      Write (nout,*) ' TAIL    X      Probability'
      Write (nout,*)

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

!       Calculate probability
        ifail = 0
        prob = g01eaf(tail,x,ifail)

!       Display results
        Write (nout,99999) tail, x, prob
      End Do d_lp

99999 Format (3X,A1,4X,F5.2,6X,F7.4)
    End Program g01eafe
The NAG Library
The world’s largest collection of robust, documented, tested and maintained numerical algorithms.
Learn more here or contact us for purchasing information