NAG Library Manual, Mark 28.3
Interfaces:  FL   CL   CPP   AD 

NAG CL Interface Introduction
Example description
/* nag_specfun_psi_deriv_complex (s14afc) Example Program.
 *
 * Copyright 2022 Numerical Algorithms Group.
 *
 * NAG C Library
 *
 * Mark 28.3, 2022.
 */

#include <nag.h>
#include <stdio.h>

int main(void) {
  Complex y, z;
  Integer exit_status = 0, k;
  NagError fail;

  INIT_FAIL(fail);

  /* Skip heading in data file */
  scanf("%*[^\n] ");
  printf("nag_specfun_psi_deriv_complex (s14afc) Example Program Results\n");
  printf("       z            k         (d^k/dz^k)psi(z)\n");
  while (scanf(" (%lf,%lf)%" NAG_IFMT "%*[^\n] ", &z.re, &z.im, &k) != EOF)
  {
    /* nag_specfun_psi_deriv_complex (s14afc).
     * Derivative of the psi function psi(z)
     */
    y = nag_specfun_psi_deriv_complex(z, k, &fail);
    if (fail.code == NE_NOERROR)
      printf("(%5.1f, %5.1f) %6" NAG_IFMT " (%13.4e, %13.4e)\n", z.re, z.im, k,
             y.re, y.im);
    else {
      printf("Error from nag_specfun_psi_deriv_complex (s14afc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
  }
END:
  return exit_status;
}