home *** CD-ROM | disk | FTP | other *** search
- naordr(n,f,eps,m,k)
-
- /*this function computes the successive differences of a function */
- /*calculated at equal intervals of the argument until the */
- /*differences are essentially zero and gives the order of the */
- /*polynomial which will be fit the data. */
-
- int n,*m,*k;
- float f[],eps;
- {
- unsigned iz;
- int i,j;
- float a;
- double fabs();
-
- *k = 0;
- *m = n - 1;
-
- for(j = 0;j <= n-2; j++)
- {
- iz = 1;
-
- for(i = 0;i <= *m; i++)
- {
- a = f[i + 1] - f[i];
- if(f[i] != 0.0)
- {
- if(fabs(a/f[i]) >= eps) iz = 0;
- }
- f[i] = a;
- }
- if(iz == 1)
- {*m = j -1;
- return;}
- *m = *m - 1;
- } /* end of j loop */
- *k = 1;
- }