Advertisement
luizaspan

Método de iteração do ponto fixo

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