/* nag_complex_bessel_j_seq (s18gkc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include int main(void) { Integer exit_status = 0; Complex z, b[20]; double a, alpha; Integer i, nl; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ scanf("%*[^\n]"); printf("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) { printf(" z a nl\n"); printf(" (%7.3f,%7.3f) %lf %ld\n\n", z.re, z.im, a, nl); printf("Requested values of J_alpha(Z)\n\n"); alpha = a; printf(" alpha J_alpha(z)\n"); for (i = 0; i < ABS(nl) + 1; i++) { printf("%13.4e (%13.4e,%13.4e)\n", alpha, b[i].re, b[i].im); if (nl > 0) alpha += 1.0; else alpha -= 1.0; } } else { printf("Error from nag_complex_bessel_j_seq (s18gkc).\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }