Advertisement
markkoval1999

taylor_row

Oct 2nd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main()
  4. {
  5. int counter,i = 0;
  6. double x = 0,y = 0;
  7. double f,eps;
  8.  
  9. double fi = 1;
  10. f = 1+x/4;
  11.  
  12. printf("IF VALUE OF X <= 1 THE VALUE OF COUNTER WILL NOT BE INCREASED!!!\n");
  13. printf("Enter your counter value\n");
  14. scanf_s("%d",&counter);
  15. printf("Enter your eps value\n");
  16. scanf_s("%lf", &eps);
  17. printf("\t x\t\t y\t\t f\n");
  18.  
  19. for( x = -1; x<=-1+eps*double(counter) && x<= 1; x += eps, f=1+x/4 )
  20. {
  21. for(i=1;i<=counter;i++)
  22.  
  23.  
  24. if(i==1)
  25. {
  26. fi *= pow((double)(-1),i)*(pow(x,i+1)*(1/4)*(4*i-1)/(4*(i+1)));
  27. }
  28. else
  29. {
  30. fi *= pow((double)(-1),1)*(pow(x,1)*(4*i-1)/(4*(i+1)));
  31. }
  32.  
  33. f += fi;
  34.  
  35. y = pow((1+x),0.25);
  36. printf("\t%lf\t%lf\t%lf\n",x,y,f);
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement