Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <locale.h>
  3.  
  4. double Calc_Eps(){
  5. double eps = 1;
  6. while ((eps/2 + 1) > 1) eps /= 2;
  7. return eps;
  8. }
  9.  
  10. int main(){
  11. setlocale(LC_ALL, "");
  12. int i = 0, n;
  13. printf("Введите количество частей заданного отрезка : ");
  14. scanf("%d" , &n);
  15. double a = 0, b = 1, r , x = a;
  16. r = (b - a)/n;
  17. printf("_______________________________________________________________________________________\n x | Taylor | f | iter |\n__________|_______________________________|_______________________________|____________|\n");
  18. while (x <= b){
  19. double ch = 1, zn = 4 , eps = Calc_Eps(), res = 0;
  20. while (((double)ch/zn) > eps) {
  21. res += (ch/zn);
  22. ch *= x*x*x*x;
  23. zn *= 4;
  24. i++;
  25. }
  26. double y = 1 / (4 - x*x*x*x);
  27. printf(" %lf | %.20lf | %.20lf | %d |\n__________|_______________________________|_______________________________|____________|\n", x, res, y, i - 1);
  28. x += r;
  29. i = 0;
  30. }
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement