/* nag_bessel_i_nu_scaled (s18ecc) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * NAG C Library * * Mark 6, 2000. * Mark 7, revised, 2001. * */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpin, *fpout; Integer exit_status = 0, nu; NagError fail; double x, y; INIT_FAIL(fail); /* Check for command-line IO options */ fpin = nag_example_file_io(argc, argv, "-data", NULL); fpout = nag_example_file_io(argc, argv, "-results", NULL); /* Skip heading in data file */ fscanf(fpin, "%*[^\n]"); fprintf(fpout, "nag_bessel_i_nu_scaled (s18ecc) Example Program Results\n"); fprintf(fpout, " x nu y\n"); while (fscanf(fpin, "%lf %ld%*[^\n]", &x, &nu) != EOF) { /* nag_bessel_i_nu_scaled (s18ecc). * Scaled modified Bessel function e^(~-~x)I_(nu~/~4)(x) */ y = nag_bessel_i_nu_scaled(x, nu, &fail); if (fail.code != NE_NOERROR) { fprintf(fpout, "Error from nag_bessel_i_nu_scaled (s18ecc).\n%s\n", fail.message); exit_status = 1; goto END; } fprintf(fpout, "%4.1f %6ld %13.4e\n", x, nu, y); } END: if (fpin != stdin) fclose(fpin); if (fpout != stdout) fclose(fpout); return exit_status; }