This article is about Newton's method for finding roots.
In numerical analysis, Newton's method (also known as the Newton–Raphson method), named after Isaac Newton and Joseph Raphson, is a method for finding successively better approximations to the roots (or zeroes) of a real-valued function.Given a function ƒ defined over the reals x, and its derivative ƒ ', we begin with a first guess x0 for a root of the function f. Provided the function satisfies all the assumptions made in the derivation of the formula, a better approximation x1 is
The process is repeated as
This algorithm is first in the class of Householder's methods, succeeded by Halley's method. The method can also be extended to complex functions and to systems of equations.
C code for finding a real root of the equationf(x)= x*x*x-2*x-5 using Newton-Raphson Method
#include
//#include
#include
//#include
#include
sample output:
Enter x0: 2
the value of x is::2.100000
the value of x is::2.094568
the value of x is::2.094552
The root is: 2.094552
the value of x is::2.100000
the value of x is::2.094568
the value of x is::2.094552
The root is: 2.094552
No comments:
Post a Comment