home *** CD-ROM | disk | FTP | other *** search
- naaitk(n,x,f,xx,fx,a,b)
-
- /*this function approximates a function whose value is given*/
- /*at n points on a interval of the x axis. the interpolating*/
- /*polynomial of degree n-1 is developed according to Aitken's*/
- /*algorithm.*/
-
- int n;
- float x[],f[],xx,*fx,a[],b[];
-
- {
- int i,j,k,n1;
-
- for(i = 0; i <= n-1; i++)
- {
- b[i] = f[i];
- a[i] = x[i] - xx;
- }
- n1 = n-1;
-
- for(i = 0; i <= n1-1; i++)
- {
- j = i + 1;
- for(k = 0; k <= n-1; k++)
- {
- b[j] = (a[j]*b[i]- a[i]*b[j])/(a[j] - a[i]);
- j ++;
- if(j >= n ) break;
- } /* end of k loop */
- } /* end of i loop */
- *fx = b[n-1];
- }
-
-