MAB3053 Roots Bracketingbisection Week3 Lec5

download MAB3053 Roots Bracketingbisection Week3 Lec5

of 21

Transcript of MAB3053 Roots Bracketingbisection Week3 Lec5

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    1/21

    Chap5/1

    CHAPTER 5 : ROOTS OF EQUATIONS

    Bracketing Methods

    LESSON PLAN

    To calculate roots of equation using

    Bracketing Methods:

    1. Bisection Method

    2. False Position Method

    y

    x

    - when a function is zero

    - when a function crosses x-axis

    roots

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    2/21

    Chap5/2

    2 TYPES OF EQUATIONS

    0... 011

    1

    fyfyfyf

    n

    i

    n

    i

    AlgebraicEquations

    - A functiony=f(x) is algebraic if it can be expressed in

    the form

    - Example: Quadratic equation 2x2 x 1= 0

    TranscendentalEquations

    - Non-algebraic equations

    - Trigonometric, exponential, logarithmic are examples of

    transcendental equations

    - Example

    01ln

    2

    x

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    3/21

    Chap5/3

    METHODS TO FIND ROOTS

    -1

    0

    1

    2

    3

    4

    5

    6

    7

    0.

    0

    0.4

    0.

    8

    1.2

    1.

    6

    2.

    0

    2.4

    2.

    8

    3.2

    3.

    6

    4.

    0

    x

    y

    plot the data points & connect them in a smooth curve

    locate the points at which the curve crosses thex-axis

    it provides rough estimate of theroots

    useful visualisation tool

    y= x23x+2

    Try this in MATLAB:

    >> f=inline(x^2-3*x+2)

    >> fplot(f,[0,3])

    roots

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    4/21

    To find the roots of

    Method 1:

    You have previously learned that:

    Method 2:

    How

    about

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    5/21

    BRACKETING METHODS

    2 types:

    1.Bisection Method

    2. False-Position Method

    Exploit the fact that a

    function typically changes

    sign in the vicinity of the

    root f(xL)f(xU) < 0

    It is called bracketing

    because two initial guesses

    that bracket the root on

    either side are required

    Note:

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    6/21

    Chap5/6

    BISECTION METHOD

    It is also known as Binary ChoppingorInterval Halving

    In general, if there are two points xL(lower bound) and

    xU(upper bound) such that f(xL)f(xU) < 0, then there is at least

    one rootbetweenxLandxU

    Next, the interval is

    successivelybisected into

    half

    After each bisection, the

    upper and lower bounds

    are updated.

    Interval is

    bisected

    into half

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    7/21

    Chap5/7

    BISECTION METHOD: 3-Step

    ALGORITHM

    STEP 1: Choose upperxUand lowerxLguesses such that

    f(xL) f(xU)< 0

    STEP 2: Estimate the root, xr

    by dividing the interval [xL

    xU

    ]

    into half

    STEP 3: Evaluate the next sub-interval

    Iff(xL) f(xr) < 0, root lies in the lower interval, setxU=xr, return to step 2

    Iff(xL) f(xr) > 0, root lies in the upper interval, setxL=xr, return to step 2

    Iff(xL) f(xr) = 0, root equals toxr, terminate computation

    2

    ULr

    xxx

    Midpoint:

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    8/21

    Chap5/8

    STEP 1: Choose upperxUand lowerxLguesses such that

    f(xL) f(xU)< 0

    root

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    9/21

    Chap5/9

    STEP 2: Estimate the root,xrby dividing the

    interval [xLxU] into half

    2

    ULr

    xxx

    Midpoint:

    Estimated root

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    10/21

    STEP 3: Evaluate the next sub-interval

    If f(xL) f(xr) < 0, root lies in the lower interval, set

    xU=xr, return to step 2

    Case 1 Case 2

    New iteration:xU=xr

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    11/21

    Chap5/11

    If f(xL) f(xr) > 0, root lies in the upper interval, set

    xL=xr, return to step 2

    Case 1 Case 2

    New iteration:xL=xr

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    12/21

    If f(xL) f(xr) = 0, root equals to xr, terminate

    computation

    Case 1 Case 2

    Root =xr

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    13/21

    Chap5/13

    BISECTION METHOD

    STOPPING CRITERION

    2 ULnewr

    xxx

    s100

    new

    r

    old

    r

    new

    ra

    x

    xx

    When to stop the iteration if it is hard to get f(xL) f(xr) = 0 ?

    Apply the convergence (stopping) criterionas follows:

    If error |a| < stopping error |s| , then root= xrnew

    where xrnew is the root for the current iteration,

    s

    LU

    LUa

    xx

    xx

    100or

    only valid for

    Bisection method (p121)

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    14/21

    Chap5/14

    CLASS ACTIVITY

    Use analytical method to determine the radius, r of a

    cylindrical can so that it holds 400 cm3 of liquid. Given

    r=h/3,wherehis the height.

    Now, use 3 iterations of the bisection method to determine

    the radius of the can. Use initial guesses of rL=3 cm and

    rU=4 cm. Also, calculate the estimated error,

    aand the true

    percent relative error, tafter each iteration.

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    15/21

    Chap5/15

    BISECTION METHOD

    PROS AND CONS

    Pros

    Easy and simple

    Can always find a

    single root

    Convergence is

    guaranteed

    Cons

    Slow to converge

    Must know xL

    and xU

    that bound

    the root

    Cannot detect multiple roots

    No account is taken of the

    magnitudes of f(xL) and f(xU). Iff(xL) is closer to zero, it is likely

    that the root is closer toxLthan to

    xU use False-Position Method

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    16/21

    Chap5/16

    FALSE-POSITION METHOD

    Iff(xL) is closer to zero, it is likely

    that the rootxris closer toxL

    The curve is replaced by a straight

    line that crosses the x-axis & givesfalse position atxr

    Based on similar triangle

    principle, we can approximate the

    solution by using linearinterpolationbetween the lower &

    upper bounds to find the root,xr

    Gives better estimate than

    Bisection method

    )()(

    ))((

    :forrearrange

    0)()()(

    uL

    uLuur

    r

    u

    ru

    Lu

    Lu

    xfxf

    xxxfxx

    x

    xf

    xx

    xfxf

    xx

    Lower bound

    Upper bound

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    17/21

    STEP 1: Choose upperxUand lowerxLguesses such that

    f(xL) f(xU)< 0

    STEP 2: Use similar triangle to interpolate the new estimate

    of the root

    STEP 3: Evaluate the next sub-interval

    Iff(xL) f(xr) < 0, root lies in the lower interval, setxU=xr, return to step 2

    Iff(xL) f(xr) > 0, root lies in the upper interval, setxL=xr, return to step 2

    Iff(xL) f(xr) = 0, root equals toxr, terminate computation Chap5/17

    FALSE-POSITION METHODALGORITHM

    uL

    uLuur

    xfxf

    xxxfxx

    Refer to Box 5.1

    (p125)

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    18/21

    Stopping criterion : Check for convergence criterion

    whereby error, a< s. If not, go back toSTEP 2.

    Why this method ?

    converge faster than Bisection methodalways converges to a single root

    Chap5/18

    FALSE-POSITION METHOD

    STOPPING CRITERION

    s%100

    new

    r

    old

    r

    new

    ra

    x

    xx

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    19/21

    Chap5/19

    CLASS ACTIVITY

    Use 3 iterations of false-position method to find a root of

    equationx3 + 4x2 10 =0. Employ initial guesses of

    xL=1 and xU=2. Calculate the approximate error, aand the

    true error, tafter each iteration. True value = 1.36523.

    uL

    uLuur

    xfxf

    xxxfxx

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    20/21

    False-position

    Faster than Bisection method

    Always converge to a single

    root Step 1:f(xL)f(xu) < 0

    Step 2:

    Step 3:

    Chap5/20

    SUMMARY: BRACKETING METHODS

    uLuLu

    ur

    xfxf

    xxxfxx

    Bisection

    Easy and simple

    Always converge to a

    single root Step 1:f(xL)f(xu) < 0

    Step 2:

    Step 3:

    2 UL

    r

    xxx

    rUrL xxxfxf set,0If

    rLrL xxxfxf set,0If

    rUrL xxxfxf set,0If

    rLrL xxxfxf set,0If

  • 7/26/2019 MAB3053 Roots Bracketingbisection Week3 Lec5

    21/21

    Chap5/21

    Thank You