/* nag_stat_pdf_normal (g01kac) Example Program.
*
* Copyright 2021 Numerical Algorithms Group.
*
* Mark 27.3, 2021.
*/
/* Pre-processor includes */
#include <math.h>
#include <nag.h>
#include <stdio.h>
#include <string.h>
int main(void) {
/*Integer scalar and array declarations */
Integer exit_status = 0;
Integer i, ndata;
/*Double scalar and array declarations */
double xmean, xstd, f, x;
/* Nag Types */
NagError fail;
INIT_FAIL(fail);
printf("nag_stat_pdf_normal (g01kac) Example Program Results\n\n");
scanf("%*[^\n] ");
scanf("%" NAG_IFMT "%*[^\n] ", &ndata);
printf("%14s%17s%17s%17s\n\n", "X", "XMEAN", "XSTD", "RESULT");
for (i = 0; i < ndata; i++) {
scanf("%lf%lf%lf%*[^\n] ", &x, &xmean, &xstd);
/*
* nag_stat_pdf_normal (g01kac)
* Calculates the value for the probability density function of
* the normal distribution at a chosen point.
*/
f = nag_stat_pdf_normal(x, xmean, xstd, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_stat_pdf_normal (g01kac).\n%s\n", fail.message);
exit_status = 1;
goto END;
}
printf("%18.5e%17.5e%17.5e%17.5e\n", x, xmean, xstd, f);
}
END:
return exit_status;
}