Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

To Find out the root of the Algebraic And Transcendental equations using Newton Raphson Method

To Find out the root of the Algebraic And Transcendental equations using Newton Raphson Method

#include<stdio.h>
#include<math.h>
float f(float x)
{
return x*log10(x)-1.2;
}
float df(float x)
{
return log10(x)+0.43429;
}
main()
{
int itr,maxitr;
clrscr();
float h,x0,x1,aerr;
printf("Enter x0,allowed error ,maximum iterations \n");
scanf("%f%f%d",&x0,&aerr,&maxitr);
for(itr=1;itr<=maxitr;itr++)
{
h=f(x0)/df(x0);
x1=x0-h;
printf("Iteration no. %3d,x=%9.6f \n",itr,x1);
if(fabs(h)<aerr)
{
printf("After %3d iterations","root=%8.6f  \n",itr,x1);
return0;
}
x0=x1;
}
printf("Iterations not sufficient","solution does not converge \n");
return1;
}






Output



Newton Raphson Method

Previous
Next Post »