Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

Embed Size (px)

Citation preview

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    1/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University

    Chapter 6 1

    Chapter 6

    Open Methods

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    2/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University

    Chapter 6 2

    Open methods are based on formulas that require onlya single starting value of x or two starting values that

    do not necessarily bracket the root.

    Figure 6.1

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    3/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University

    Chapter 6 3

    Simple Fixed-point Iteration

    ...2,1,k,given)()(0)(

    1 !!!!

    okk xxgxxxgxf

    Bracketing methods are convergent.

    Fixed-point methods may sometime

    diverge, depending on the starting point

    (initial guess) and how the function behaves.

    Rearrange the function so that x is on the

    left side of the equation:

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    4/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University

    Chapter 6 4

    /

    xxg

    or

    xxg

    or

    xxg

    xxxxf

    21)(

    2)(

    2)(

    02)(

    2

    2

    !

    !

    !

    "!

    Example:

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    5/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University

    Chapter 6 5

    Convergence

    x=g(x) can be expressedas a pair of equations:

    y1=xy2=g(x) (componentequations)

    Plot them separately.

    The root is the x-valueoccurring at theintersection

    Figure 6.2

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    6/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University

    Chapter 6 6

    Conclusion

    Fixed-point iteration converges if

    x)f(x)linetheof(slope1)( !dxg

    When the method converges, the error is

    roughly proportional to or less than the error of

    the previous step, therefore it is called linearlyconvergent.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    7/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 7

    Newton-Raphson Method

    Most widely used method.

    Based on Taylor series expansion:

    )(

    )(

    )(0

    g,Rearrangin

    0)f(xwhenxofvaluetheisrootThe

    !2)()()()(

    1

    1

    1i1i

    3

    2

    1

    i

    i

    ii

    iiii

    iiii

    xf

    xfxx

    xx)(xf)f(x

    xOxxfxxfxfxf

    d!

    d!

    !

    ((dd(d!

    Newton-Raphson formula

    Solve for

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    8/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 8

    A convenient method forfunctions whose

    derivatives can be

    evaluated analytically. It

    may not be convenientfor functions whose

    derivatives cannot be

    evaluated analytically.

    Fig. 6.5

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    9/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 9

    Fig. 6.6

    Deficiencies

    (a) Points of inflection

    local max or mins

    f(x)=0(b) Zero or near zero slope

    (c) Multiple roots and

    near zero slope

    (d) Zero slope

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    10/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    Chapter 6 10

    Summary of the Newton-Raphson

    Requires: 1 initial guess sufficiently close

    to the root and explicit representation of

    the functions derivative.

    Advantage: Quadratic rate of

    convergence as the root is approached.

    Problems: multiple roots, points of

    inflection, zero or near zero slope, not

    guaranteed convergence.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    11/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 11

    The Secant Method

    A slight variation ofNewtons method forfunctions whose derivatives are difficult toevaluate. For these cases the derivative can beapproximated by a backward finite divideddifference.

    -,3,2,1)()(

    )(

    )()(

    )(

    1

    11

    1

    1

    !

    !

    $d

    ixfxf

    xxxfxx

    xfxf

    xxxf

    ii

    ii

    iii

    ii

    ii

    i

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    12/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 12

    Requires two initial

    estimates of x , e.g, xo,

    x1. However, becausefix) is not required to

    change signs between

    estimates, it is not

    classified as a

    bracketing method.

    The scant method has the

    same properties as

    Newtons method.

    Convergence is not

    guaranteed for all xo,

    fix).

    Fig. 6.7

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    13/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 13

    Fig. 6.8

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    14/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    Chapter 6 14

    Modified Secant Method

    Employs a fractional factor,H to estimate the

    derivative.

    IfHis too small, swamped with round-off error.

    IfHis too large, inefficient or divergent

    )()(

    )(1

    iii

    iiiixfxxf

    xfxxx

    !

    H

    H

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    15/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    Chapter 6 15

    Summary of the Secant Method

    Requires: 2 initial guesses

    Advantage: Similar to Newton-Raphson

    except the derivative is replaces with afinite divided difference.

    Problems: not guaranteed convergence.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    16/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    Chapter 6 16

    )1)(1)(3(375)( 23 !! xxxxxxxf

    Fig. 6.10

    Multiple Roots

    Graphically the curve touchesthe x-axis tangentially at the

    double root.(fig.a)

    (fig.c))1)(1)(1)(1)(3()(

    (fig.b))1)(1)(1)(3()(

    !

    !

    xxxxxxf

    xxxxxf

    Difficulties: (1) no sign change, must use

    open methods that may diverge.

    (2) f(x) & f(x) goes to 0 at the root(3) both Secant and Newton-Raphson

    methods are linearly convergent for

    multiple roots.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    17/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 17

    Multiple Roots

    None of the methods deal with multiple roots

    efficiently, however, one way to deal with

    problems is as follows:

    )(

    )(indThen

    )(

    )()(Set

    1

    i

    i

    ii

    i

    i

    i

    xu

    xuxx

    xf

    xfxu

    d

    !

    d!

    This function has

    roots at all the same

    locations as the

    original function

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    18/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 18

    Modified Newton-Raphson

    Differentiate u(x) using the chain rule

    Modified

    NewtonRaphson

    Preferable for multiple roots but less efficient.

    )('')())('(

    )(')(

    simpli yandsubstitute

    ))('(

    )('')()(')(')('

    21

    2

    iii

    ii

    iixfxfxf

    xfxfxx

    xf

    xfxfxfxfxu

    !

    !

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    19/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 19

    Modified Secant Method

    )()())((

    yieldoequation tSecantintosub)('

    )(

    similarly,

    1

    11

    ii

    iii

    iixuxuxxxuxx

    xf

    xfu(x)

    !

    !

    Modified Secant

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    20/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 20

    Multiple root corresponds to a point where a

    function is tangent to the x axis.

    Difficulties

    Function does not change sign at the multiple root,

    therefore, cannot use bracketing methods.Both f(x) and f(x)=0, division by zero with

    Newtons and Secant methods.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    21/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 21

    Systems ofNon-LinearEquations

    0),,,,(

    0),,,,(

    0),,,,(

    321

    3212

    3211

    !

    !

    !

    nn

    n

    n

    xxxxf

    xxxxf

    xxxxf

    -

    /

    -

    -

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    22/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 22

    Newton Raphson for Nonlinear

    Equations

    Taylor series expansion of a function of more

    than one variable

    )()(

    )()(

    11111

    11111

    ii

    i

    ii

    i

    ii

    iii

    ii

    iii

    yy

    y

    vxx

    x

    vvv

    yyyuxx

    xuuu

    x

    x

    x

    x!

    xx

    xx!

    The root of the equation occurs at the value of x

    and y where ui+1 and vi+1 equal to zero.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    23/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 23

    y

    vy

    x

    vxvy

    y

    vx

    x

    v

    y

    uy

    x

    uxuy

    y

    ux

    x

    u

    i

    i

    i

    iii

    i

    i

    i

    i

    i

    i

    iii

    i

    i

    i

    x

    x

    x

    x!

    x

    x

    x

    x

    x

    x

    x

    x!

    x

    x

    x

    x

    11

    11

    A set of two linear equations with two

    unknowns that can be solved for.

  • 8/9/2019 Chap 06 of Numerical Methods for Engineers by Chapra and Canale2

    24/24

    Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

    by Lale Yurttas, TexasA&M University Chapter 6 24

    x

    v

    y

    u

    y

    v

    x

    uxuv

    xvu

    yy

    x

    v

    y

    u

    y

    v

    x

    uy

    uv

    y

    vu

    xx

    iiii

    ii

    ii

    ii

    iiii

    i

    i

    i

    i

    ii

    x

    x

    x

    x

    x

    x

    x

    x

    x

    x

    x

    x

    !

    x

    x

    x

    x

    x

    x

    x

    x

    x

    x

    x

    x

    !

    1

    1

    Employing Cramers Rule

    Problem:

    Diverges if initial guesses are not sufficiently

    close to the true root.