title: creating an iterative program to estimate the root of a polynomial
body: <p>Am creating a program in c which is suppose to estimate the root of a 10 order polynomial using newton raphson method. The user enters 10 coefficients and it is suppose to estimate the root of the equation. the absolute relative error is 0.00000001 and maximum number of iterations allowed are 70. sample code is below.</p>
  
  <pre><code>   n=0;
      while(abserr&lt;=0.00000001){
      yold=y;
      y = y-(poly(y,coefficients,11)/poly_der(y,coefficients,11));
      ynew = y;
      error=ynew-yold;
      abserr=sqrt(error*error);
  
      printf("iteration x%d = %.2f error =%.2f\n",n+1,y,abserr);
      n++;
      iteration++;
  
      if(iteration==70){
      printf("you have reached the maximum number of iterations\n");
      break;}
      }
  </code></pre>
  
  <p>the functions poly and poly_der calculate the value of the polynomial and its derivative respectively. there defnitions are below.</p>
  
  <pre><code>float poly(float x, float coefficients[], int order)
      {
       int idx;
       float total;
  
       for (idx = 0; idx &lt; order; idx++)
          total += coefficients[idx] * pow(x, idx);
          return total;
       }
  
     float poly_der(float x, float coefficients[], int order)
  {
      int idx;
      float total;
  
      for (idx = 0; idx &lt; order; idx++)
          total += coefficients[idx] * deri(x, idx);
      return total;
  }
  </code></pre>
  
  <p>deri is function which calculates the derivative of a term in the polynomial.
  Unfortunately this program produces unexpected results. i cant figure out where am wrong because it compiles and runs fine. Is there another way i can estimate the root using newton's method. How can i improve the program so it produces the required results.</p>