/* nag_complex_bessel_j_seq (s18gkc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include int main(void) { Complex z, b[20]; double a, alpha; Integer i, nl; Integer exit_status = EXIT_SUCCESS; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("nag_complex_bessel_j_seq (s18gkc) Example Program Results\n"); while (scanf(" (%lf,%lf) %lf %ld%*[^\n] ", &z.re, &z.im, &a, &nl) != EOF) { /* nag_complex_bessel_j_seq (s18gkc). * Bessel function of the 1st kind J_(alpha~+/-~n)(z) */ nag_complex_bessel_j_seq(z, a, nl, b, &fail); if (fail.code == NE_NOERROR) { Vprintf(" z a nl\n"); Vprintf(" (%7.3f,%7.3f) %lf %ld\n\n", z.re, z.im, a, nl); Vprintf("Requested values of J_alpha(Z)\n\n"); alpha = a; Vprintf(" alpha J_alpha(z)\n"); for (i = 0; i < ABS(nl) + 1; i++) { Vprintf("%12.4e (%12.4e,%12.4e)\n", alpha, b[i].re, b[i].im); if (nl > 0) alpha += 1.0; else alpha -= 1.0; } } else { Vprintf("Error from nag_complex_bessel_j_seq (s18gkc).\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }