NEWTON RAPHSON METHOD
THEORY
In numerical analysis, Newton’s method, also known as the Newton
Raphson method named after Isac Newton and Joseph Raphson, is a
root finding algorithm which produces successively better
approximations to the roots (or zeros) of real valued function. It is an
open end method starting from one initial guess.
Iteration formula for NR method
Let f(x)=0 be a given equation .
Then, the iterative formula for NR method is;
Xn+1=Xn – f(Xn)
f’(Xn)
PROGRAM
#include <stdio.h>
#include<math.h>
float f(float x)
{
return(x*x*x-4*x-9);
}
float g(float x)
{
return(3*x*x-4);
}
int main()
{
float a,b;
printf(“Enter the value of a”); OUTPUT
scanf(“%f”,&a); Enter The value of a
do 2
{ The root is 2.706528
if(fabs(g(a))<0.0005)
{
printf(“The root doesn’t exists”);
return(0);
}
b=a-(f(a)/g(a));
a=b;
}
while(fabs(f(a))>=0.0001);
printf(“The root is %f”,a);
return (0);
}
CONCLUSION
The root of x2-4x-9=0 is found to be 2.706528 by NR method.