Advertisement
sippystink

laboop3

Feb 25th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. double f(double x)
  7. {
  8.     return exp(x) + log(x) - 10 * x;
  9. }
  10.  
  11. double F(double x)
  12. {
  13.     return exp(x) + (1/x) - 10;
  14. }
  15.  
  16. int main()
  17. {
  18.     double x = 3.5265, eps = 0.0001, h;
  19.     h = f(x) / F(x);
  20.     while (abs(h) >= eps)
  21.     {
  22.         h = f(x)/F(x);
  23.         x = x - h;
  24.     }
  25.     cout << x << endl << F(x);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement