Roots of a Nonlinear
                   Equation


           Topic: Newton-Raphson Method

                Major: General Engineering



07/20/09            http://numericalmethods.eng.usf.edu   1
Newton-Raphson Method

     f(x)



                                                                  f(xi )
     f(xi)
                                      [x f( x )]     xi +1 = xi -
                                        i,   i                      ′
                                                                  f (xi )


    f(xi-1)

                             θ
                   xi+2   xi+1   xi              X




2
Derivation
    f(x)
                                              AB
                                  tan(α ) =
                                              AC
    f(xi)              B
                                               f ( xi )
                                f ' ( xi ) =
                                             xi − xi +1

                                                f ( xi )
                                   xi +1 = xi −
            C α       A     X                   f ' ( xi )
             xi+1      xi


3
Algorithm for Newton-
       Raphson Method



4
Step 1



    Evaluate f′(x) symbolically




5
Step 2

    Calculate the next estimate of the root

                                       f(xi )
                          xi +1 = xi -
                                       f'(xi )
    Find the absolute relative approximate error


                               xi +1- xi
                          ∈a =           x 100
                                 xi +1
6
Step 3
       Find if the absolute relative approximate error is
        greater than the pre-specified relative error
        tolerance.

       If so, go back to step 2, else stop the algorithm.

       Also check if the number of iterations has exceeded
        the maximum number of iterations.




7
Example
       You are working for ‘DOWN THE TOILET COMPANY’ that
        makes floats for ABC commodes. The ball has a specific
        gravity of 0.6 and has a radius of 5.5 cm. You are asked
        to find the distance to which the ball will get submerged
        when floating in water.




8
Solution
         The equation that gives the depth ‘x’ to which the ball is
           submerged under water is given by
               f ( x ) = x 3-0.165 x 2+3.993x10- 4
               f ( x ) = 3x 2-0.33x
    Use the Newton’s method of finding
    roots of equations to find the depth
    ‘x’ to which the ball is submerged
    under water. Conduct three
    iterations to estimate the root of the
    above equation.

9
Graph of function f(x)
     f ( x ) = x -0.165 x +3.993x10
             3        2               -4




10
Iteration #1
           x0 = 0.02
                      f ( x0 )
           x1 = x0 −
                     f ' ( x0 )
                       3.413x10−4
           x1 = 0.02 −
                       − 5.4 x10−3
              = 0.08320
           ∈ = 75.96%
            a




11
Iteration #2
           x1 = 0.08320
                        f ( x1 )
           x2 = x1 −
                       f ' ( x1 )
                          −1.670x10 −4
           x2 = 0.08320 −
                          − 6.689 x10 −3
              = 0.05824
           ∈ = 42.86%
            a




12
Iteration #3
          x2 = 0.05824
                     f ( x2 )
          x3 = x2 −
                    f ' ( x2 )
                        3.717 x10−5
            = 0.05284 −
                        − 9.043x10−3
            = 0.06235
          ∈ = 6.592%
           a




13
Advantages

        Converges fast, if it converges
        Requires only one guess




14
Drawbacks
                           10
                                    f(x)


                           5




                           0                                      x
     -2   -1           2        0           3     1           2

               1
                           -5




                                           f ( x ) = ( x − 1) = 0
                        -10
                                                          3

                        -15




                        -20




                   Inflection Point
15
Drawbacks (continued)
                               1.00E-05
                                              f(x)
                              7.50E-06

                              5.00E-06

                              2.50E-06

                              0.00E+00                                            x
     -0.03    -0.02   -0.01               0          0.01     0.02     0.03       0.04
                              -2.50E-06
                                                            0.02
                              -5.00E-06


                                              f ( x ) = x 3 − 0.03 x 2 + 2.4 x10 −6 = 0
                              -7.50E-06

                              -1.00E-05




                         Division by zero

16
Drawbacks (continued)
                  1.5
          f(x)
                   1



                 0.5


                                                                x
                   0
     -2
          -0.063069 0.54990
                  0           2    4
                                       4.462   6
                                                   7.53982
                                                         8      10

                 -0.5



                   -1                          f ( x ) = Sin x = 0
                 -1.5




                                  Root Jumping
17
Drawbacks (continued)
                              6
                                   f(x)

                              5



                              4



                              3
               3

                              2
                                          2             f ( x) = x2 + 2 = 0
                             11
                                                                   4
                                                                              x
                              0
     -2            -1              0                1         2        3
      -1.75             -0.3040               0.5                          3.142
                              -1




          Oscillations near Local Maxima or Minima
18

Newton-Raphson Method

  • 1.
    Roots of aNonlinear Equation Topic: Newton-Raphson Method Major: General Engineering 07/20/09 http://numericalmethods.eng.usf.edu 1
  • 2.
    Newton-Raphson Method f(x) f(xi ) f(xi) [x f( x )] xi +1 = xi - i, i ′ f (xi ) f(xi-1) θ xi+2 xi+1 xi X 2
  • 3.
    Derivation f(x) AB tan(α ) = AC f(xi) B f ( xi ) f ' ( xi ) = xi − xi +1 f ( xi ) xi +1 = xi − C α A X f ' ( xi ) xi+1 xi 3
  • 4.
    Algorithm for Newton- Raphson Method 4
  • 5.
    Step 1 Evaluate f′(x) symbolically 5
  • 6.
    Step 2 Calculate the next estimate of the root f(xi ) xi +1 = xi - f'(xi ) Find the absolute relative approximate error xi +1- xi ∈a = x 100 xi +1 6
  • 7.
    Step 3  Find if the absolute relative approximate error is greater than the pre-specified relative error tolerance.  If so, go back to step 2, else stop the algorithm.  Also check if the number of iterations has exceeded the maximum number of iterations. 7
  • 8.
    Example  You are working for ‘DOWN THE TOILET COMPANY’ that makes floats for ABC commodes. The ball has a specific gravity of 0.6 and has a radius of 5.5 cm. You are asked to find the distance to which the ball will get submerged when floating in water. 8
  • 9.
    Solution The equation that gives the depth ‘x’ to which the ball is submerged under water is given by f ( x ) = x 3-0.165 x 2+3.993x10- 4 f ( x ) = 3x 2-0.33x Use the Newton’s method of finding roots of equations to find the depth ‘x’ to which the ball is submerged under water. Conduct three iterations to estimate the root of the above equation. 9
  • 10.
    Graph of functionf(x) f ( x ) = x -0.165 x +3.993x10 3 2 -4 10
  • 11.
    Iteration #1 x0 = 0.02 f ( x0 ) x1 = x0 − f ' ( x0 ) 3.413x10−4 x1 = 0.02 − − 5.4 x10−3 = 0.08320 ∈ = 75.96% a 11
  • 12.
    Iteration #2 x1 = 0.08320 f ( x1 ) x2 = x1 − f ' ( x1 ) −1.670x10 −4 x2 = 0.08320 − − 6.689 x10 −3 = 0.05824 ∈ = 42.86% a 12
  • 13.
    Iteration #3 x2 = 0.05824 f ( x2 ) x3 = x2 − f ' ( x2 ) 3.717 x10−5 = 0.05284 − − 9.043x10−3 = 0.06235 ∈ = 6.592% a 13
  • 14.
    Advantages  Converges fast, if it converges  Requires only one guess 14
  • 15.
    Drawbacks 10 f(x) 5 0 x -2 -1 2 0 3 1 2 1 -5 f ( x ) = ( x − 1) = 0 -10 3 -15 -20 Inflection Point 15
  • 16.
    Drawbacks (continued) 1.00E-05 f(x) 7.50E-06 5.00E-06 2.50E-06 0.00E+00 x -0.03 -0.02 -0.01 0 0.01 0.02 0.03 0.04 -2.50E-06 0.02 -5.00E-06 f ( x ) = x 3 − 0.03 x 2 + 2.4 x10 −6 = 0 -7.50E-06 -1.00E-05 Division by zero 16
  • 17.
    Drawbacks (continued) 1.5 f(x) 1 0.5 x 0 -2 -0.063069 0.54990 0 2 4 4.462 6 7.53982 8 10 -0.5 -1 f ( x ) = Sin x = 0 -1.5 Root Jumping 17
  • 18.
    Drawbacks (continued) 6 f(x) 5 4 3 3 2 2 f ( x) = x2 + 2 = 0 11 4 x 0 -2 -1 0 1 2 3 -1.75 -0.3040 0.5 3.142 -1 Oscillations near Local Maxima or Minima 18