/* nag_bessel_zeros (s17alc) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * NAG C Library * * Mark 6, 2000. * Mark 7, revised, 2001. * */ #include #include #include #include #include #include int main(void) { #define NMAX 100 double a, rel; double *x=0; Integer i; Integer exit_status=0; Integer mode; Integer n; NagError fail; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("s17alc Example Program Results\n\n"); if (! (x = NAG_ALLOC(NMAX, double))) { Vprintf("Allocation failure\n"); exit_status=-1; } rel = sqrt (X02AJC); Vscanf("%lf %ld %ld", &a, &n, &mode); s17alc(a, n, mode, rel, x, &fail); if (fail.code == NE_NOERROR) { Vprintf(" a n mode\n"); Vprintf(" %4.1f%3ld%6ld\n\n", a, n, mode); if (mode == 1) Vprintf("Leading n positive zeros of J\n"); else if (mode == 2) Vprintf("Leading n positive zeros of Y\n"); else if (mode == 3) { if (a == 0.0) Vprintf("Leading n non-negative zeros of J'\n"); else Vprintf("Leading n positive zeros of J'\n"); } else if (mode == 4) Vprintf("Leading n positive zeros of Y'\n\n"); for (i = 0; i <= n-1; ++i) Vprintf(" x = %12.4e\n", x[i]); Vprintf("\n"); } else { Vprintf("Error from s17alc.\n%s\n", fail.message); exit_status = 1; goto END; } END: if (x) NAG_FREE (x); return exit_status; }