/* nag_bessel_i1_scaled (s18cfc) Example Program. * * Copyright 1991 Numerical Algorithms Group. * * Mark 2 revised, 1992. */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpin, *fpout; Integer exit_status = 0; double x, y; /* 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_i1_scaled (s18cfc) Example Program Results\n"); fprintf(fpout, " x y\n"); while (fscanf(fpin, "%lf", &x) != EOF) { /* nag_bessel_i1_scaled (s18cfc). * Scaled modified Bessel function e^(~-~|x|)I_1(x) */ y = nag_bessel_i1_scaled(x); fprintf(fpout, "%12.3e%12.3e\n", x, y); } if (fpin != stdin) fclose(fpin); if (fpout != stdout) fclose(fpout); return exit_status; }