/* nag_moment_2_landau (g01qtc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpin, *fpout; /* Scalars */ 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); fprintf(fpout, " nag_moment_2_landau (g01qtc) Example Program Results\n"); /* Skip heading in data file */ fscanf(fpin, "%*[^\n] "); fscanf(fpin, "%lf%*[^\n] ", &x); /* nag_moment_2_landau (g01qtc). * Landau second moment function Phi_2(x) */ y = nag_moment_2_landau(x); fprintf(fpout, "\n X Y\n\n"); fprintf(fpout, " %3.1f %13.4e\n", x, y); if (fpin != stdin) fclose(fpin); if (fpout != stdout) fclose(fpout); return exit_status; }