Ppt Bisection

download Ppt Bisection

of 34

Transcript of Ppt Bisection

  • 8/6/2019 Ppt Bisection

    1/34

    7/21/2011 http://numericalmethods.eng.usf.edu 1

    Bisection Method

    Major: All Engineering Majors

    Authors: Autar Kaw, Jai Paul

    http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM

    Undergraduates

  • 8/6/2019 Ppt Bisection

    2/34

    Bisection Method

    http://numericalmethods.eng.usf.edu

  • 8/6/2019 Ppt Bisection

    3/34

    http://numericalmethods.eng.usf.edu3

    Basis of Bisection MethodTheorem

    xN

    f(x)

    xu x

    An equation f(x)=0, where f(x) is a real continuous function,has at least one root between x l and x u if f(x l) f(x u) < 0.

    Figu re 1 At least one root exists between the two points if the function isreal, continuous, and changes sign.

  • 8/6/2019 Ppt Bisection

    4/34

    xN

    f(x)

    xu x

    http://numericalmethods.eng.usf.edu4

    Basis of Bisection Method

    Figu re 2 If function does not change sign between twopoints, roots of the equation may still exist between the two

    points.

    x f 0! x f

  • 8/6/2019 Ppt Bisection

    5/34

    xN

    (x)

    xu x

    http://numericalmethods.eng.usf.edu5

    Basis of Bisection Method

    Figu re 3 If the function does not change sign between twopoints, there may not be any roots for the equation betweenthe two points.

    xN

    (x)

    xu

    x

    x f 0! x f

  • 8/6/2019 Ppt Bisection

    6/34

    xN

    f(x)

    xu x

    http://numericalmethods.eng.usf.edu6

    Basis of Bisection Method

    Figu re 4 If the function changes sign between two points,more than one root for the equation may exist between the twopoints.

    x f 0! x f

  • 8/6/2019 Ppt Bisection

    7/34

    http://numericalmethods.eng.usf.edu7

    Algorithm for Bisection Method

  • 8/6/2019 Ppt Bisection

    8/34

    http://numericalmethods.eng.usf.edu8

    Step 1Choose x P and x u as two guesses for the root such that f(xP ) f(x u) < 0, or in other words, f(x) changes signbetween x P and x u. This was demonstrated in Figure 1.

    xN

    (x)

    xu x

    Figu re 1

  • 8/6/2019 Ppt Bisection

    9/34

    xN

    (x)

    xu x

    xm

    http://numericalmethods.eng.usf.edu9

    Step 2Estimate the root, x m of the equation f (x) = 0 as the midpoint between x P and x u as

    xx

    m =x uN

    2

    Figu re 5 Estimate of x m

  • 8/6/2019 Ppt Bisection

    10/34

    http://numericalmethods.eng.usf.edu10

    Step 3Now check the following

    a) If , then the root lies between x P andxm; then x P = x P ; x u = x m.

    b) If , then the root lies between x m andxu; then x P = x m; x u = x u.

    c) If ; then the root is x m. Stop thealgorithm if this is true.

    0ml x f x f

    0"ml x f x f

    0!ml x f x f

  • 8/6/2019 Ppt Bisection

    11/34

    http://numericalmethods.eng.usf.edu11

    Step 4

    xx

    m x

    uN

    2

    100v!new

    m

    o ld

    m

    new

    a

    x

    x xm

    rootof estima tecurr ent !ne

    m x

    rootof es tima te pr ev ious!o ld m x

    Find the new estimate of the root

    Find the absolute relative approximate error

    where

  • 8/6/2019 Ppt Bisection

    12/34

    http://numericalmethods.eng.usf.edu12

    Step 5

    Is ? Yes

    No

    Go to Step 2 using newupper and lower

    guesses.

    Stop the algorithm

    Compare the absolute relative approximate error withthe pre-specified error tolerance .

    a

    s

    sa"

    Note one should also check whether the number of iterations is more than the maximum number of iterationsallowed. If so, one needs to terminate the algorithm andnotify the user about it.

  • 8/6/2019 Ppt Bisection

    13/34

    http://numericalmethods.eng.usf.edu13

    Example 1 You are working for DOWN THE TOILET COMPANY that makes floats for ABC commodes. The floating ball has aspecific gravity of 0.6 and has a radius of 5.5 cm. Youare asked to find the depth to which the ball issubmerged when floating in water.

    Figu re 6 Diagram of the floating ball

  • 8/6/2019 Ppt Bisection

    14/34

    http://numericalmethods.eng.usf.edu14

    Example 1 Cont.The equation that gives the depth x to which the ball issubmerged under water is given by

    a) Use the bisection method of finding roots of equations tofind the depth x to which the ball is submerged underwater. Conduct three iterations to estimate the root of

    the above equation.b) Find the absolute relative approximate error at the endof each iteration, and the number of significant digits at least correct at the end of each iteration.

    010993.3165.0423

    !v x x

  • 8/6/2019 Ppt Bisection

    15/34

    http://numericalmethods.eng.usf.edu15

    Example 1 Cont.From the physics of the problem, the ball would besubmerged between x = 0 and x = 2R,

    where R = radius of the ball,that is

    11.00

    055.020

    20

    ee

    ee

    ee

    x

    x

    R x

    Figu re 6 Diagram of the floating ball

  • 8/6/2019 Ppt Bisection

    16/34

    To aid in the understanding

    of how this method works tofind the root of an equation,the graph of f(x) is shown tothe right,

    where

    http://numericalmethods.eng.usf.edu16

    Example 1 Cont.

    423 1099331650 -. x. x x f v!

    Figu re 7 Graph of the function f(x)

    S ol uti on

  • 8/6/2019 Ppt Bisection

    17/34

    http://numericalmethods.eng.usf.edu17

    Example 1 Cont.Let us assume

    11.0

    00.0!

    !

    u x

    xN

    Check if the function changes sign between x P and x u .

    4423

    4423

    10662.210993.311.0165.011.011.0

    10993.310993.30165.000

    v!v!!

    v!v!!

    f x f

    f x f

    u

    l

    Hence

    010662.210993.311.00 44 vv!! f f x f x f ul So there is at least on root between x P and x u, that is between 0 and 0.11

  • 8/6/2019 Ppt Bisection

    18/34

    http://numericalmethods.eng.usf.edu18

    Example 1 Cont.

    Figu re 8 Graph demonstrating sign change between initial limits

  • 8/6/2019 Ppt Bisection

    19/34

    http://numericalmethods.eng.usf.edu19

    Example 1 Cont.055.0

    211.00

    2!!! u

    m

    x x x N

    010655.610993.3055.00

    10655.610993.3055.0165.0055.0055.054

    5423

    "vv!!

    v!v!!

    f f x f x f

    f x f

    ml

    m

    Iteration 1The estimate of the root is

    Hence the root is bracketed between x m and x u, that is, between 0.055

    and 0.11. So, the lower and upper limits of the new bracket are

    At this point, the absolute relative approximate error cannot becalculated as we do not have a previous approximation.

    11.0 ,055.0 !! ul x x

    a

  • 8/6/2019 Ppt Bisection

    20/34

    http://numericalmethods.eng.usf.edu20

    Example 1 Cont.

    Figu re 9 Estimate of the root for Iteration 1

  • 8/6/2019 Ppt Bisection

    21/34

    http://numericalmethods.eng.usf.edu21

    Example 1 Cont.082 5.0

    211.0055.0

    2!!! u

    m

    x x x N

    010655.610622.1)082 5.0(055.0

    10622.110993.3082 5.0165.0082 5.0082 5.054

    4423

    vv!!

    v!v!!

    f f x f x f

    f x f

    ml

    m

    Iteration 2The estimate of the root is

    Hence the root is bracketed between x P and x m, that is, between 0.055

    and 0.0825. So, the lower and upper limits of the new bracket are082 5.0 ,055.0 !! ul x x

  • 8/6/2019 Ppt Bisection

    22/34

    http://numericalmethods.eng.usf.edu22

    Example 1 Cont.

    Figu re 10 Estimate of the root for Iteration 2

  • 8/6/2019 Ppt Bisection

    23/34

    http://numericalmethods.eng.usf.edu23

    Example 1 Cont.The absolute relative approximate error at the end of Iteration 2 is

    a

    %333.33

    100082 5.0

    055.0082 5.0

    100

    !

    !

    !ne

    m

    o ld

    m

    ne

    m

    a

    x x x

    None of the significant digits are at least correct in the estimate root of xm = 0.0825 because the absolute relative approximate error is greaterthan 5%.

  • 8/6/2019 Ppt Bisection

    24/34

    http://numericalmethods.eng.usf.edu24

    Example 1 Cont.06875.0

    2082 5.0055.0

    2!!! u

    m

    x x x N

    010563.510655.606875.0055.0

    10563.510993.306875.0165.006875.006875.055

    5423

    vv!!

    v!v!!

    f f x f x f

    f x f

    ml

    m

    Iteration 3The estimate of the root is

    Hence the root is bracketed between x P and x m, that is, between 0.055

    and 0.06875. So, the lower and upper limits of the new bracket are06875.0 ,055.0 !! ul x x

  • 8/6/2019 Ppt Bisection

    25/34

    http://numericalmethods.eng.usf.edu25

    Example 1 Cont.

    Figu re 11 Estimate of the root for Iteration 3

  • 8/6/2019 Ppt Bisection

    26/34

    http://numericalmethods.eng.usf.edu26

    Example 1 Cont.The absolute relative approximate error at the end of Iteration 3 is

    a

    %20

    10006875.0

    082 5.006875.0

    100

    !

    v!

    v!ne

    m

    o ld

    m

    ne

    m

    a x x x

    Still none of the significant digits are at least correct in the estimatedroot of the equation as the absolute relative approximate error isgreater than 5%.Seven more iterations were conducted and these iterations are shown inTable 1.

  • 8/6/2019 Ppt Bisection

    27/34

    http://numericalmethods.eng.usf.edu27

    Table 1 Cont.Table 1 Root of f(x)=0 as function of number of iterations forbisection method.

    I terati n N a % f( )

    2

    3

    4

    7

    8

    9

    0

    0.00000

    0.0

    0.0

    0.0

    0.0 88

    0.0 880.0 88

    0.0 88

    0.0 23

    0.0 23

    0.11

    0.11

    0.082

    0.0 87

    0.0 87

    0.0 31 0.0 3 9

    0.0 273

    0.0 273

    0.0 2 2

    0.0

    0.082

    0.0 87

    0.0 188

    0.0 31

    0.0 3 90.0 273

    0.0 23

    0.0 2 2

    0.0 24 1

    ----------

    33 .33

    20 .00

    11.11

    .2 3

    2.7021.370

    0.6897

    0.343 6

    0.1721

    6.6551 0 5

    1.6 22104

    5.56 310 5

    4.484 10 6

    2 .59310 5

    1.0804 10 5

    3 .1761 0 6

    6.497 107

    1.2651 0 6

    3 .076810 7

  • 8/6/2019 Ppt Bisection

    28/34

    http://numericalmethods.eng.usf.edu28

    Table 1 Cont.

    Hence the number of significant digits at least correct is given by thelargest value or m for which

    463.23442.0log2

    23442.0log

    103442.0

    105.01721.0

    105.0

    2

    2

    2

    !e

    e

    e

    ve

    ve

    m

    m

    m

    m

    m

    a

    2!mSo

    The number of significant digits at least correct in the estimated root of 0.06241 at the end of the 10 th iteration is 2.

  • 8/6/2019 Ppt Bisection

    29/34

    http://numericalmethods.eng.usf.edu29

    Advantages Always convergent

    The root bracket gets halved with eachiteration - guaranteed.

  • 8/6/2019 Ppt Bisection

    30/34

    http://numericalmethods.eng.usf.edu30

    DrawbacksSlow convergence

    If one of the initial guesses is close tothe root, the convergence is slower

  • 8/6/2019 Ppt Bisection

    31/34

    http://numericalmethods.eng.usf.edu31

    Drawbacks (continued)If a function f(x) is such that it just touches the x-axis it will be unable to find

    the lower and upper guesses.f(x)

    x

    2 x x f !

  • 8/6/2019 Ppt Bisection

    32/34

    http://numericalmethods.eng.usf.edu32

    Drawbacks (continued)Function changes sign but root does not exist

    f(x)

    x

    x

    x f 1

    !

  • 8/6/2019 Ppt Bisection

    33/34

    Additional ResourcesFor all resources on this topic such as digital audiovisuallectures, primers, textbook chapters, multiple-choicetests, worksheets in MATLAB, MATHEMATICA, MathCadand MAPLE, blogs, related physical problems, pleasevisit

    http://numericalmethods.eng.usf.edu/topics/bisection_method.html

  • 8/6/2019 Ppt Bisection

    34/34

    THE END

    http://numericalmethods.eng.usf.edu