//Written by Reginald Ford //Horner's method double polyval(double *a, double t, int order) { double sum = a[order]; for(int i=order-1;i>=0;i--) { sum*=t; sum+=a[i]; } return sum; } //provide the coefficient that goes with t^n //from the product of power series a and b double cp(double *a, double *b,int n) { double sum = 0; for(int i=0;i<=n;i++) { sum += a[i]*b[n-i]; } return sum; } //provide the coefficient that goes with t^n //from the product of power series a' and b double cp2(double *a, double *b,int n) { double sum = 0; for(int i=0;i<=n;i++) { sum += (i+1) * a[i+1]*b[n-i]; } return sum; }