Advertisement
luizaspan

Método de iteração do ponto fixo III

Sep 2nd, 2015
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. #define eps 1e-6
  6.  
  7. double f(double x)
  8. {
  9.     return (1./5*(6 - x*x + 4*x));
  10. }
  11.  
  12. int main(void)
  13. {
  14.     int i;
  15.     double x=1.5, y, delta;
  16.  
  17.     do
  18.     {
  19.         y=f(x);
  20.         delta=fabs(y-x);
  21.         x=y;
  22.         printf("%lf \t %lf \n",x,f(x));
  23.     } while (delta > eps);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement