//Newton-Raphson Method
#include
#include
#include
using namespace std;
double f(double x); //declare the function for the given equation
double f(double x) //define the function here, ie give the equation
{
double a=pow(x,3.0)-x-11.0; //write the equation whose roots are to be determined
return a;
}
double fprime(double x);
double fprime(double x)
{
double b=3*pow(x,2.0)-1.0; //write the first derivative of the equation
return b;
}
int main()
{
double x,x1,e,fx,fx1;
cout.precision(4); //set the precision
cout.setf(ios::fixed);
cout<<"Enter the initial guess\n"; //take an intial guess
cin>>x1;
cout<<"Enter desired accuracy\n"; //take the desired accuracy
cin>>e;
fx=f(x);
fx1=fprime(x);
cout <<"x{i}"<<" "<<"x{i+1}"<<" "<<"|x{i+1}-x{i}|"<=e); /*if |x{i+1}-x{i}| remains greater than the desired accuracy, continue the loop*/
cout<<"The root of the equation is "< Explanation of the code:

PhD researcher at Friedrich-Schiller University Jena, Germany. I'm a physicist specializing in theoretical, computational and experimental condensed matter physics. I like to develop Physics related apps and softwares from time to time. Can code in most of the popular languages. Like to share my knowledge in Physics and applications using this Blog and a YouTube channel.

Good one !!!!!

Thanks! Appreciate your feedback.

how we copute tax=x=

tns bro

It gives only x1 answers.how can I get the final result