Lec 6BUE

Embed Size (px)

Citation preview

  • 8/14/2019 Lec 6BUE

    1/21

    Week Date Topic Classification of Topic

    1 9 Feb. 2010 Introduction toNumerical Methods

    and Type of Errors

    Measuring errors, Binary representation,Propagation of errors and Taylor series

    2 14 Feb. 2010 Nonlinear Equations Bisection Method

    3 21 Feb. 2010 Newton-Raphson Method

    4 28 Feb. 2010 Interpolation Lagrange Interpolation

    5 7 March 2010 Newton's Divided Difference Method

    6 14 March 2010 Differentiation Newton's Forward and BackwardDivided Difference

    7 21 March 2010 Regression Least squares

    8 28 March 2010 Systems of LinearEquations

    Gaussian Jordan

    9 11 April 2010 Gaussian Seidel

    10 18 April 2010 Integration Composite Trapezoidal and SimpsonRules

    11 25 April 2010 Ordinary DifferentialEquations

    Euler's Method

    12 2 May 2010 Runge-Kutta 2nd and4th order Method

    Schedule

  • 8/14/2019 Lec 6BUE

    2/21

    Interpolation

    Newton's Forward DividedDifference

  • 8/14/2019 Lec 6BUE

    3/21

    What is Interpolation ?

    Given (x0,y0), (x1,y1), (xn,yn), find the valueof y at a value of x that is not given such that

    the differences are now constant h.

    x

    0 0( )y f x( )x

    0x

    1 0( )y f x h 2 0( 2 )..y f x h 0( )ny f x nh

    1 0x x h 2 0 2 ..x x h 0nx x nh

    1( )i ix x

  • 8/14/2019 Lec 6BUE

    4/21

    Interpolants

    Polynomials are the most commonchoice of interpolants because they

    are easy to:

    Evaluate

    Differentiate, andIntegrate.

  • 8/14/2019 Lec 6BUE

    5/21

    The equation of a straight line

    1

    1

    1

    ( ) ( )

    ( ) ( ) ( )( )

    ( ) ( ) ( )

    o

    o o o

    o o

    f x f x

    f x f x x sh xh

    f x f x f x

    : Given pass a linearLinear interpolation

    interpolant through the data

    ),,( 00 yx ),,( 11 yx

    0x xsh

    Such that ,and represented the first difference

    and it is called delta.

  • 8/14/2019 Lec 6BUE

    6/21

    Example

    To maximise a catch of bath in lake, it is suggested to throw the

    line to the depth of the thermocline. The characteristic featureof this area is the sudden change in temperature (T ). We aregiven the temperature , depth z(m) data for a lake in table1

    Depth z

    m

    18.3 -5

    18.5 -4

    18.8 -3

    19 -2

    19.4 -1

    19.4 0

    Table 1 Temperature vs. depthfor a lake.

    Figure 1 Temperature vs. depth of a lake.

    T

    0c

  • 8/14/2019 Lec 6BUE

    7/21

    Using the given data, we see the largest change in temperatureis between z =-3 m and z =-4 m. Determine the value of the

    temperature at z =-3.5 m. using Newton's forward dividedmethod of interpolation and a first order polynomial.

    z T(z)

    -4 18.5

    0.3

    -3 18.8

    T

    0z

    1z

    1 0 0

    1

    3.5 ( 4)

    ( ) ( ) ( ) 18.5 0.3 0.51

    ( 3.5) 18.8 0.3(0.5) 18.5 0.15 18.65

    T z T z s T z s s

    T

  • 8/14/2019 Lec 6BUE

    8/21

    Quadratic Interpolation (contd)Using the given data, we see the largest change in temperatureis between z =-4 m, z =-3 m and z=-2. Determine the value ofthe temperature at z =-3.5 m using Newton's forward dividedmethod of interpolation of a second order polynomial.

    z T(z)

    -4 18.5

    0.3

    -3 18.8 -0.1

    0.2

    -2 19

    0z

    1z

    2z

    T 2

    T

  • 8/14/2019 Lec 6BUE

    9/21

    2

    2 0 0 0

    2

    ( 1) 0.1 ( 1)( ) ( ) ( ) ( ) 18.5 0.3

    2! 2!

    0.1(0.5)( 0.5)( 3.5) 18.5 0.3(0.5) 18.5 0.15 0.0125 18.66252

    s s s sT z T z s T z T z s

    T

    The absolute relative approximate error obtained the resultfrom the first order and the second order polynomial is

    a

    18.6625 18.65

    100 0.06%18.6625a x

  • 8/14/2019 Lec 6BUE

    10/21

    Given (x0,y0), (x1,y1), (x2,y2), (x3,y3)

    2 2

    3 0 0 0 0

    ( 1) ( 1)( 2)( ) ( ) ( ) ( ) ( )

    2! 3!

    s s s s sf x f x s f x f x f x

    Cubic Interpolation (contd)For the third order polynomial interpolation

    Using the given data, we see the largest change in temperatureis between z =-4 m, z =-3 m, z=-2m and z=-1m. Determine thevalue of the temperature at z =-3.5 m using Newton's forward

    divided method of interpolation of a cubic order polynomial.

  • 8/14/2019 Lec 6BUE

    11/21

    z T(z)

    -4 18.5

    0.3

    -3 18.8 -0.10.2 -0.3

    -2 19 0.2

    0.4

    -1 19.4

    T 2T 3T

    0z

    1z

    2z

    3z

    3

    0.1(0.5)( 0.5) 0.3(0.5)( 0.5)( 1.5)( 3.5) 18.5 0.3(0.5) 18.64375

    2 6T

    The absolute relative approximate error obtained the resultfrom the second order and the third order polynomial is

    a

    18.64375 18.6625100 0.1%

    18.64375a x

  • 8/14/2019 Lec 6BUE

    12/21

    Comparison Table

    Order of

    Polynomial toNewtons forward

    1 2 3

    T(z=-3.5) 18.65 18.6625 18.64375

    Absolute RelativeApproximate Error

    ---------- 0.0669 % 0.1%

  • 8/14/2019 Lec 6BUE

    13/21

    0 0

    1

    2

    0 0 0 0

    ( 1)( 2)....( 1)( ) ( ) ( )!

    ( 1) ( 1)( 2)....( 1)( ) ( ) ( )..... ( )

    2! !

    nk

    n

    k

    n

    s s s s kx f x f xk

    s s s s s s nf x s f x f x f x

    n

    General Form

    For the n+1 order polynomial Newton's forward interpolationGiven (x0,y0), (x1,y1), (x2,y2),. (xn,yn)

  • 8/14/2019 Lec 6BUE

    14/21

    Newton's backward Divided

    Difference

  • 8/14/2019 Lec 6BUE

    15/21

    : Given pass a linearLinear interpolation

    interpolant to backward divided difference is

    ),,( 00 yx ),,( 11 yx

    1( ) ( ) ( )n nx f x s f x

    Such that , the inverted delta symbol which

    is called nabla.

    nx x

    s h

  • 8/14/2019 Lec 6BUE

    16/21

    in the same example the linear polynomial Newton'sbackward divided difference is

    z T(z)

    -4 18.5

    0.3

    -3 18.8

    0z

    ( )T z

    1( 3.5) 18.8 0.3( 0.5) 18.8 0.15 18.65T

    1z

    1( ) ( ) ( )n nf x f x s f x

    3.5 ( 3)

    0.51s

  • 8/14/2019 Lec 6BUE

    17/21

    z T(z)

    -4 18.5

    0.3

    -3 18.8 -0.1

    0.2

    -2 19

    in the same example the second order polynomialNewton's backward divided difference is

    0z

    1

    z

    2z

    ( )T z 2 ( )T z

    2

    2

    ( 1)( ) ( ) ( ) ( )

    2!n n n

    s sx f x s f x f x

    2

    ( 0.5)(0.5)( 0.1)( 3.5) 19 0.2( 0.5)

    2

    19 0.1 0.0125 18.8875

    T

  • 8/14/2019 Lec 6BUE

    18/21

    The absolute relative approximate error obtained the result

    from the first order and the second order polynomial is

    a

    18.8875 18.65100 1.25%

    18.8875a x

  • 8/14/2019 Lec 6BUE

    19/21

    z T(z)

    -4 18.5

    0.3

    -3 18.8 -0.1

    0.2 -0.3

    -2 19 0.2

    0.4

    -1 19.4

    in the same example the third order polynomialNewton's backward divided difference is

    0z

    1z

    2z

    3z

    ( )T z 2 ( )T z 3 ( )T z

    3

    ( 0.5)(0.5)(0.2) ( 0.5)(0.5)(1.5)( 0.3)( 3.5) 19 0.4( 0.5)

    2 6

    19 0.2 0.025 0.01875 18.79375

    T

  • 8/14/2019 Lec 6BUE

    20/21

    Comparison Table

    Order of

    Polynomial

    1 2 3

    T(z=-3.5) 18.65 18.8875 18.79375

    Absolute RelativeApproximate Error

    ---------- 1.25 % 0.4%

    Since the value z=-3.5 is near the first of the table, to get thecorresponding value of z we must to use Newton's forward

    interpolation.

  • 8/14/2019 Lec 6BUE

    21/21

    General Form

    For the n+1 order polynomial Newton's backward interpolationGiven (x0,y0), (x1,y1), (x2,y2),. (xn,yn)

    1

    2

    ( 1)( 2)....( 1)( ) ( ) ( )!

    ( 1) ( 1)( 2)....( 1)( ) ( ) ( )..... ( )

    2! !

    nk

    n n n

    k

    n

    n n n n

    s s s s kx f x f xk

    s s s s s s nf x s f x f x f x

    n