diff --git a/NewtonRaphson b/NewtonRaphson new file mode 100644 index 0000000..970ef8f --- /dev/null +++ b/NewtonRaphson @@ -0,0 +1,46 @@ +#include +#include +using namespace std; + +double f(double x); +double fprime(double x); + + +double f(double x) +{ + double a=pow(x,3.0)-x-11.0; //equation whose roots are to be determined + return a; +} + +double fprime(double x) +{ + double b=3*pow(x,2.0)-1.0; +} + +int main() +{ + double x,x1,e,fx,fx1; + cout.precision(4); + + cout.setf(ios::fixed); + cout<<"Enter the initial guess\n"; + cin>>x1; + + cout<<"Enter desired accuracy\n"; y + cin>>e; + fx=f(x); + fx1=fprime(x); + cout <<"x{i}"<<" "<<"x{i+1}"<<" "<<"|x{i+1}-x{i}|"<=e); + + cout<<"The root of the equation is "<