/* nag_1d_cheb_eval2 (e02akc) Example Program. * * Copyright 2001 Numerical Algorithms Group. * * Mark 7, 2001. */ #include #include #include #include int main(void) { /* Initialized data */ const double xmin = -0.5; const double xmax = 2.5; const double a[7] = { 2.53213,1.13032,0.2715,0.04434,0.00547,5.4e-4,4e-5 }; /* Scalars */ double p, x; Integer exit_status, i, m, n, one; NagError fail; INIT_FAIL(fail); exit_status = 0; Vprintf("nag_1d_cheb_eval2 (e02akc) Example Program Results\n"); n = 6; one = 1; Vprintf("\n"); Vprintf(" i Argument Value of polynomial\n"); m = 4; for (i = 1; i <= m; ++i) { x = (xmin * (double) (m - i) + xmax * (double) (i - 1)) / (double) (m - 1); /* nag_1d_cheb_eval2 (e02akc). * Evaluation of fitted polynomial in one variable from * Chebyshev series form */ nag_1d_cheb_eval2(n, xmin, xmax, a, one, x, &p, &fail); if (fail.code != NE_NOERROR) { Vprintf("Error from nag_1d_cheb_eval2 (e02akc).\n%s\n", fail.message); exit_status = 1; goto END; } Vprintf("%4ld%10.4f %9.4f\n", i, x, p); } END: return exit_status; }