/* nag_complex_airy_ai (s17dgc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include 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(" %s (%lf,%lf) %s%*[^\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) %ld\n", nag_enum_deriv, z.re, z.im, nag_enum_scal, ai.re, ai.im, nz); } END: return exit_status; }