mws gen dif ppt discrete

21
1/10/2010 http://numericalmethods.eng.usf.edu 1 Differentiation-Discrete Functions Major: All Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates

Upload: erianto-boyss

Post on 28-Sep-2015

243 views

Category:

Documents


2 download

DESCRIPTION

Rekayasa Komputer

TRANSCRIPT

  • 1/10/2010 http://numericalmethods.eng.usf.edu 1

    Differentiation-Discrete Functions

    Major: All Engineering Majors

    Authors: Autar Kaw, Sri Harsha Garapati

    http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM

    Undergraduates

  • Differentiation Discrete Functions

    http://numericalmethods.eng.usf.edu

  • http://numericalmethods.eng.usf.edu3

    Forward Difference Approximation

    ( ) ( ) ( )x

    xfxxfx

    xf

    0lim +

    =

    For a finite '' x

    ( ) ( ) ( )x

    xfxxfxf

    +

  • http://numericalmethods.eng.usf.edu4

    x x+x

    f(x)

    Figure 1 Graphical Representation of forward difference approximation of first derivative.

    Graphical Representation Of Forward Difference

    Approximation

  • http://numericalmethods.eng.usf.edu5

    Example 1

    The upward velocity of a rocket is given as a function of time in Table 1.

    Using forward divided difference, find the acceleration of the rocket at .

    t v(t)s m/s0 010 227.0415 362.7820 517.35

    22.5 602.9730 901.67

    Table 1 Velocity as a function of time

    s 16=t

  • http://numericalmethods.eng.usf.edu6

    Example 1 Cont.

    ( ) ( ) ( )t

    ttta iii

    + 1

    15=it

    51520

    1

    === + ii ttt

    To find the acceleration at , we need to choose the two values closest to , that also bracket to evaluate it. The two points are and .

    s16=ts16=t

    s20=ts15=t

    201 =+it

    s16=t

    Solution

  • http://numericalmethods.eng.usf.edu7

    Example 1 Cont.

    ( ) ( ) ( )

    2m/s 914.305

    78.36235.5175

    152016

    a

  • http://numericalmethods.eng.usf.edu8

    Direct Fit Polynomials

    '1' +n ( ) ( ) ( ) ( )nn yxyxyxyx ,,,,,,,, 221100 thn

    ( ) nnnnn xaxaxaaxP ++++= 1110

    ( ) ( ) 12121 12)(

    ++++==n

    nn

    nn

    n xnaxanxaadxxdPxP

    In this method, given data points

    one can fit a order polynomial given by

    To find the first derivative,

    Similarly other derivatives can be found.

  • http://numericalmethods.eng.usf.edu9

    Example 2-Direct Fit Polynomials

    The upward velocity of a rocket is given as a function of time in Table 2.

    Using the third order polynomial interpolant for velocity, find the acceleration of the rocket at .

    t v(t)s m/s0 010 227.0415 362.7820 517.35

    22.5 602.9730 901.67

    Table 2 Velocity as a function of time

    s 16=t

  • http://numericalmethods.eng.usf.edu10

    Example 2-Direct Fit Polynomials cont.

    For the third order polynomial (also called cubic interpolation), we choose the velocity given by

    ( ) 332210 tatataatv +++=Since we want to find the velocity at , and we are using third order polynomial, we need

    to choose the four points closest to and that also bracket to evaluate it.

    The four points are

    ( ) 04.227,10 == oo tvt

    ( ) 78.362,15 11 == tvt( ) 35.517,20 22 == tvt( ) 97.602,5.22 33 == tvt

    Solution

    s 16=ts 16=t s 16=t

    .5.22 and ,20 ,15 ,10 321 ==== tttto

  • http://numericalmethods.eng.usf.edu11

    Example 2-Direct Fit Polynomials cont.such that

    Writing the four equations in matrix form, we have

    ( ) ( ) ( ) ( )332210 10101004.22710 aaaav +++==( ) ( ) ( ) ( )332210 15151578.36215 aaaav +++==

    ( ) ( ) ( ) ( )332210 20202035.51720 aaaav +++==( ) ( ) ( ) ( )332210 5.225.225.2297.6025.22 aaaav +++==

    =

    97.60235.51778.36204.227

    1139125.5065.221800040020133752251511000100101

    3

    2

    1

    0

    aaaa

  • http://numericalmethods.eng.usf.edu12

    Example 2-Direct Fit Polynomials cont.

    Solving the above four equations gives

    3810.40 =a

    289.211 =a13065.02 =a0054606.03 =a

    Hence

    ( )5.2210,0054606.013065.0289.213810.4 32

    33

    2210

    +++=

    +++=

    tttttatataatv

  • http://numericalmethods.eng.usf.edu13

    Example 2-Direct Fit Polynomials cont.

    Figure 1 Graph of upward velocity of the rocket vs. time.

  • http://numericalmethods.eng.usf.edu14

    Example 2-Direct Fit Polynomials cont.

    ,

    The acceleration at t=16 is given by

    ( ) ( )16

    16=

    =t

    tvdtda

    Given that

    ( ) 5.2210,0054606.013065.0289.213810.4 32 +++= ttttt

    ( ) ( )tvdtdta =

    ( )32 0054606.013065.0289.213810.4 tttdtd

    +++=

    5.2210,016382.026130.0289.21 2 ++= ttt

    ( ) ( ) ( )216016382.01626130.0289.2116 ++=a2m/s664.29=

  • http://numericalmethods.eng.usf.edu15

    Lagrange Polynomial( ) ( )nn yxyx ,,,, 11 ( )thn 1In this method, given , one can fit a order Lagrangian polynomial

    given by

    =

    =n

    iiin xfxLxf

    0)()()(

    where n in )(xfn stands for the thn order polynomial that approximates the function )(xfy = given at )1( +n data points as ( ) ( ) ( ) ( )nnnn yxyxyxyx ,,,,......,,,, 111100 , and

    =

    =

    n

    ijj ji

    ji xx

    xxxL

    0

    )(

    )(xLi a weighting function that includes a product of )1( n terms with terms of

    ij = omitted.

  • http://numericalmethods.eng.usf.edu16

    Then to find the first derivative, one can differentiate ( )xfnfor other derivatives.

    For example, the second order Lagrange polynomial passing through

    ( ) ( ) ( )221100 ,,,,, yxyxyx is

    ( ) ( )( )( )( )( ) ( )( )( )( )

    ( ) ( )( )( )( )( )2

    1202

    101

    2101

    200

    2010

    212 xfxxxx

    xxxxxfxxxx

    xxxxxfxxxx

    xxxxxf

    +

    +

    =

    Differentiating equation (2) gives

    once, and so on

    Lagrange Polynomial Cont.

  • http://numericalmethods.eng.usf.edu17

    ( ) ( )( ) ( ) ( )( ) ( ) ( )( ) ( )2120212101020102222 xf

    xxxxxf

    xxxxxf

    xxxxxf

    +

    +

    =

    ( ) ( )( )( ) ( )( )

    ( )( ) ( )( )

    ( )( ) ( )2120210

    12101

    200

    2010

    212

    222 xfxxxx

    xxxxfxxxx

    xxxxfxxxx

    xxxxf

    ++

    +

    +

    +=

    Differentiating again would give the second derivative as

    Lagrange Polynomial Cont.

  • http://numericalmethods.eng.usf.edu18

    Example 3

    Determine the value of the acceleration at using the second order Lagrangian polynomial interpolation for velocity.

    t v(t)s m/s0 010 227.0415 362.7820 517.35

    22.5 602.9730 901.67

    Table 3 Velocity as a function of time

    s 16=t

    The upward velocity of a rocket is given as a function of time in Table 3.

  • http://numericalmethods.eng.usf.edu19

    Solution

    Example 3 Cont.

    )()()()( 212

    1

    02

    01

    21

    2

    01

    00

    20

    2

    10

    1 tvtttt

    tttttv

    tttt

    tttttv

    tttt

    tttttv

    +

    +

    =

    ( ) ( )( )( ) ( )02010212 ttttt

    tttta

    +=

    ( )( )( ) ( )12101

    202 ttttt

    ttt

    +

    + ( )( )( ) ( )21202

    102 ttttt

    ttt

    ++

    ( ) ( ) ( )( )( ) ( )04.22720101510201516216

    +

    =a ( ) ( )( )( ) ( )78.362201510152010162

    +

    +( ) ( )

    ( )( ) ( )35.517152010201510162+

    +

    ( ) ( ) ( )35.51714.078.36208.004.22706.0 +=2m/s784.29=

  • Additional ResourcesFor all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit

    http://numericalmethods.eng.usf.edu/topics/discrete_02dif.html

  • THE END

    http://numericalmethods.eng.usf.edu

    Differentiation-Discrete FunctionsDifferentiation Discrete Functions http://numericalmethods.eng.usf.eduForward Difference ApproximationSlide Number 4Slide Number 5Example 1 Cont.Example 1 Cont.Direct Fit PolynomialsExample 2-Direct Fit PolynomialsExample 2-Direct Fit Polynomials cont.Example 2-Direct Fit Polynomials cont.Example 2-Direct Fit Polynomials cont.Example 2-Direct Fit Polynomials cont.Example 2-Direct Fit Polynomials cont.Lagrange PolynomialSlide Number 16Slide Number 17Example 3Slide Number 19Additional ResourcesSlide Number 21