home *** CD-ROM | disk | FTP | other *** search
- plyint(a,nda,b,c,ans)
-
- /*this function computes the definite integral of any */
- /*single variable polynomial of the form */
- /*a(0)*x**nda + a(1)*x**(nda-1) + ... + a(nda). */
-
- int nda;
- float a[],b,c,*ans;
-
- {
- int i,k;
- float cc,bb,f,x;
-
- *ans = 0.0;
- x = *ans;
- k = nda;
- f = 1.;
- bb = b;
- cc = c;
-
- for(i = 0; i <=nda; i++)
- {
- x = x + a[k]*(cc - bb)/f;
- f = f + 1;
- bb *= b;
- cc *= c;
- k--;
- }
- *ans = x;
- }