/* nag_complex_airy_ai (s17dgc) Example Program.
*
* NAGPRODCODE Version.
*
* Copyright 2016 Numerical Algorithms Group.
*
* Mark 26, 2016.
*/
#include <nag.h>
#include <stdio.h>
#include <nag_stdlib.h>
#include <nags.h>
int main(void)
{
Integer exit_status = 0;
Complex z, ai;
Integer nz;
char nag_enum_deriv[40], nag_enum_scal[40];
Nag_ScaleResType scal;
Nag_FunType deriv;
NagError fail;
INIT_FAIL(fail);
/* Skip heading in data file */
scanf("%*[^\n]");
printf("nag_complex_airy_ai (s17dgc) Example Program Results\n");
printf(" deriv z scal "
"ai nz\n");
while (scanf(" %39s (%lf,%lf) %39s%*[^\n] ",
nag_enum_deriv, &z.re, &z.im, nag_enum_scal) != EOF) {
/* nag_enum_name_to_value (x04nac).
* Converts NAG enum member name to value
*/
deriv = (Nag_FunType) nag_enum_name_to_value(nag_enum_deriv);
scal = (Nag_ScaleResType) nag_enum_name_to_value(nag_enum_scal);
/* nag_complex_airy_ai (s17dgc).
* Airy functions Ai(z), complex z
*/
nag_complex_airy_ai(deriv, z, scal, &ai, &nz, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_complex_airy_ai (s17dgc).\n%s\n", fail.message);
exit_status = 1;
goto END;
}
printf(" %-12s (%7.3f,%7.3f) %-14s (%7.3f,%7.3f) %" NAG_IFMT "\n",
nag_enum_deriv, z.re, z.im, nag_enum_scal, ai.re, ai.im, nz);
}
END:
return exit_status;
}