numerical sol week02 (1)

Upload: ahmedom

Post on 01-Mar-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Numerical Sol Week02 (1)

    1/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@() net.hs-eng,com.hs-eng

    .

    Bracketing Methods

    )

    (

    Chapters 5

    Numerical

    Methods

    .

    .

    Week 2

    HS Engineers

    .

    (

    26094444-00965)

    .

    .

  • 7/25/2019 Numerical Sol Week02 (1)

    2/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(2) net.hs-eng,com.hs-eng

    .

    :

    () ( )

    (Numerical Methods)

    ().

    .

    .

    Graphical

    Method

    Bisection

    Method

    False Position

    MethodSimple Fixed

    Point Method

    Newton Raphson

    Method

    Secant

    Method

    Numerical Methods

    Roots of Equations

    Bracketing Methods

    Open Methods

  • 7/25/2019 Numerical Sol Week02 (1)

    3/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(3) net.hs-eng,com.hs-eng

    .

    This chapter on roots of equations deals with methods that use

    the fact that a function changes sign around its root.

    These techniques are called Bracketing Methods because two guesses

    for the root are required, these guesses must bracket the root. These

    methods always reduce the width of the bracket.

    5.1 Graphical Methods

    A simple method for obtaining an estimate of the root of the

    equation() is to make a plot of the function and observe whereit crosses the axis. This point, which represents the value for which

    () , provides a rough approximation of the root.

    x xroot root

    -.

    -

    .

    -.

    -

    (

    ).

    -

    .

    Bracketing Methods

  • 7/25/2019 Numerical Sol Week02 (1)

    4/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(4) net.hs-eng,com.hs-eng

    !

    EXAMPLE 5.1 The Graphical Approach

    Problem Statement:

    Use the graphical approach to determine the drag coefficient c needed

    for a parachutist of mass to have a velocity of 40 m/s afterfree-falling for time .() ( ()) ( )

    Solution:using the parameters , , , and :() () ( ())

    or

    ()

    (

    )

    Various values of c can be substituted into

    the right-hand side of this equation to

    compute the values of().

    These points can be plotted as shown in the

    figure.

    212. . ..

  • 7/25/2019 Numerical Sol Week02 (1)

    5/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(5) net.hs-eng,com.hs-eng

    .

    Special Cases

    Graphical techniques are of limited practical value because they are

    not precise. However, they can be used to obtain rough estimates ofroots. These estimates can be employed as starting guesses for the

    other numerical methods discussed in this and next chapter.

    They are also important tools for understanding the properties of the

    functions and guessing the pitfalls of the other numerical methods.

    Figure (b) shows the case where a single root is

    bracketed by negative and positive values of().

    However, fig(d) where () and () are also onopposite sides of the axis, shows three rootsoccurring within the interval.

    In general, if () and () have opposite signs,there are an odd number of roots in the interval (fig b).

    As indicated by fig (a) and (c), if () and ()have the same sign, there are either no roots or even

    number of roots between the values.

    .

  • 7/25/2019 Numerical Sol Week02 (1)

    6/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(6) net.hs-eng,com.hs-eng

    .

    Although previous generalizations are usually true,

    there are some cases where they do not hold.

    For example, functions that are tangential to the axis as in figure(a) and discontinuous functions as infig(b) can violate these principles.

    An example of a function that is tangential to the axis

    is the cubic equation () ( )( )( ).Notice that makes two terms in thispolynomial equal to zero. Mathematically, iscalled a multiple root (fig a).

    .

    The existence of such cases makes it difficult to develop general

    computer algorithms guaranteed to locate all the roots in an interval.

    ( (.

    ()(

    .)

    ( (,().( (..

    ( )..

    Graphical Method Summary

  • 7/25/2019 Numerical Sol Week02 (1)

    7/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(7) net.hs-eng,com.hs-eng

    -8

    -4

    0

    4

    8

    -5 0 5 10

    .

    Problem 5.1

    Determine the real roots of() :(a)

    Graphically.(b)Using the quadratic formula.

    Solution

    (a)A plot indicates that roots occur at about and 6.4.

    ( ( )6, 7 ).

    (b)

    () ()()

    ()

    ( .)

    ( ) () () () ( )

  • 7/25/2019 Numerical Sol Week02 (1)

    8/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(8) net.hs-eng,com.hs-eng

    5.2 The Bisection Method

    .

    When applying the graphical technique in example 5.1, you have

    observed that()changed sign on the opposite sides of the root. In general, if()is realand continuousin the interval from to and

    ()and()have opposite signs, that is:() () then, there is at least one real root between and .

    The bisection method, alternatively called (binary chopping), is one type of

    incremental search method in which the interval is always divided in half.

    If a function changes sign over an interval, the function value at the

    midpoint is evaluated, and the location of the root is then suggested to lie

    at the midpoint of that new subinterval.

    The process is repeated to obtain refined estimates.

    Step 1:Choose lower and upper guesses for the root such that:(ensure that() () )

    Step2:Find an estimate of the root

    using:

    Step3:Determine in which subinterval the root lies:

    (a)If() () , the root lies in the lower subinterval.set and return to step 2.

    (b)If() () , set and return to step 2.(c)If

    () () , the root equals

    , terminate.

    (iteration).

    Steps for the bisection method

  • 7/25/2019 Numerical Sol Week02 (1)

    9/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(9) net.hs-eng,com.hs-eng

    .

    Example 5.3: Bisection Method

    Use bisection method to solve the same problem approached

    graphically in example 5.1 (page 4).

    Solution:

    The first step in bisection is to guess two values of the unknown ()that give values for()with different signs.

    We can see that the function changes sign between values of 12 and

    16. Therefore, the initial estimate of the root () lies at the midpointof the interval

    This estimate represents a true percent relative error of

    (note that the true value of the root is (14.7802).

    Next, we compute the product of the function value at the lower

    ()and at the midpoint ():() () ()

    which is greater than zero.

    Since no sign change occurs between the lower

    () and the

    midpoint (), the root must be located between 14 and 16. Therefore, we create a new interval by redefining the lower ()

    to 14 and determining a revised root estimate

  • 7/25/2019 Numerical Sol Week02 (1)

    10/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(1) net.hs-eng,com.hs-eng

    .

    which represents a true percent error of .

    ()() () )) Therefore, the root is between 14 and 15. The upper () isredefined to 15, and the root estimate for the third iteration is

    calculated as:

    which represents a percent relative error of . The method can be repeated until the result is accurate enough to

    satisfy some standard error (). The following figure shows a graphical description of the bisection

    method for the first three iterations.

    ( )(iterations) ))( .)

    .

    5.3

  • 7/25/2019 Numerical Sol Week02 (1)

    11/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@() net.hs-eng,com.hs-eng

    .

    In the previous example the true error does not decrease with each

    iteration. However, the interval is halved with each step in the process.

    The interval width provides an exact estimate of the upper bound ofthe error for the bisection method.

    5.2.1 Termination Criteria and Error Estimates

    We must develop an objective criterion for deciding when to terminate

    the method. An initial suggestion might be that we end the calculation

    when the true error falls below some pre-specified level.

    For instance, in Example 5.3, the true percent relative error dropped from

    5.3% to 1.9% during the computation. We might decide that we should

    terminate when the percent error drops below, say, 0.1% percent.

    This strategy is not usefulbecause the error estimates in the example

    were based on knowledge of the true root of the function. This would

    not be the case in an actual situation. Therefore, we require an error

    estimate that does not depend on the knowledge of the root. An

    approximate percent relative error can be calculated as||

    ()

    where is the root for the present iteration and is the rootfrom the previous iteration.

    The absolute value is used because we are usually concerned with the

    magnitude of rather than its sign. When || becomes less than apre-specified stopping criterion , the computation terminates.

  • 7/25/2019 Numerical Sol Week02 (1)

    12/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(2) net.hs-eng,com.hs-eng

    .

    EXAMPLE 5.4 Error Estimates for Bisection

    Continue Example 5.3 until the approximate error falls below a stopping

    criterion of

    . Use the error approximate equation.

    Solution:

    The result of the first two iterations for

    example 5.3 were 14 and 15. Substituting

    these values into Eq.(5.2) yields

    Recall that the true percent relative true

    error for the root estimate of 15 was 1.5%.

    Therefore, is greater than . This behavioris clear for the other iterations:

    Iteration () ()1 12 16 14 - 5.279

    2 14 16 15 6.667 1.487

    3 14 15 14.5 3.448 1.896

    4 14.5 15 14.75 1.695 0.204

    5 14.75 15 14.875 0.840 0.641

    6 14.75 14.875 14.8125 0.422 0.219

    Thus, after six iterations and the computation can be terminated.( ( ) .)

    The plot shows that . thus, when falls below , thecomputation could be terminated with a confidence that the root is

    known to be at least as accurate as the pre-specified acceptable level.

    ( )

  • 7/25/2019 Numerical Sol Week02 (1)

    13/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(3) net.hs-eng,com.hs-eng

    -8

    -4

    0

    4

    8

    -1 0 1

    .

    EXAMPLE 5.2

    Determine the real root of() (a)

    Graphically.(b)Using bisection to locate the root, Employ initial guesses of

    and and iterate until the estimated error

    Solution

    (a)A plot indicates that a single real root occurs at about .(b)First iteration:

    () () () (

    )Therefore, the new bracket is and

    The process can be repeated until () falls below 10%. As summarizedbelow, this occurs after 5 iterations yielding a root estimate of 0.40625.

    iteration () () ()() 1 0 1 0.5 -2 0.375 -0.75

    2 0 0.5 0.25 -2 -0.73438 1.46875 100.00%

    3 0.25 0.5 0.375 -0.73438 -0.18945 0.13913 33.33%

    4 0.375 0.5 0.4375 -0.18945 0.08667 -0.01642 14.29%

    5 0.375 0.4375 0.40625 -0.18945 -0.05246 0.009939 7.69%

  • 7/25/2019 Numerical Sol Week02 (1)

    14/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(4) net.hs-eng,com.hs-eng

    -1.5

    -1

    -0.5

    0

    0.5

    0 0.5 1 1.5

    .

    Problem 5.5

    Locate the first non-zero root of sin ( ) , where is in radians.Use a graphical technique and bisection with the initial intervals from 0.5 to1. Perform the computation until is less than of = 2%. Also, perform anerror check by substituting your final answer into the original equation.

    Solution

    A graph indicates that a nontrivial root (nonzero) is located at about 0.93.

    Using bisection,

    () () () ()Therefore, the root is in the second interval and the lower guess is

    redefined as .All the iterations are displayed in the following table:

    () () () 1 0.5 0.354426 1 -0.158529 0.75 0.2597638

    2 0.75 0.259764 1 -0.158529 0.875 0.0976216 14.29%

    3 0.875 0.097622 1 -0.158529 0.9375 -0.0178935 6.67%

    4 0.875 0.097622 0.9375 -0.0178935 0.90625 0.0429034 3.45%

    5 0.90625 0.042903 0.9375 -0.0178935 0.921875 0.0132774 1.69%

    After five iterations we obtain a root estimate of 0.921875 with an

    approximate error of 1.69%, which is below the stopping criterion of 2%.

    The result can be checked

    () () ()

  • 7/25/2019 Numerical Sol Week02 (1)

    15/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(5) net.hs-eng,com.hs-eng

    5.3 The False-Position Method

    .

    Although bisection is a perfectly valid technique for determining

    roots, it's rate is relatively slow and inefficient.

    False position is an alternative based on graphical knowledge.

    A disadvantage of the bisection method is that, in dividing the

    interval from to into equal halves, no consider is taken of themagnitudes of()and().

    For example, if ()is much closer to zero than (), it is likelythat the root is closer to than to .

    The bisection method uses the graphical knowledge to join ()and()by a straight line. The intersection of this line with the x-axis represents an improved estimate of the root.

    The fact that the replacement of the curve by a straight line gives a

    "false position" of the root is the origin of its name.

  • 7/25/2019 Numerical Sol Week02 (1)

    16/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(6) net.hs-eng,com.hs-eng

    .

    Using similar triangles,

    ()

    ()

    ()

    Which can be solved for

    ()( ) () () () This is the false position formula. The value of computed with

    the previous equation then replaces one of the two initial guesses or , same as in bisection method.

    The process is repeated until the root is estimated adequately. The

    algorithm is identical to the one for bisection with the exception that

    the previous equation is used for step 2.

    The same stopping criterion is used to terminate the computation.

    ()( ) () ()

    (()() ) ( )

    ( ) ( ) ( ) ( )

    ( (.

    Summary for Bisection and False Position Methods

  • 7/25/2019 Numerical Sol Week02 (1)

    17/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(7) net.hs-eng,com.hs-eng

    .

    EXAMPLE 5.5 False Position

    Use the false position method to determine the root of the same

    equation in Example 5.1.

    Solution:

    Initiate the computation with guesses of and First iteration:

    () () ( )() which has a true relative error of 0.89percent.

    Second iteration:

    () ()

    Therefore, the root lies in the first subinterval, and becomes theupper limit for the next iteration, : ()

    ()

    ( ()

    which has a true and approximate relatives errors of 0.09 and

    0.79percent.

    Additional iterations can be performed to improve the estimate of roots.

  • 7/25/2019 Numerical Sol Week02 (1)

    18/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(8) net.hs-eng,com.hs-eng

    -8

    -4

    0

    4

    8

    0 0.5 1 1.5

    .

    EXAMPLE 5.3

    Determine the real root of

    () (a)Graphically.(b)Using bisection to determine the root to .

    Employ initial guesses of and .(c)Perform the same computation as in (b) but use the false-position

    method and

    .

    (a)A plot indicates that a single real root occurs at about .(b) Bisection:

    First iteration:

    ( ) ()() () The new bracket is and . The process is repeateduntil . This occurs after 4 iterations yielding a root estimate of0.59375.

    iteration () () () () 1 0.50000 1.00000 0.75000 -1.47813 2.07236 -3.06321

    2 0.50000 0.75000 0.62500 -1.47813 0.68199 -1.00807 20.00%

    3 0.50000 0.62500 0.56250 -1.47813 -0.28199 0.41682 11.11%

    4 0.56250 0.62500 0.59375 -0.28199 0.22645 -0.06386 5.26%

  • 7/25/2019 Numerical Sol Week02 (1)

    19/20

    June 2016

    ( ) ()HS Engineers

    .

    26044449hs.com-enginfo@(9) net.hs-eng,com.hs-eng

    .

    (c)False position:

    First iteration:

    ()

    () ( )

    () () () Therefore, the bracket is and .Second iteration: () () ( )

    The process can be repeated until the approximate error falls below

    0.2%. This occurs after 4 iterations yielding a root estimate of 0.57956.

    iteration () () () ()() 1 0.5 1.00000 -1.47813 3.70000 0.64273 0.91879 -1.35808 -

    2 0.5 0.64273 -1.47813 0.91879 0.58802 0.13729 -0.20293 9.304%

    3 0.5 0.58802 -1.47813 0.13729 0.58054 0.01822 -0.02693 1.289%

    4 0.5 0.58054 -1.47813 0.01822 0.57956 0.00238 -0.00351 0.169%

  • 7/25/2019 Numerical Sol Week02 (1)

    20/20

    June 2016

    .

    Problem 5.8

    Find the positive square root of 18 using the false-position method

    within

    . Employ initial guesses of

    and

    .

    Solution

    The square root of 18 can be set up as a roots' problem by determining

    the positive root of the function:

    ()

    Using false position, the first iteration is

    ( ) () () () Therefore, the root is in the second interval and the lower guess is

    redefined as . The second iteration is ( )

    Thus, the computation can be stopped after just two iterations because

    0.442% < 0.5%.