/* nag_bessel_j_alpha (s18ekc) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * NAG C Library * * Mark 6, 2000. */ #include #include #include #include int main(void) { Complex b[101]; double a; double alpha; double d; double x; Integer i; Integer exit_status=0; Integer nl; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("s18ekc Example Program Results\n"); while (scanf("%lf %lf %ld%*[^\n]", &x, &a, &nl) != EOF) { Vprintf(" x a nl\n"); Vprintf("%4.1f %4.1f %6ld\n\n", x, a, nl); s18ekc(x, a, nl, b, &fail); if (fail.code == NE_NOERROR) { Vprintf(" Requested values of J_alpha(X)\n\n"); alpha = a; Vprintf(" alpha J_alpha(X)\n"); for (i = 1; i <= ABS(nl) + 1; ++i) { Vprintf(" %12.4e (%12.4e, %12.4e)\n", alpha, b[i - 1].re, b[i - 1].im); d = (double) nl; alpha += SIGN(1.0, d); } } else { Vprintf("Error from s18ekc.\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }