S.N.PATEL INSTITUTE OF
TECHNOLOGY AND RESEARCH
CENTRE,UMRAKH
Secant Method
Prepared By: 150490105035
Subject : CEM(2140505)
1. Mr. Tejas Patel
2. Mrs. Jagruti Patel
Guided by:
Features of Newton’s Method:
 Type – open bracket
 No. of initial guesses – 1
 Convergence – quadratic
 Rate of convergence – faster
 Accuracy – good
 Programming effort – easy
 Approach – Taylor’s series
Newton Raphson Method:-
 The most used ittration method is Newton-raphson method, also
called newton`s methodand,
 When an apporimation value of a root of an equation is given, a
better and closer approximation to the root can be found using
this method.
 This method is a particular form of the ittration method dicussed
earlier and divided as follow,
 Suppose is a root of and is an estimate of . Then
by Taylor series expansion we have,
 By newton raphson method
Newton Raphson Method Algorithm:
 Start
 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*
 Do for i =1 to n in step of 2
 f = f(x)
 f1 = f'(x)
 If ( [f1] < d), then display too small slope and goto 11.
*[ ] is used as modulus sign*
 x1 = x – f/f1If ( [(x1 – x)/x1] < e ), the display the root as x1 and goto 11.
*[ ] is used as modulus sign*
 x = x1 and end loop
 Display method does not converge due to oscillation.
 Stop
Source code for secant method in C:
 #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;
 }
 void main()
 {
 int itr, maxmitr;
 float h, x0, x1, allerr;
 printf("nEnter x0, allowed error and maximum iterationsn");
 scanf("%f %f %d", &x0, &allerr, &maxmitr);
 for (itr=1; itr<=maxmitr; itr++)
 {
 h=f(x0)/df(x0);
 x1=x0-h;
 printf(" At Iteration no. %3d, x = %9.6fn", itr, x1);
 if (fabs(h) < allerr)
 {
 printf("After %3d iterations, root = %8.6fn", itr, x1);
 return 0;
 }
 x0=x1;
 }
 printf(" The required solution does not converge or iterations are
insufficientn");
 return 1;
 }
References
 http://www.codewithc.com/c-program-for-newton-raphson-method/
 http://www.codewithc.com/newton-raphson-method-algorithm-flowchart/
Thank You

Newton raphson method

  • 1.
    S.N.PATEL INSTITUTE OF TECHNOLOGYAND RESEARCH CENTRE,UMRAKH Secant Method Prepared By: 150490105035 Subject : CEM(2140505) 1. Mr. Tejas Patel 2. Mrs. Jagruti Patel Guided by:
  • 2.
    Features of Newton’sMethod:  Type – open bracket  No. of initial guesses – 1  Convergence – quadratic  Rate of convergence – faster  Accuracy – good  Programming effort – easy  Approach – Taylor’s series
  • 3.
    Newton Raphson Method:- The most used ittration method is Newton-raphson method, also called newton`s methodand,  When an apporimation value of a root of an equation is given, a better and closer approximation to the root can be found using this method.  This method is a particular form of the ittration method dicussed earlier and divided as follow,  Suppose is a root of and is an estimate of . Then by Taylor series expansion we have,
  • 4.
     By newtonraphson method
  • 5.
    Newton Raphson MethodAlgorithm:  Start  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*  Do for i =1 to n in step of 2  f = f(x)  f1 = f'(x)  If ( [f1] < d), then display too small slope and goto 11. *[ ] is used as modulus sign*  x1 = x – f/f1If ( [(x1 – x)/x1] < e ), the display the root as x1 and goto 11. *[ ] is used as modulus sign*  x = x1 and end loop  Display method does not converge due to oscillation.  Stop
  • 6.
    Source code forsecant method in C:  #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;  }  void main()  {  int itr, maxmitr;  float h, x0, x1, allerr;  printf("nEnter x0, allowed error and maximum iterationsn");
  • 7.
     scanf("%f %f%d", &x0, &allerr, &maxmitr);  for (itr=1; itr<=maxmitr; itr++)  {  h=f(x0)/df(x0);  x1=x0-h;  printf(" At Iteration no. %3d, x = %9.6fn", itr, x1);  if (fabs(h) < allerr)  {  printf("After %3d iterations, root = %8.6fn", itr, x1);  return 0;  }  x0=x1;  }  printf(" The required solution does not converge or iterations are insufficientn");  return 1;  }
  • 8.
  • 9.