home *** CD-ROM | disk | FTP | other *** search
- plydif(a,nd,x,ans)
-
- /*this function will differentiate a single variable */
- /*polnomial of the form a(1)*x**nd+a(2)*x**nd-1+... */
- /*a(nd+1) */
-
- int nd;
- float a[],x,*ans;
-
- {
- int i;
- float pwr;
-
- pwr = nd;
- *ans = a[0]*pwr;
- if (nd <= 1) return;
-
- for(i = 1; i <= nd-1; i++)
- {
- pwr = pwr - 1.;
- *ans = *ans * x + pwr * a[i];
- }
- }