lecture 10 numerical integration trapezoidal.pptx

Upload: imranakhtar

Post on 01-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    1/27

    What is Integration

    =b

    a

    dx)x(fI

    Integration:

    1/30/15 Engineering Numerical Analysis 1

    The process of measuringthe area under a functionplotted on a graph.

    Where:

    f(x) is the integrand

    a lo!er limit ofintegration

    " upper limit ofintegration

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    2/27

    Basis of Trapezoidal Rule

    =

    b

    a dx)x(fI

    )x(f)x(f n

    Trape#oidal $ule is "ased on the Ne!ton%&otes 'ormulathat states if one can appro(imate the integrand as annthorder polynomial)

    1/30/15 Engineering Numerical Analysis *

    !here

    nn

    nnn xaxa...xaa)x(f ++++=

    1

    110

    and

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    3/27

    b

    a

    n

    b

    a

    )x(f)x(f

    Then the integral of that function is appro(imated "y theintegral of that nth order polynomial.

    1/30/15 Engineering Numerical Analysis 3

    Trape#oidal $ule assumes n1+ that is+ the area under thelinear polynomial+

    +=2

    )b(f)a(f)ab(b

    a

    dx)x(f

    Basis of Trapezoidal Rule

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    4/27

    Derivation of the Trapezoidal Rule

    1/30/15 Engineering Numerical Analysis ,

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    5/27

    Method Derived From Geometry

    1/30/15 Engineering Numerical Analysis 5

    The area under the cur-e is a trape#oid. The integral

    trapezoidofAreadxxf

    b

    a

    )(

    )height)(sidesparallelofSum(2

    1=

    ( ) )ab()a(f)b(f +=2

    1

    +=2

    )b(f)a(f)ab(

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    6/27

    E(ample 1The -ertical distance co-ered "y a rocet from t to t 30 seconds is gi-en "y:

    1/30/15 Engineering Numerical Analysis

    =

    30

    8

    892100140000

    1400002000 dtt.

    tlnx

    a 2se single segment Trape#oidal rule to nd the distanceco-ered.

    " 'ind the true error+ Etfor part 4a.c 'ind the a"solute relati-e true error+ 6a for part 4a.

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    7/27

    7olution

    1/30/15 Engineering Numerical Analysis 8

    +

    2

    )b(f)a(f)ab(Ia

    8=a 30=b

    t.t

    ln)t(f 892100140000

    1400002000

    =

    )(.)(ln)(f 88982100140000

    140000

    20008

    =

    )(.)(

    ln)(f 3089302100140000

    140000200030

    =

    s/m.27177=

    s/m.67901=

    +=

    2

    6790127177830

    ..)(I m11868=

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    8/27

    7olution 4cont

    1/30/15 Engineering Numerical Analysis

    "The e(act -alue of the a"o-e integral is

    =

    30

    8

    892100140000

    1400002000 dtt.

    tlnx m11061=

    ValueeApproximatValueTrueEt = 1186811061= m807=

    c The a"solute relati-e true error+ + !ould "et

    10011061

    1186811061

    =t %.29597=

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    9/27

    Multiple Segment Trapezoidal Rule

    1/30/15 Engineering Numerical Analysis 9

    n E(ample 1+ the true error using single segment trape#oidal rule

    !as large. We can di-ide the inter-al ;+30< into ;+19< and

    ;19+30< inter-als and apply Trape#oidal rule o-er each segment.

    t.t

    ln)t(f 892100140000

    1400002000

    =

    +=30

    19

    19

    8

    30

    8

    dt)t(fdt)t(fdt)t(f

    ++

    +=

    2

    30191930

    2

    198819

    )(f)(f)(

    )(f)(f)(

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    10/27

    =ultiple 7egment Trape#oidal $ule

    1/30/15 Engineering Numerical Analysis 10

    With

    s/m.)(f 271778 =

    s/m.)(f 7548419 =

    s/m.)(f 6790130 =

    ++

    += 2

    67.90175.484)1930(

    2

    75.48427.177)819()(

    30

    8

    dttf

    m11266=

    >ence:

    Multiple Segment Trapezoidal Rule

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    11/27

    =ultiple 7egment Trape#oidal $ule

    1/30/15 Engineering Numerical Analysis 11

    1126611061=tE

    m205=

    The true error is:

    The true error no! is reduced from %08 m to %*05m.

    E(tending this procedure to di-ide the inter-al intoe?ual segments to apply the Trape#oidal rule@ thesum of the results o"tained for each segment isthe appro(imate -alue of the integral.

    Multiple Segment Trapezoidal Rule

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    12/271/30/15 Engineering Numerical Analysis 1*

    Figure 4: Multiple (n=4) Segment Trapezoidal Rule

    i-ide into e?ualsegments as sho!n in'igure ,. Then the !idthof each segment is:

    nabh =

    The integral is:

    =b

    a

    dx)x(fI

    Multiple Segment Trapezoidal Rule

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    13/27

    +

    +

    +

    +

    +

    +

    ++++=b

    h)n(a

    h)n(a

    h)n(a

    ha

    ha

    ha

    a

    dx)x(fdx)x(f...dx)x(fdx)x(f1

    1

    2

    2

    1/30/15 Engineering Numerical Analysis 13

    The integralIcan "e "roen into

    hintegralsas:

    b

    a

    dx)x(f

    plying Trape#oidal rule on each segment gi-es:

    b

    adx)x(f

    +

    ++

    =

    = )b(f)iha(f)a(fn

    ab n

    i

    1

    122

    Multiple Segment Trapezoidal Rule

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    14/27

    E(ample *

    1/30/15 Engineering Numerical Analysis 1,

    The -ertical distance co-ered "ya rocet from toseconds is gi-en "y:

    =30

    8

    892100140000

    1400002000 dtt.t

    lnx

    a 2se t!o%segment Trape#oidal rule to nd the distance

    co-ered." 'ind the true error+ for part 4a.c 'ind the a"solute relati-e true error+ for part 4a.

    atE

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    15/27

    7olution

    1/30/15 Engineering Numerical Analysis 15

    a The solution using *%segment Trape#oidal rule is

    +

    ++

    =

    = )b(f)iha(f)a(fn

    ab

    I

    n

    i

    1

    122

    2=n 8=a 30=b

    2

    830 =

    n

    abh

    = 11=

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    16/27

    7olution 4cont

    1/30/15 Engineering Numerical Analysis 1

    +

    ++

    =

    =)(f)iha(f)(f

    )(I

    i

    302822

    830 12

    1

    [ ])(f)(f)(f 3019284

    22++=

    [ ]67901754842271774

    22

    .).(. ++=

    m11266=

    Then:

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    17/27

    7olution 4cont

    1/30/15 Engineering Numerical Analysis 18

    =30

    8

    892100140000

    1400002000 dtt.t

    lnx m11061=

    " The e(act -alue of the a"o-e integral is

    so the true error is

    ValueeApproximatValueTrueEt =

    1126611061=

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    18/27

    7olution 4cont

    1/30/15 Engineering Numerical Analysis 1

    The a"solute relati-e true error+ + !ould "et

    100ValueTrue

    ErrorTrue =t

    10011061

    1126611061

    =

    %8534.1=

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    19/27

    7olution 4cont

    1/30/15 Engineering Numerical Analysis 19

    Ta"le 1 gi-es the -alues o"tained using multiple segment Trape#oidalrule for:

    n Value Et

    1 11 %08 8.*9 %%%* 11* %*05 1.53 5.3,3

    3 11153 %91., 0.*5 1.019

    , 11113 %51.5 0.,55 0.359,

    5 1109, %33.0 0.*91 0.19

    110, %**.9 0.*080 0.090*

    8 1108 %1. 0.15*1 0.05,*

    1108, %1*.9 0.115 0.0350

    =

    30

    8

    892100140000

    1400002000 dtt.

    tlnx

    Table 1: Multiple Segment Trapezoidal RuleValues

    %t %a

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    20/27

    E(ample 3

    1/30/15 Engineering Numerical Analysis *0

    2se =ultiple 7egment Trape#oidal$ule to nd the area under the cur-e

    xe

    x)x(f += 1

    300from to0=x 10=x

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    21/27

    Solution

    1/30/15 Engineering Numerical Analysis *1

    +

    ++

    =

    =)b(f)iha(f)a(f

    n

    abI

    n

    i

    1

    1

    22

    +

    ++

    =

    =)(f)(f)(f

    )( i105020

    22

    010 12

    1

    [ ])(f)(f)(f 105204

    10++= [ ]13600391020

    4

    10.).( ++= 53550.=

    Then:

    sing t!o segments+ !e get 52

    010=

    =h

    01

    03000

    0 =

    +=

    e

    )()(f 03910

    1

    53005

    5 .

    e

    )()(f =

    += 1360

    1

    1030010

    10 .

    e

    )()(f =

    +=

    and

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    22/27

    1/30/15 Engineering Numerical Analysis **

    7o !hat is the true -alue of this integralB

    592461

    30010

    0.dxe

    xx =+

    =aing the a"solute relati-e true error:

    %.

    ..t 10059246

    5355059246 =

    %.50679=

    Solution (ont!"

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    23/27

    1/30/15 Engineering Numerical Analysis *3

    n Appro(imateCalue

    1 0.1 *,5.91 99.8*,D

    * 50.535 19.05 89.505D

    , 180.1 85.98 30.1*D **8.0, 19.5, 8.9*8D

    1 *,1.80 ,.8 1.9*D

    3* *,5.38 1.*** 0.,95D

    , *,.* 0.305 0.1*,D

    Table : Calues o"tained using =ultiple 7egment

    Trape#oidal $ule for: +

    10

    01

    300dx

    e

    xx

    tE t

    Solution (ont!"

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    24/27

    #rror in Multiple Segment Trapezoidal Rule

    1/30/15 Engineering Numerical Analysis *,

    true error for a single segment Trape#oidal rule is gi-en "y:

    ba),(f)ab(

    Et

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    25/27

    1/30/15 Engineering Numerical Analysis *5

    7imilarly:

    [ ] ihah)i(a),(f)h)i(a()iha(

    E iii +

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    26/27

    1/30/15 Engineering Numerical Analysis *

    nce the total error in multiple segment Trape#oidal rule is

    =

    =n

    iit EE

    1=

    =n

    ii )(f

    h

    1

    3

    12 n

    )(f

    n

    )ab(

    n

    ii

    =

    = 1

    2

    3

    12

    The termn

    )(fn

    i i=

    1 is an appro(imate a-erage -alue of the bxa),x(f ence:

    n

    )(f

    n

    )ab(

    E

    n

    ii

    t

    =

    = 1

    2

    3

    12

    #rror in Multiple Segment Trapezoidal Rule

  • 8/9/2019 Lecture 10 Numerical Integration Trapezoidal.pptx

    27/27

    1/30/15 Engineering Numerical Analysis *8

    elo! is the ta"le for theintegral

    30

    8

    892100140000

    1400002000 dtt.t

    ln

    as a function of the num"er of segments. Fou can -isuali#e that asthe num"er of segments are dou"led+ the true error gets

    appro(imately ?uartered.

    tE %t %an Value

    * 11* %*05 1.5, 5.3,3

    , 11113 %51.5 0.,55 0.359, 1108, %1*.9 0.115 0.035

    0

    1 1105 %3.** 0.0*913 0.00,01

    #rror in Multiple Segment Trapezoidal Rule