/* nag_real_polygamma (s14aec) Example Program. * * Copyright 2000 Numerical Algorithms Group. * * NAG C Library * * Mark 6, 2000. */ #include #include #include #include int main(void) { Integer exit_status=0, k; NagError fail; double x, y; INIT_FAIL(fail); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vprintf("nag_real_polygamma (s14aec) Example Program Results\n\n"); Vprintf(" x k (d^k/dx^k)psi(x)\n"); while(scanf("%lf %ld%*[^\n]", &x, &k) != EOF) { /* nag_real_polygamma (s14aec). * Derivative of the psi function psi(x) */ y = nag_real_polygamma(x, k, &fail); if (fail.code == NE_NOERROR) Vprintf("%5.1f %5ld %12.4e\n", x, k, y); else { Vprintf("Error from nag_real_polygamma (s14aec).\n%s\n", fail.message); exit_status = 1; goto END; } } END: return exit_status; }