SlideShare uma empresa Scribd logo
1 de 29
Newton-Raphson method, also known as the
Newton’s Method, is the simplest and fastest
approach to find the root of a function.
It is an open bracket method and requires only one
initial guess.
Newton’s method is often used to improve the result
or value of the root obtained from other methods.
This method is more useful when the first derivative
of f(x) is a large value.
This is Newton’s Method of finding roots. It is an example
of an Algorithm (a specific set of computational steps.)
It is sometimes called the Newton-Raphson method
Guess: 2.44948979592
( )2.44948979592 .00000013016f =
Amazingly close to zero!
Newton’s Method:
( )
( )1
n
n n
n
f x
x x
f x
+ = −
′
This is a Recursive algorithm because a set of steps are
repeated with the previous answer put in the next
repetition. Each repetition is called an Iteration.
→
Commonly, we use the Newton-Raphson method to find a root of a
complicated function . This iterative process follows a set guideline to
approximate one root, considering the function, its derivative, and an
initial x-value.
We know that a root of a function is a zero of the function. This means
that at the "root" the function equals zero.
We can find these roots of a simple function such as: f(x) = x2
- 4 simply
by setting the function to zero, and solving:
f(x) = x2
-4 = 0
(x+2)(x-2) = 0
x = 2 or x = -2
The Newton-Raphson method uses an iterative process to approach one
root of a function. The specific root that the process locates depends on
the initial, arbitrarily chosen x-value.
Here,
xn is the current known x-value,
f(xn) represents the value of the function at xn,
f'(xn) is the derivative (slope) at xn.
xn+1 represents the next x-value that you are trying to find.
Essentially, f'(x), the derivative represents f(x)/dx (dx = delta-x).
Therefore, the term f(x)/f'(x) represents a value of dx.
The more iterations that are run, the closer dx will be to zero (0).
To see how this works, we will perform the Newton-
Raphson method on the function that we investigated
earlier, f(x) = x2
-4.
Below are listed the values that we need to know in order
to complete the process.
The table below shows the execution of the process.
Thus, using an initial x-value of six (6) we find one root of
the equation f(x) = x2
-4 is x=2.
If we were to pick a different inital x-value, we may find
the same root, or we may find the other one, x=-2.
A graphical representation can also be very helpful. Below, you
see the same function f(x) = x2
-4 (shown in blue). The process
here is the same as above.
In the first iteration, the red line is tangent to the curve at x0.
The slope of the tangent is the derivative at the point of
tangency, and for the first iteration is equal to 12. Dividing the
value of the function at the initial x (f(6)=32) by the slope of the
tangent (12), we find that the delta-x is equal to 2.67.
Subtracting this from six (6) we find that the new x-value is
equal to 3.33.
Another way of considering this is to find the root of this
tangent line. The new x-value (xn+1) will be equal to the root of
the tangent to the function at the current x-value (xn).
Features of Newton Raphson Method:
•Type – open bracket
•No. of initial guesses – 1
•Convergence – quadratic
•Rate of convergence – faster
•Accuracy – good
•Programming effort – easy
•Approach – Taylor’s series
The C program for Newton Raphson
method presented here is a programming approach
which can be used to find the real roots of not only a
nonlinear function, but also those of algebraic and
transcendental equations.
Newton Raphson MethodNewton Raphson Method
Algorithm:Algorithm:1.Start
2.Read x, e, n, d
*x is the initial guess
e is the absolute error i.e the desired degree of accuracy
n is for operating loop
d is for checking slope*
3.Do for i =1 to n in step of 2
4.f = f(x)
5.f1 = f'(x)
6.If ( [f1] < d), then display too small slope and goto 11.
*[ ] is used as modulus sign*
7.x1 = x – f/f1
8.If ( [(x1 – x)/x1] < e ), the display the root as x1 and goto 11.
*[ ] is used as modulus sign*
9.x = x1 and end loop
10.Display method does not converge due to oscillation.
11.Stop
Newton Raphson Method Flowchart:Newton Raphson Method Flowchart:
Source CodeSource Code
# include <stdio.h>
# include <conio.h>
# include <math.h>
# include <process.h>
# include <string.h>
# define f(x) 3*x -cos(x)-1
# define df(x) 3+sin(x)
void NEW_RAP();
void main()
{
clrscr();
printf ("n Solution by NEWTON RAPHSON method n");
printf ("n Equation is: ");
printf ("nttt 3*X - COS X - 1=0 nn ");
NEW_RAP();
getch();
}
void NEW_RAP()
{
long float x1,x0;
long float f0,f1;
long float df0;
int i=1;
int itr;
float EPS;
float error;
for(x1=0;;x1 +=0.01)
{
f1=f(x1);
if (f1 > 0)
{
break;
}
}
x0=x1-0.01;
f0=f(x0);
printf(" Enter the number of iterations: ");
scanf(" %d",&itr);
printf(" Enter the maximum possible error: ");
scanf("%f",&EPS);
if (fabs(f0) > f1)
{
printf("ntt The root is near to %.4fn",x1);
}
if(f1 > fabs(f(x0)))
{
printf("ntt The root is near to %.4fn",x0);
}
x0=(x0+x1)/2;
for(;i<=itr;i++)
{
f0=f(x0);
df0=df(x0);
x1=x0 - (f0/df0);
printf("ntt The %d approximation to the root is:
%f",i,x1);
error=fabs(x1-x0);
if(error<EPS)
{
break;
}
x0 = x1;
}
if(error>EPS)
{
printf("nnt NOTE:- ");
printf("The number of iterations are
not sufficient.");
}
printf("nnnttt
------------------------------");
printf("nttt The root is %.4f ",x1);
printf("nttt
------------------------------");
}
Write a program of GENERAL NEWTON
RAPHSON METHOD.
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
 
int user_power,i=0,cnt=0,flag=0;
int coef[10]={0};
float x1=0,x2=0,t=0;
float fx1=0,fdx1=0;
 
void main()
{
 
    clrscr();
printf("nnttt PROGRAM FOR NEWTON RAPHSON GENERAL");
printf("nnntENTER THE TOTAL NO. OF POWER:::: ");
scanf("%d",&user_power);
for(i=0;i<=user_power;i++)
{
printf("nt x^%d::",i);
scanf("%d",&coef[i]);
}
printf("n");
printf("nt THE POLYNOMIAL IS ::: ");
for(i=user_power;i>=0;i--)//printing coeff.
{
printf(" %dx^%d",coef[i],i);
}
printf("ntINTIAL X1---->");
scanf("%f",&x1);
printf("n ******************************************************");
printf("n ITERATION X1 FX1 F'X1 ");
printf("n ******************************************************");
do
{
cnt++;
fx1=fdx1=0;
for(i=user_power;i>=1;i--)
{
fx1+=coef[i] * (pow(x1,i)) ;
}
fx1+=coef[0];
for(i=user_power;i>=0;i--)
{
fdx1+=coef[i]* (i*pow(x1,(i-1)));
}
t=x2;
x2=(x1-(fx1/fdx1));
x1=x2;
printf("n %d %.3f %.3f %.3f ",cnt,x2,fx1,fdx1);
}
while((fabs(t - x1))>=0.0001);
printf("nt THE ROOT OF EQUATION IS %f",x2);
getch();
}
/*******************************OUTPUT***********************************/
PROGRAM FOR NEWTON RAPHSON GENERAL
ENTER THE TOTAL NO. OF POWER:::: 3
x^0::-3
x^1::-1
x^2::0
x^3::1
THE POLYNOMIAL IS ::: 1x^3 0x^2 -1x^1 -3x^0
INTIAL X1---->3
**************************************
ITERATION X1 FX1 F'X1
**************************************
1 2.192 21.000 26.000
2 1.794 5.344 13.419
3 1.681 0.980 8.656
4 1.672 0.068 7.475
5 1.672 0.000 7.384
**************************************
THE ROOT OF EQUATION IS 1.671700
C PROGRAM OF NEWTON RAPHSON METHOD :
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int max_power,i=0,cnt=0,flag=0;
int coef[10]={0};
float x1=0,x2=0,t=0;
float fx1=0,fdx1=0;
int main()
{
printf("-----------------------------------------------------------n");
printf("-----------------------------------------------------------nn");
printf("nnt C PROGRAM FOR NEWTON RAPHSON METHOD");
printf("nnntENTER THE MAXIMUM POWER OF X = ");
scanf("%d",&max_power);
for(i=0;i<=max_power;i++)
{
printf("nt x^%d = ",i);
scanf("%d",&coef[i]);
}
printf("n");
printf("ntTHE POLYNOMIAL IS = ");
for(i=max_power;i>=0;i--)/*printing coefficients*/
{
printf(" %dx^%d",coef[i],i);
}
printf("nntFirst approximation x1 ----> ");
scanf("%f",&x1);
printf("nn-----------------------------------------------------------n");
printf("n ITERATION t x1 t F(x1) t tF'(x1) ");
printf("n-----------------------------------------------------------n");
do
{
cnt++;
fx1=fdx1=0;
for(i=max_power;i>=1;i--)
{
fx1+=coef[i] * (pow(x1,i)) ;
}
fx1+=coef[0];
for(i=max_power;i>=0;i--)
{
fdx1+=coef[i]* (i*pow(x1,(i-1)));
}
t=x2;
x2=(x1-(fx1/fdx1));
x1=x2;
printf("nt %d t%.3f t %.3ftt%.3f
",cnt,x2,fx1,fdx1);
}while((fabs(t - x1))>=0.0001);
printf("nnnt THE ROOT OF EQUATION IS =
%f",x2);
getch();
}

Mais conteúdo relacionado

Mais procurados

numerical differentiation&integration
numerical differentiation&integrationnumerical differentiation&integration
numerical differentiation&integration8laddu8
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equationsAhmed Haider
 
Interpolation In Numerical Methods.
 Interpolation In Numerical Methods. Interpolation In Numerical Methods.
Interpolation In Numerical Methods.Abu Kaisar
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson MethodBarkha Gupta
 
Newton's forward & backward interpolation
Newton's forward & backward interpolationNewton's forward & backward interpolation
Newton's forward & backward interpolationHarshad Koshti
 
Fourier series Introduction
Fourier series IntroductionFourier series Introduction
Fourier series IntroductionRizwan Kazi
 
presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve Mukuldev Khunte
 
Regulafalsi_bydinesh
Regulafalsi_bydineshRegulafalsi_bydinesh
Regulafalsi_bydineshDinesh Kumar
 
Iterative methods
Iterative methodsIterative methods
Iterative methodsKetan Nayak
 
Newton's Forward/Backward Difference Interpolation
Newton's Forward/Backward  Difference InterpolationNewton's Forward/Backward  Difference Interpolation
Newton's Forward/Backward Difference InterpolationVARUN KUMAR
 
trapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 ruletrapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 rulehitarth shah
 

Mais procurados (20)

The newton raphson method
The newton raphson methodThe newton raphson method
The newton raphson method
 
numerical differentiation&integration
numerical differentiation&integrationnumerical differentiation&integration
numerical differentiation&integration
 
Secant Method
Secant MethodSecant Method
Secant Method
 
Secant Method
Secant MethodSecant Method
Secant Method
 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
 
Interpolation In Numerical Methods.
 Interpolation In Numerical Methods. Interpolation In Numerical Methods.
Interpolation In Numerical Methods.
 
Bisection method
Bisection methodBisection method
Bisection method
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson Method
 
Newton's forward & backward interpolation
Newton's forward & backward interpolationNewton's forward & backward interpolation
Newton's forward & backward interpolation
 
Numerical analysis ppt
Numerical analysis pptNumerical analysis ppt
Numerical analysis ppt
 
Fourier series Introduction
Fourier series IntroductionFourier series Introduction
Fourier series Introduction
 
presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve presentation on Euler and Modified Euler method ,and Fitting of curve
presentation on Euler and Modified Euler method ,and Fitting of curve
 
Regulafalsi_bydinesh
Regulafalsi_bydineshRegulafalsi_bydinesh
Regulafalsi_bydinesh
 
Iterative methods
Iterative methodsIterative methods
Iterative methods
 
Unit4
Unit4Unit4
Unit4
 
Secant method
Secant method Secant method
Secant method
 
Secant method
Secant methodSecant method
Secant method
 
Newton's Forward/Backward Difference Interpolation
Newton's Forward/Backward  Difference InterpolationNewton's Forward/Backward  Difference Interpolation
Newton's Forward/Backward Difference Interpolation
 
Beta gamma functions
Beta gamma functionsBeta gamma functions
Beta gamma functions
 
trapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 ruletrapezoidal and simpson's 1/3 and 3/8 rule
trapezoidal and simpson's 1/3 and 3/8 rule
 

Destaque

Newton raphson
Newton raphsonNewton raphson
Newton raphsonbaxter89
 
Newton Raphson method for load flow analysis
Newton Raphson method for load flow analysisNewton Raphson method for load flow analysis
Newton Raphson method for load flow analysisdivyanshuprakashrock
 
Newton Raphson
Newton RaphsonNewton Raphson
Newton RaphsonAisu
 
Newton Raphson Method Using C Programming
Newton Raphson Method Using C Programming Newton Raphson Method Using C Programming
Newton Raphson Method Using C Programming Md Abu Bakar Siddique
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methodsTarun Gehlot
 
Newton’s Forward & backward interpolation
Newton’s Forward &  backward interpolation Newton’s Forward &  backward interpolation
Newton’s Forward & backward interpolation Meet Patel
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson MethodTayyaba Abbas
 
Sermon Slide Deck: "Thank God It's Monday"
Sermon Slide Deck: "Thank God It's Monday"Sermon Slide Deck: "Thank God It's Monday"
Sermon Slide Deck: "Thank God It's Monday"New City Church
 
Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationraksharao
 
On Continuous Approximate Solution of Ordinary Differential Equations
On Continuous Approximate Solution of Ordinary Differential EquationsOn Continuous Approximate Solution of Ordinary Differential Equations
On Continuous Approximate Solution of Ordinary Differential EquationsWaqas Tariq
 
The newton raphson method
The newton raphson methodThe newton raphson method
The newton raphson methodTarun Gehlot
 

Destaque (20)

Newton raphson
Newton raphsonNewton raphson
Newton raphson
 
Newton Raphson method for load flow analysis
Newton Raphson method for load flow analysisNewton Raphson method for load flow analysis
Newton Raphson method for load flow analysis
 
Bisection and fixed point method
Bisection and fixed point methodBisection and fixed point method
Bisection and fixed point method
 
Newton Raphson
Newton RaphsonNewton Raphson
Newton Raphson
 
Newton Raphson Method Using C Programming
Newton Raphson Method Using C Programming Newton Raphson Method Using C Programming
Newton Raphson Method Using C Programming
 
APPLICATION OF NUMERICAL METHODS IN SMALL SIZE
APPLICATION OF NUMERICAL METHODS IN SMALL SIZEAPPLICATION OF NUMERICAL METHODS IN SMALL SIZE
APPLICATION OF NUMERICAL METHODS IN SMALL SIZE
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methods
 
Newton’s Forward & backward interpolation
Newton’s Forward &  backward interpolation Newton’s Forward &  backward interpolation
Newton’s Forward & backward interpolation
 
Calc 3.8
Calc 3.8Calc 3.8
Calc 3.8
 
Funcion gamma
Funcion gammaFuncion gamma
Funcion gamma
 
Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson Method
 
Sermon Slide Deck: "Thank God It's Monday"
Sermon Slide Deck: "Thank God It's Monday"Sermon Slide Deck: "Thank God It's Monday"
Sermon Slide Deck: "Thank God It's Monday"
 
Unit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generationUnit 3 random number generation, random-variate generation
Unit 3 random number generation, random-variate generation
 
On Continuous Approximate Solution of Ordinary Differential Equations
On Continuous Approximate Solution of Ordinary Differential EquationsOn Continuous Approximate Solution of Ordinary Differential Equations
On Continuous Approximate Solution of Ordinary Differential Equations
 
Random variate generation
Random variate generationRandom variate generation
Random variate generation
 
Sampling distribution
Sampling distributionSampling distribution
Sampling distribution
 
Components of data communication
Components of data communication Components of data communication
Components of data communication
 
The newton raphson method
The newton raphson methodThe newton raphson method
The newton raphson method
 
Use of Statistics in real life
Use of Statistics in real lifeUse of Statistics in real life
Use of Statistics in real life
 
Es272 ch3a
Es272 ch3aEs272 ch3a
Es272 ch3a
 

Semelhante a Newton raphson method

Newton raphsonmethod presentation
Newton raphsonmethod presentationNewton raphsonmethod presentation
Newton raphsonmethod presentationAbdullah Moin
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlabsheetslibrary
 
Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equationsZunAib Ali
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlabZunAib Ali
 
B02110105012
B02110105012B02110105012
B02110105012theijes
 
The International Journal of Engineering and Science (The IJES)
 The International Journal of Engineering and Science (The IJES) The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)theijes
 
Roots of equations
Roots of equationsRoots of equations
Roots of equationsgilandio
 
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...mathsjournal
 
Numerical differentation with c
Numerical differentation with cNumerical differentation with c
Numerical differentation with cYagya Dev Bhardwaj
 
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...mathsjournal
 
Roots of equations
Roots of equationsRoots of equations
Roots of equationsMileacre
 
Equations root
Equations rootEquations root
Equations rootMileacre
 
Newton's Raphson method
Newton's Raphson methodNewton's Raphson method
Newton's Raphson methodSaloni Singhal
 
Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...
Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...
Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...RaihanHossain49
 
lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...
lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...
lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...mathsjournal
 
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...mathsjournal
 
Applied numerical methods lec5
Applied numerical methods lec5Applied numerical methods lec5
Applied numerical methods lec5Yasser Ahmed
 

Semelhante a Newton raphson method (20)

Newton raphsonmethod presentation
Newton raphsonmethod presentationNewton raphsonmethod presentation
Newton raphsonmethod presentation
 
Newton
NewtonNewton
Newton
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
 
Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equations
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
 
B02110105012
B02110105012B02110105012
B02110105012
 
The International Journal of Engineering and Science (The IJES)
 The International Journal of Engineering and Science (The IJES) The International Journal of Engineering and Science (The IJES)
The International Journal of Engineering and Science (The IJES)
 
OPERATIONS RESEARCH
OPERATIONS RESEARCHOPERATIONS RESEARCH
OPERATIONS RESEARCH
 
Roots of equations
Roots of equationsRoots of equations
Roots of equations
 
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
 
Numerical differentation with c
Numerical differentation with cNumerical differentation with c
Numerical differentation with c
 
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
 
Roots of equations
Roots of equationsRoots of equations
Roots of equations
 
Equations root
Equations rootEquations root
Equations root
 
Newton's Raphson method
Newton's Raphson methodNewton's Raphson method
Newton's Raphson method
 
Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...
Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...
Exploring_the_Fundamentals_of_Numerical_Analysis_An_Overview_of_Newton_Raphso...
 
lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...
lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...
lassomodel, sparsity, multivariate modeling, NIR spectroscopy, biodiesel from...
 
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
Fractional Newton-Raphson Method and Some Variants for the Solution of Nonlin...
 
Applied numerical methods lec5
Applied numerical methods lec5Applied numerical methods lec5
Applied numerical methods lec5
 
Es272 ch5b
Es272 ch5bEs272 ch5b
Es272 ch5b
 

Último

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 

Último (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

Newton raphson method

  • 1.
  • 2. Newton-Raphson method, also known as the Newton’s Method, is the simplest and fastest approach to find the root of a function. It is an open bracket method and requires only one initial guess. Newton’s method is often used to improve the result or value of the root obtained from other methods. This method is more useful when the first derivative of f(x) is a large value.
  • 3. This is Newton’s Method of finding roots. It is an example of an Algorithm (a specific set of computational steps.) It is sometimes called the Newton-Raphson method Guess: 2.44948979592 ( )2.44948979592 .00000013016f = Amazingly close to zero! Newton’s Method: ( ) ( )1 n n n n f x x x f x + = − ′ This is a Recursive algorithm because a set of steps are repeated with the previous answer put in the next repetition. Each repetition is called an Iteration. →
  • 4. Commonly, we use the Newton-Raphson method to find a root of a complicated function . This iterative process follows a set guideline to approximate one root, considering the function, its derivative, and an initial x-value. We know that a root of a function is a zero of the function. This means that at the "root" the function equals zero. We can find these roots of a simple function such as: f(x) = x2 - 4 simply by setting the function to zero, and solving: f(x) = x2 -4 = 0 (x+2)(x-2) = 0 x = 2 or x = -2 The Newton-Raphson method uses an iterative process to approach one root of a function. The specific root that the process locates depends on the initial, arbitrarily chosen x-value.
  • 5. Here, xn is the current known x-value, f(xn) represents the value of the function at xn, f'(xn) is the derivative (slope) at xn. xn+1 represents the next x-value that you are trying to find. Essentially, f'(x), the derivative represents f(x)/dx (dx = delta-x). Therefore, the term f(x)/f'(x) represents a value of dx. The more iterations that are run, the closer dx will be to zero (0).
  • 6. To see how this works, we will perform the Newton- Raphson method on the function that we investigated earlier, f(x) = x2 -4. Below are listed the values that we need to know in order to complete the process. The table below shows the execution of the process.
  • 7. Thus, using an initial x-value of six (6) we find one root of the equation f(x) = x2 -4 is x=2. If we were to pick a different inital x-value, we may find the same root, or we may find the other one, x=-2.
  • 8. A graphical representation can also be very helpful. Below, you see the same function f(x) = x2 -4 (shown in blue). The process here is the same as above. In the first iteration, the red line is tangent to the curve at x0. The slope of the tangent is the derivative at the point of tangency, and for the first iteration is equal to 12. Dividing the value of the function at the initial x (f(6)=32) by the slope of the tangent (12), we find that the delta-x is equal to 2.67. Subtracting this from six (6) we find that the new x-value is equal to 3.33. Another way of considering this is to find the root of this tangent line. The new x-value (xn+1) will be equal to the root of the tangent to the function at the current x-value (xn).
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Features of Newton Raphson Method: •Type – open bracket •No. of initial guesses – 1 •Convergence – quadratic •Rate of convergence – faster •Accuracy – good •Programming effort – easy •Approach – Taylor’s series The C program for Newton Raphson method presented here is a programming approach which can be used to find the real roots of not only a nonlinear function, but also those of algebraic and transcendental equations.
  • 14. Newton Raphson MethodNewton Raphson Method Algorithm:Algorithm:1.Start 2.Read x, e, n, d *x is the initial guess e is the absolute error i.e the desired degree of accuracy n is for operating loop d is for checking slope* 3.Do for i =1 to n in step of 2 4.f = f(x) 5.f1 = f'(x) 6.If ( [f1] < d), then display too small slope and goto 11. *[ ] is used as modulus sign* 7.x1 = x – f/f1 8.If ( [(x1 – x)/x1] < e ), the display the root as x1 and goto 11. *[ ] is used as modulus sign* 9.x = x1 and end loop 10.Display method does not converge due to oscillation. 11.Stop
  • 15. Newton Raphson Method Flowchart:Newton Raphson Method Flowchart:
  • 16. Source CodeSource Code # include <stdio.h> # include <conio.h> # include <math.h> # include <process.h> # include <string.h> # define f(x) 3*x -cos(x)-1 # define df(x) 3+sin(x) void NEW_RAP(); void main() { clrscr(); printf ("n Solution by NEWTON RAPHSON method n"); printf ("n Equation is: ");
  • 17. printf ("nttt 3*X - COS X - 1=0 nn "); NEW_RAP(); getch(); } void NEW_RAP() { long float x1,x0; long float f0,f1; long float df0; int i=1; int itr; float EPS; float error;
  • 18. for(x1=0;;x1 +=0.01) { f1=f(x1); if (f1 > 0) { break; } } x0=x1-0.01; f0=f(x0); printf(" Enter the number of iterations: "); scanf(" %d",&itr); printf(" Enter the maximum possible error: "); scanf("%f",&EPS);
  • 19. if (fabs(f0) > f1) { printf("ntt The root is near to %.4fn",x1); } if(f1 > fabs(f(x0))) { printf("ntt The root is near to %.4fn",x0); } x0=(x0+x1)/2; for(;i<=itr;i++) { f0=f(x0); df0=df(x0); x1=x0 - (f0/df0); printf("ntt The %d approximation to the root is: %f",i,x1); error=fabs(x1-x0);
  • 20. if(error<EPS) { break; } x0 = x1; } if(error>EPS) { printf("nnt NOTE:- "); printf("The number of iterations are not sufficient."); } printf("nnnttt ------------------------------"); printf("nttt The root is %.4f ",x1); printf("nttt ------------------------------"); }
  • 21. Write a program of GENERAL NEWTON RAPHSON METHOD. #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<math.h>   int user_power,i=0,cnt=0,flag=0; int coef[10]={0}; float x1=0,x2=0,t=0; float fx1=0,fdx1=0;   void main() {       clrscr();
  • 22. printf("nnttt PROGRAM FOR NEWTON RAPHSON GENERAL"); printf("nnntENTER THE TOTAL NO. OF POWER:::: "); scanf("%d",&user_power); for(i=0;i<=user_power;i++) { printf("nt x^%d::",i); scanf("%d",&coef[i]); } printf("n"); printf("nt THE POLYNOMIAL IS ::: "); for(i=user_power;i>=0;i--)//printing coeff. { printf(" %dx^%d",coef[i],i); }
  • 23. printf("ntINTIAL X1---->"); scanf("%f",&x1); printf("n ******************************************************"); printf("n ITERATION X1 FX1 F'X1 "); printf("n ******************************************************"); do { cnt++; fx1=fdx1=0; for(i=user_power;i>=1;i--) { fx1+=coef[i] * (pow(x1,i)) ; } fx1+=coef[0]; for(i=user_power;i>=0;i--) { fdx1+=coef[i]* (i*pow(x1,(i-1))); }
  • 24. t=x2; x2=(x1-(fx1/fdx1)); x1=x2; printf("n %d %.3f %.3f %.3f ",cnt,x2,fx1,fdx1); } while((fabs(t - x1))>=0.0001); printf("nt THE ROOT OF EQUATION IS %f",x2); getch(); }
  • 25. /*******************************OUTPUT***********************************/ PROGRAM FOR NEWTON RAPHSON GENERAL ENTER THE TOTAL NO. OF POWER:::: 3 x^0::-3 x^1::-1 x^2::0 x^3::1 THE POLYNOMIAL IS ::: 1x^3 0x^2 -1x^1 -3x^0 INTIAL X1---->3 ************************************** ITERATION X1 FX1 F'X1 ************************************** 1 2.192 21.000 26.000 2 1.794 5.344 13.419 3 1.681 0.980 8.656 4 1.672 0.068 7.475 5 1.672 0.000 7.384 ************************************** THE ROOT OF EQUATION IS 1.671700
  • 26. C PROGRAM OF NEWTON RAPHSON METHOD : #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<math.h> int max_power,i=0,cnt=0,flag=0; int coef[10]={0}; float x1=0,x2=0,t=0; float fx1=0,fdx1=0; int main() { printf("-----------------------------------------------------------n"); printf("-----------------------------------------------------------nn"); printf("nnt C PROGRAM FOR NEWTON RAPHSON METHOD"); printf("nnntENTER THE MAXIMUM POWER OF X = ");
  • 27. scanf("%d",&max_power); for(i=0;i<=max_power;i++) { printf("nt x^%d = ",i); scanf("%d",&coef[i]); } printf("n"); printf("ntTHE POLYNOMIAL IS = "); for(i=max_power;i>=0;i--)/*printing coefficients*/ { printf(" %dx^%d",coef[i],i); } printf("nntFirst approximation x1 ----> "); scanf("%f",&x1);
  • 28. printf("nn-----------------------------------------------------------n"); printf("n ITERATION t x1 t F(x1) t tF'(x1) "); printf("n-----------------------------------------------------------n"); do { cnt++; fx1=fdx1=0; for(i=max_power;i>=1;i--) { fx1+=coef[i] * (pow(x1,i)) ; } fx1+=coef[0]; for(i=max_power;i>=0;i--) { fdx1+=coef[i]* (i*pow(x1,(i-1))); }
  • 29. t=x2; x2=(x1-(fx1/fdx1)); x1=x2; printf("nt %d t%.3f t %.3ftt%.3f ",cnt,x2,fx1,fdx1); }while((fabs(t - x1))>=0.0001); printf("nnnt THE ROOT OF EQUATION IS = %f",x2); getch(); }