#include <cmath>
#include <iostream>
using namespace std;
double f1(double x)
{
return 2*x*x*x - x - 10;
}
double f2(double x)
{
return sqrt(x) - 2;
}
double g1(double x)
{
return x - 0.001*f1(x);
}
int main()
{
double x;
double e;
double n;
cout<<"Initial val x : "<<(x = 1)<<endl;
cout<<"Error of calc : "<<(e = 1E-4)<<endl;
for(n = 1; e < fabs(f1(x)) && e < fabs(f2(x)); n = n + 1)
{
x = g1(x);
cout<<"Iteration : "<<n<<endl;
cout<<" x : "<< x <<endl;
cout<<"f1(x) : "<<f1(x)<<endl;
cout<<"f2(x) : "<<f2(x)<<endl;
}
return 0;
}