Advertisement
Courbe_Impliquee

Taylor

Dec 12th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <math.h>
  4. using namespace std;
  5. int main()
  6. {
  7. float xn, xk, dx, e, s, sum, x, F;
  8. int n=1,nf=1;
  9. cout<<"Vvedite xn, xk, dx, e: ";
  10. cin>>xn>>xk>>dx>>e;
  11. cout<<"------------------------------------------\n";
  12. cout<<"| x | f | n | F |\n";
  13. cout<<"------------------------------------------\n"<<endl;
  14.  
  15. for(x=xn; x<=xk; x+=dx){
  16. n=0;
  17. sum=1;
  18. s=-x;
  19. sum+=s;
  20. F=pow(2.71828 ,-1*x);
  21. while(fabs(s)>e){
  22. if (n!=0){
  23. for (int p = 1; p <= n; p++) {
  24. nf *= p;
  25. }
  26. }else nf=1;
  27. s*=(pow(-1,n)*pow(x,n))/nf;
  28. sum+=s;
  29. n++;
  30. }
  31. nf=0;
  32. printf("%10.2f | %8.2f | %3d | %8.2f | \n",x,sum,n,F);
  33. }
  34. cout<<"------------------------------------------\n";
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement