/* nag_specfun_beta_incomplete (s14ccc) Example Program.
*
* Copyright 2024 Numerical Algorithms Group.
*
* Mark 30.2, 2024.
*/
#include <nag.h>
#include <stdio.h>
int main(void) {
Integer exit_status = 0;
double a, b, x, w, w1;
NagError fail;
INIT_FAIL(fail);
printf("nag_specfun_beta_incomplete (s14ccc) Example Program Results\n");
/* Skip heading in data file */
scanf("%*[^\n]");
printf("%4s%7s%7s%13s%13s\n", "a", "b", "x", "Ix(a,b)", "1-Ix(a,b)");
while (scanf("%lf %lf %lf", &a, &b, &x) != EOF)
{
/* nag_specfun_beta_incomplete (s14ccc).
* Incomplete beta function Ix(a,b) and its complement 1-Ix(a,b)
*/
nag_specfun_beta_incomplete(a, b, x, &w, &w1, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_specfun_beta_incomplete (s14ccc).\n%s\n",
fail.message);
exit_status = 1;
goto END;
}
printf("%6.2f%7.2f%7.2f%12.4e%12.4e\n", a, b, x, w, w1);
}
END:
return exit_status;
}