/* nag_complex_airy_bi (s17dhc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include int main(void) { Complex z, bi; Nag_ScaleResType scal_enum; Nag_FunType deriv_enum; char deriv, scal; Integer exit_status = EXIT_SUCCESS; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("nag_complex_airy_bi (s17dhc) Example Program Results\n"); Vprintf(" deriv z scal bi\n"); while (scanf(" '%c' (%lf,%lf) '%c'%*[^\n] ", &deriv, &z.re, &z.im, &scal) != EOF) { /* Convert scal character to enum */ if (scal == 's') { scal_enum = Nag_ScaleRes; } else if (scal == 'u') { scal_enum = Nag_UnscaleRes; } else { Vprintf("Unrecognised character for Nag_ScaleResType type\n"); exit_status = -1; goto END; } /* Convert deriv character to enum */ if (deriv == 'f') { deriv_enum = Nag_Function; } else if (deriv == 'd') { deriv_enum = Nag_Deriv; } else { Vprintf("Unrecognised character for Nag_FunType type\n"); exit_status = -1; goto END; } /* nag_complex_airy_bi (s17dhc). * Airy functions Bi~(z) and ci~(z), complex z */ nag_complex_airy_bi(deriv_enum, z, scal_enum, &bi, &fail); if (fail.code == NE_NOERROR) Vprintf(" '%c' (%7.3f,%7.3f) '%c' (%7.3f,%7.3f)\n", deriv, z.re, z.im, scal, bi.re, bi.im); else { Vprintf("Error from nag_complex_airy_bi (s17dhc).\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }