# NAG FL Interfaceg01kaf (pdf_​normal)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

g01kaf returns the value of the probability density function (PDF) for the Normal (Gaussian) distribution with mean $\mu$ and variance ${\sigma }^{2}$ at a point $x$.

## 2Specification

Fortran Interface
 Function g01kaf ( x, xstd,
 Real (Kind=nag_wp) :: g01kaf Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: x, xmean, xstd
#include <nag.h>
 double g01kaf_ (const double *x, const double *xmean, const double *xstd, Integer *ifail)
The routine may be called by the names g01kaf or nagf_stat_pdf_normal.

## 3Description

The Normal distribution has probability density function (PDF)
 $f(x) = 1 σ ⁢ 2π e -(x-μ)2/2σ2 , σ>0 .$

None.

## 5Arguments

1: $\mathbf{x}$Real (Kind=nag_wp) Input
On entry: $x$, the value at which the PDF is to be evaluated.
2: $\mathbf{xmean}$Real (Kind=nag_wp) Input
On entry: $\mu$, the mean of the Normal distribution.
3: $\mathbf{xstd}$Real (Kind=nag_wp) Input
On entry: $\sigma$, the standard deviation of the Normal distribution.
Constraint: $z<{\mathbf{xstd}}\sqrt{2\pi }<1.0/z$, where $z={\mathbf{x02amf}}\left(\right)$, the safe range parameter.
4: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
If ${\mathbf{ifail}}\ne {\mathbf{0}}$, then g01kaf returns $0.0$.
${\mathbf{ifail}}=1$
On entry, ${\mathbf{xstd}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{xstd}}×\sqrt{2.0\pi }>U$, where $U$ is the safe range parameter as defined by x02amf.
${\mathbf{ifail}}=2$
Computation abandoned owing to underflow of $\frac{1}{\left(\sigma ×\sqrt{2\pi }\right)}$.
${\mathbf{ifail}}=3$
Computation abandoned owing to an internal calculation overflowing.
This rarely occurs, and is the result of extreme values of the arguments x, xmean or xstd.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

g01kaf is not threaded in any implementation.

None.

## 10Example

This example prints the value of the Normal distribution PDF at four different points x with differing xmean and xstd.

### 10.1Program Text

Program Text (g01kafe.f90)

### 10.2Program Data

Program Data (g01kafe.d)

### 10.3Program Results

Program Results (g01kafe.r)