010.141 NUMERICAL METHODS IN GENERAL MODULE 5 · 2018. 1. 30. · 2010 Engineering Mathematics II...

38
ENGINEERING MATHEMATICS II 010.141 NUMERICAL METHODS IN GENERAL MODULE 5

Transcript of 010.141 NUMERICAL METHODS IN GENERAL MODULE 5 · 2018. 1. 30. · 2010 Engineering Mathematics II...

  • ENGINEERING MATHEMATICS II

    010.141

    NUMERICAL METHODSIN

    GENERAL

    MODULE 5

  • 2B.D. Youn2010 Engineering Mathematics II Module 5

    NUMERICAL METHODS

    Ø Methods for solving problems numerically on a computer

    Ø Steps: • Modeling, • Choice of a numerical method, Programming, • Doing the computation, • Interpreting the results

    Ø Solution of equations by iteration

    Ø Interpolation

    Ø Numerical integration and differentiation

  • 3B.D. Youn2010 Engineering Mathematics II Module 5

    Nonlinear Equations in Engineering Fields

    f(x) = wn (x) - w = 0x: bridge design variables

    To design a safe bridge , a natural frequency must be higher than that of an external loading.

    f(x) = T (x) - T* = 0x: battery design variables

    To design a safe battery, a temperature level must be smaller than a marginal temperature.

    f(x) = s (x) - S = 0x: bridge gusset plate

    To design a safe bridge, a stress level at a critical bridge element must be smaller than its strength.

  • 4B.D. Youn2010 Engineering Mathematics II Module 5

    SOLUTION OF EQUATIONS BY ITERATION

    Ø Solving equation f(x) = 0Ø Methods:

    • Fixed – Point Iteration• Newton's Method• Secant Method

  • 5B.D. Youn2010 Engineering Mathematics II Module 5

    FIXED-POINT ITERATION FOR SOLVING f(x) = 0

    Ø Idea: transform f(x) = 0 into x = g(x)

    Ø Steps:1. Choose x02. Compute x1 = g(x0), x2 = g(x1), ¼, xn+1 = g(xn)

    Ø A solution of x = g(x) is called a fixed point

    Ø Depending on the initial value chosen (x0), the related sequences may converge or diverge

  • 6B.D. Youn2010 Engineering Mathematics II Module 5

    FIXED-POINT ITERATION FOR SOLVING f(x) = 0

    Ø Example: f(x) = x2 – 3x + 1 = 0

    îíì=

    381966.0618034.2

    Solutions

  • 7B.D. Youn2010 Engineering Mathematics II Module 5

    FIXED-POINT ITERATION FOR SOLVING f(x) = 0

  • 8B.D. Youn2010 Engineering Mathematics II Module 5

    NEWTON'S METHOD FOR SOLVING f(x) = 0

    Ø f must have a continuous derivative f 'Ø The method is simple and fast

    ( ) ( )

    ( )( )0

    001

    10

    00

    x'fxfxx

    xxxfx'ftan

    -=

    ß

    -==b

  • 9B.D. Youn2010 Engineering Mathematics II Module 5

    NEWTON'S METHOD FOR SOLVING f(x) = 0

    ( )( )

    ( )( )n

    nn1n

    1

    112

    x'fxfxx

    x'fxfxx

    -=

    -=

    +

    M

  • 10B.D. Youn2010 Engineering Mathematics II Module 5

    NEWTON'S METHOD FOR SOLVING f(x) = 0

    Example: Find the positive solution of f(x) = 2 sin x – x = 0

  • 11B.D. Youn2010 Engineering Mathematics II Module 5

    SECANT METHOD FOR SOLVING f(x) = 0

    Newton’s method is powerful but disadvantageous because it is difficult to obtain f '. The secant method approximates f '.

  • 12B.D. Youn2010 Engineering Mathematics II Module 5

    SECANT METHOD FOR SOLVING f(x) = 0

    Ø Newton's Method

    Ø Secant

  • 13B.D. Youn2010 Engineering Mathematics II Module 5

    SECANT METHOD FOR SOLVING f(x) = 0

  • 14B.D. Youn2010 Engineering Mathematics II Module 5

    진정성이 마음을 움직인다.

    송나라범관, 계산행려도

  • 15B.D. Youn2010 Engineering Mathematics II Module 5

    INTERPOLATION

    Ø Function f(x) is unknownØ Some values of f(x) are known (f1, f2, ¼, fn)Ø Idea: Find a polynomial pn(x) that is an approximation of f(x)

    ( ) ( ) ( ) nnn11n00n fxp ,,fxp,fxp === L

    Ø Lagrange interpolation• Linear• Quadratic• General

    Ø Newton's interpolation• Divided difference• Forward difference• Backward difference

    Ø Splines

  • 16B.D. Youn2010 Engineering Mathematics II Module 5

    LINEAR LAGRANGE INTERPOLATION

    Ø Use 2 known values of f(x) ® f0, f1

    p1 is the linear Lagrange polynomial.

  • 17B.D. Youn2010 Engineering Mathematics II Module 5

    LINEAR LAGRANGE INTERPOLATION

    Ø p1(x) = L0(x)f0 + L1(x)f1Ø L0 and L1are linear polynomials (weight functions).

    ( ) ( )ïî

    ïíì

    =

    ==

    ïî

    ïíì

    =

    ==

    1

    01

    1

    00

    x x if 1

    x x if 0xL

    x x if 0

    x x if 1xL

    ( ) ( )01

    01

    10

    10 xx

    x ,xx

    x--

    =--

    =xxLxxL

    ( ) 101

    00

    10

    11 xx

    xxx

    x fxfxxp--

    +--

    =

  • 18B.D. Youn2010 Engineering Mathematics II Module 5

    LINEAR LAGRANGE INTERPOLATION

    Example: Compute ln 9.2 from ln 9.0 = 2.1972 and ln 9.5 = 2.2513 by linear Lagrange interpolation

    Solution:

    ( ) ( )

    ( )( ) ( )( ) ( )

    ( ) 0004.02188.22192.22.9p-2.9ln :Error2188.2

    2513.24.01972.26.0

    f2.9Lf2.9L

    2.9p2.9ln

    4.00.95.90.92.92.9L 6.0

    5.90.95.92.92.9L

    5.9lnf ,0.9lnf ,5.9x ,0.9x

    1

    1100

    1

    10

    1010

    =-=

    =

    +=

    +=

    »

    =--

    ==--

    =

    ====

  • 19B.D. Youn2010 Engineering Mathematics II Module 5

    QUADRATIC LAGRANGE INTERPOLATION

    Ø Use of 3 known values of f(x) ® f0, f1, f2Ø Approximation of f(x) by a second-degree polynomial

    ( ) ( ) ( ) ( )( )( )( )( )( )( )( )( )( )( )( )( )1202

    102

    2101

    201

    2010

    210

    2211002

    xxxxxxxxL

    xxxxxxxxL

    xxxxxxxxL

    fxLfxLfxLxp

    ----

    =

    ----

    =

    ----

    =

    ++=

  • 20B.D. Youn2010 Engineering Mathematics II Module 5

    QUADRATIC LAGRANGE INTERPOLATION

    Example: Compute ln 9.2 for f0 (x0 = 9.0) = ln 9.0, f1 (x1 = 9.5) = ln 9.5, f2 (x2 = 11.0) = ln 11.0

    Solution:

    ( )

    ( ) ( )

    ( ) ( )

    ( ) 2192.22.92.9ln

    5.855.1831

    992075.01

    5.1045.20

    2

    22

    21

    20

    +-=

    +--=

    +-=

    p

    xxxL

    xxxL

    xxxL

  • 21B.D. Youn2010 Engineering Mathematics II Module 5

    GENERAL LAGRANGE INTERPOLATION

    ( ) ( ) ( )

    ( )( )

    ( ) ( ) ( )( ) ( )nkk

    k

    n

    k

    n

    kn

    xxxxxxxxxl

    fxlxl

    fxxpxf

    ----=

    =

    +-

    =

    =

    å

    å

    LL 110k

    0 k k

    k

    0 k k

    L

  • 22B.D. Youn2010 Engineering Mathematics II Module 5

    NEWTON'S INTERPOLATION

    Ø More appropiate for computation

    Ø Level of accuracy can be easily improved by adding new terms that increase the degree of the polynomial

    Ø Divided difference

    Ø Forward difference

    Ø Backward difference

  • 23B.D. Youn2010 Engineering Mathematics II Module 5

    Is High-Order Polynomial a Good Idea?

    f(x) = 1/(1+25x^2)

  • 24B.D. Youn2010 Engineering Mathematics II Module 5

    Ø Method of interpolation used to avoid numerical instability

    Ø Idea: given an interval [a, b] where the high-degree polynomial can oscillate considerable, we subdivide [a, b] in several smaller intervals and use several low-degree polynomials (which cannot oscillate much)

    SPLINES

  • 25B.D. Youn2010 Engineering Mathematics II Module 5

    SPLINES (cont)

    Ø In an interval x Î [xj, xj+1], j = 0 , ¼, n – 1

    where

    ( ) ( ) ( ) ( )3jj2jjjjjj xxaxxaxxaaxp 3210 -+-+-+=

    ( ) ( )

    ( ) ( )jjjjj

    jjjjjjj

    jjjj

    jjjj

    kkh

    ffh

    a

    kkh

    ffh

    xpa

    kxpa

    fxpa

    ++-=

    +--=¢¢=

    =¢=

    ==

    ++

    ++

    12133

    1122

    1

    0

    12

    213)(21

    )(

    )(

  • 26B.D. Youn2010 Engineering Mathematics II Module 5

    SPLINES (cont)

    Ø Let (x0,f0), (x1,f1), … , (xn,fn).Ø k0, kn are two given numbers.Ø k1, k2, ¼, kn-1 are determined by a linear system of n-1

    equations:

    Ø h is the distance between nodesxn = x0 + nh

    ( )( ) ( ) ( )1-n , 1, 0,j 1','

    34

    1

    1111

    K==+=

    -=++

    +

    -++-

    jjjjjj

    jjjjj

    kxpkxp

    ffh

    kkk

  • 27B.D. Youn2010 Engineering Mathematics II Module 5

    SPLINES (cont)

    Ø Clamped conditionsg'(x0) = f'(x0), g'(xn) = f'(xn)

    Ø Free/natural conditionsg"(x0) = 0, g"(xn) = 0

    Ø Example:Interpolate f(x) = x4 on interval x Î [-1, 1] by cubic spline in partitions x0 = -1, x1 = 0, x2 = 1, satisfying clamped conditions

    g'(-1) = f'(-1), g'(1) = f'(1)

  • 28B.D. Youn2010 Engineering Mathematics II Module 5

    SPLINES (cont)

  • 29B.D. Youn2010 Engineering Mathematics II Module 5

    SPLINES (cont)

  • 30B.D. Youn2010 Engineering Mathematics II Module 5

    NUMERICAL INTEGRATION

    Ø Numerical evaluation of integrals whose analytical evaluation is toocomplicated or impossible, or that are given by recorded numerical values

    Ø Rectangular ruleØ Trapezoidal ruleØ Simpson's ruleØ Gauss integration

    ( )òb

    a

    dxxf

  • 31B.D. Youn2010 Engineering Mathematics II Module 5

    RECTANGULAR RULE

    Ø Approximation by n rectangular areas

    where

    hxx

    nabh

    01 +=

    -=

    ( ) ( ) ( ) ( )[ ]nb

    a

    xfxfxfhdxxfJ *** 21 +++»= ò L

  • 32B.D. Youn2010 Engineering Mathematics II Module 5

    TRAPEZOIDAL RULE

    Ø Approximation by n trapezoidal areas

    ( ) ( ) ( ) ( ) ( ) ( )úûù

    êëé +++++»= -ò bfxfxfxfafhdxxfJ n

    b

    a 21

    21

    121 L

  • 33B.D. Youn2010 Engineering Mathematics II Module 5

    TRAPEZOIDAL RULE

  • 34B.D. Youn2010 Engineering Mathematics II Module 5

    SIMPSON'S RULE

    Ø Approximation by parabolas using Lagrange polynomials p2(x)Ø Interval of integration [a, b] divided into an even number of subintervals

    ( )

    ( ) ( )

    ( )jj

    mmm

    b

    a

    xff

    fffffffhdxxf

    hxhaxfmabh

    =

    +++++++»

    +=+==-

    =

    --ò 212223210

    12100

    424243

    x xf 2

    L

  • 35B.D. Youn2010 Engineering Mathematics II Module 5

    SIMPSON'S RULE

  • 36B.D. Youn2010 Engineering Mathematics II Module 5

    SIMPSON'S RULE

  • 37B.D. Youn2010 Engineering Mathematics II Module 5

    ADAPTIVE INTEGRATION

  • 38B.D. Youn2010 Engineering Mathematics II Module 5

    GAUSS INTEGRATION

    where

    ( ) ( ) åòò¥

    =-

    »=1 j

    jj

    1

    1

    b

    a

    fAdttfdxxf

    ( ) ( )[ ]

    ( )jjn1

    tfftscoefficien A , ,A

    1tb1-ta21x

    ++=

    K