Exp 2 Newton-Raphson Method
Exp 2 Newton-Raphson Method
EQUATION:
OPEN
METHODS(NEWT
ON-RAPHSON
METHOD)
Group -06
(181135,181136,1811
37,171103,171111,17
1126)
NEWTON-RAPHSON
METHOD
The most basic version starts with a single-variable function f defined for a real variable x, the
function’s derivative f′, and an initial guess x0 for a root of f. If the function satisfies sufficient
assumptions and the initial guess is close, then
is a better approximation of the root than x0. Geometrically, (x1, 0) is the intersection of the x-axis
and the tangent of the graph of f at (x0, f(x0)): that is, the improved guess is the unique root of
the linear approximation at the initial point. The process is repeated as
In Newton Raphson method if x0 is initial guess then next approximated root x1 is obtained by
following formula :
x1 = x0 - f(x0) / f’(x0)
And an algorithm for Newton Raphson method involves repetition of above process i.e. we use x1 to
find x2 and so on until we find the root within desired accuracy.
ALGORITHM
1. Start
2. Define desired accuracy e
3. Define function as f(x)
4. Define 1st derivative of f(x) as df(x)
5. Input initial guess x0
6. If df(x)=0, then go-to (12), otherwise go-to (7)
7. Initialize iteration counter i=0
8. Calculate x1=x0-f(x0)/df(x0)
9. Increment iteration counter i=i+1
10. If |f(x1)|>e then set x0=x1 and go-to (6), otherwise go-to (11)
11. Print root as x1
12. Stop
C PROGRAMME FOR NEWTON-
RAPHSON METHOD
Suppose a function f(x)= x3-9x+1 is given. We have to complie a C-programme to find
the roots of this function using Newton-Raphson method.
Output:
So we can compile the programme as follows:
ANALYSIS
After an initial value x0 is given as input for the provided function the
programme calculates f(x0), df(x0)and finds the root x1 using formula
xn+1=xn-(fxn/dfxn). The iteration continues untill the function value f1 is
greater than the desired accuracy e and every new value of root replaces its
previous value. For initial value of x0=8, the programme calculates 6
iterations where the function value is 0.000016 which is less than the
desired accuracy e. So, the programme ends here and we get an
approximate root x1=2.9428.