Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <locale.h>
- double Calc_Eps(){
- double eps = 1;
- while ((eps/2 + 1) > 1) eps /= 2;
- return eps;
- }
- int main(){
- setlocale(LC_ALL, "");
- int i = 0, n;
- printf("Введите количество частей заданного отрезка : ");
- scanf("%d" , &n);
- double a = 0, b = 1, r , x = a;
- r = (b - a)/n;
- printf("_______________________________________________________________________________________\n x | Taylor | f | iter |\n__________|_______________________________|_______________________________|____________|\n");
- while (x <= b){
- double ch = 1, zn = 4 , eps = Calc_Eps(), res = 0;
- while (((double)ch/zn) > eps) {
- res += (ch/zn);
- ch *= x*x*x*x;
- zn *= 4;
- i++;
- }
- double y = 1 / (4 - x*x*x*x);
- printf(" %lf | %.20lf | %.20lf | %d |\n__________|_______________________________|_______________________________|____________|\n", x, res, y, i - 1);
- x += r;
- i = 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement