interpolation and polynomial approximation

Upload: ali-brkt

Post on 09-Apr-2018

236 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/8/2019 Interpolation and Polynomial Approximation

    1/22

    Dr. [email protected]

    1

    Interpolation and Polynomial Approximation

    Problem: Let x0, x1,xn be (n+1) distinct points

    on the real axis. We wish to construct apolynomial P(x) of degree

  • 8/8/2019 Interpolation and Polynomial Approximation

    2/22

    Dr. [email protected]

    2

    Existence and uniqueness of solution

    Let P(x) = a0.xn + a1.x

    n-1 ++an-1.x + an

    Linear system (n+1) equations in (n+1) unknown:

    nnnn

    n

    n

    n

    n

    nn

    nn

    nn

    nn

    waxaxaxa

    waxaxaxa

    waxaxaxa

    !

    !!

    ......

    ..............

    ......

    ......

    )1(

    1

    10

    11)1(

    1

    1110

    00)1(

    1

    0100

  • 8/8/2019 Interpolation and Polynomial Approximation

    3/22

    Dr. [email protected]

    3

    The linear system has a solution if :

    The determinant is called determinant Van der

    Monde.

    0

    1.

    ....

    .....

    1.

    1.

    ),..,,(det

    1

    1

    1

    11

    0

    1

    00

    10

    {

    -

    !

    n

    n

    n

    n

    n

    nn

    nn

    n

    xxx

    xxx

    xxx

    xxxV

  • 8/8/2019 Interpolation and Polynomial Approximation

    4/22

    Dr. [email protected]

    4

    Verify

    ee

    !

    !

    !

    !

    nji

    ij

    n

    j

    j

    i

    ij

    nn

    n

    xx

    xxxxx

    0

    1

    1

    0

    2

    )1(

    10

    )(

    )()1(,...,,(det

  • 8/8/2019 Interpolation and Polynomial Approximation

    5/22

    Dr. [email protected]

    5

    Lagrange Formula:

    The polynomial P(x) of degree at most n that passes

    through the (n+1) points (x0,w0), (x1,w1),(xn,wn) andhas the form:

    ))...()()...((

    ))...()()...(()(

    )(.)(

    110

    110

    0

    0

    niiiiii

    nii

    ji

    jn

    jij

    i

    n

    iii

    xxxxxxxx

    xxxxxxxx

    xx

    xxxL

    ithxLxP

    !

    4!

    !

    {!

    !

  • 8/8/2019 Interpolation and Polynomial Approximation

    6/22

    Dr. [email protected]

    6

    Example: P(-1) = 3 ; P(1) =1 ; P(2) = 3 et P(3) = 7

    1)(

    )(.)(.)(.)(.)(

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

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

    )1)(1)(3(

    )3)(1)(1(

    ))()((

    ))()((

    )2)(1)(2(

    )3)(2)(1(

    ))()((

    ))()((

    )4).(3).(2(

    )3).(2).(1(

    ))()((

    ))()((

    2

    33221100

    231303

    2103

    321202

    3102

    312101

    320

    1

    302010

    3210

    !

    !

    !

    !

    !

    !

    !

    !

    !

    !

    xxxP

    xlxlxlxlxP

    xxxxxxxxxxxxxxxl

    xxx

    xxxxxx

    xxxxxxl

    xxx

    xxxxxx

    xxxxxx

    l

    xxx

    xxxxxx

    xxxxxxl

  • 8/8/2019 Interpolation and Polynomial Approximation

    7/22

    Dr. [email protected] 7

    Newton Interpolation Polynomial

    !

    !

    !

    !!

    !!

    !

    !

    !

    !

    in

    njinjk

    nijk

    ij

    ij

    ij

    ii

    j

    i

    jij

    j

    n

    j

    j

    xx

    DDD

    xx

    DDD

    xx

    DDD

    WDD

    and

    xxxxxxxxx

    x

    ith

    xDxp

    )1...(...

    ...

    01

    0101

    00

    1

    0

    110

    0

    0

    ...01

    ,

    ,

    ))...()(()()(

    1)(

    )(.)(

    E

    E

    E

  • 8/8/2019 Interpolation and Polynomial Approximation

    8/22

    Dr. [email protected] 8

    The Divided Difference table:

    nnn

    nnn

    n

    o

    wx

    wx

    wx

    !

    !

    !

    ,1,2

    ..01

    12

    012111

    01

    00

    ....

    ......

    .....

  • 8/8/2019 Interpolation and Polynomial Approximation

    9/22

    Dr. [email protected] 9

    Example: p(1) = 2, P(3)=-1, P(4)=5, P(5) =1

    15

    4554

    8

    156

    2

    5

    13

    2

    321

    0123

    012

    01

    0

    !

    !

    !

    !

    D

    D

    D

    D

  • 8/8/2019 Interpolation and Polynomial Approximation

    10/22

    Dr. [email protected] 10

    2

    67

    8

    377

    2

    35

    8

    15)(

    )4)(3)(1())()((

    )3)(1()).((1)(

    1

    .)(

    23

    2103

    102

    01

    0

    3

    0

    30123201210100...01

    !

    !!

    !!

    !!

    !

    !!!

    xxxxP

    xxxxxxxxx

    xxxxxxxxx

    DDDDDxPj

    jj

    E

    E

    E

    E

    EEEEE

  • 8/8/2019 Interpolation and Polynomial Approximation

    11/22

    Dr. [email protected] 11

    2

    67

    8

    377

    2

    35

    8

    15)( 23 ! xxxxP

  • 8/8/2019 Interpolation and Polynomial Approximation

    12/22

    Dr. [email protected] 12

    Algorithm for interpolation with a Lagrangian polynomial

    To interpolate for f(x), given x and a set ofN+1 data

    pairs, (xi, fi), I = 0,,N:

    Set SUM = 0.

    DO For I = 0 to N:

    SET P = 1.

    DO FOR J = 0 to N:

    IF J I:

    SET P = P*(x - x(J) )/ (x(I) - x(J)).

    ENDO (J).

    SET SUM = SUM + P*fi

    ENDO (I).

    SUM is the interpolated value.

  • 8/8/2019 Interpolation and Polynomial Approximation

    13/22

    Dr. [email protected] 13

    The Error of the interpolating polynomial

    Let x0, x1,.. ,xn be (n+1) distinct points on the real axis

    and let f(x) be a real-valued function defined on someinterval [a, b] containing these points, we wish toconstruct P(x) of degree

  • 8/8/2019 Interpolation and Polynomial Approximation

    14/22

    Dr. [email protected] 14

    k

    kk

    n

    i

    ii

    n

    i

    ii

    xxxRxfx

    nkxfxwith

    xDxNewton

    xlxfxagrange

    {!

    !!

    !

    !

    !

    !

    )()()(

    ..1,0)()(

    )()(:

    )()()(:

    0

    ..01

    0

    E

  • 8/8/2019 Interpolation and Polynomial Approximation

    15/22

    Dr. [email protected] 15

    Interpolation Error

    f(x) = 1/x, x0 = 2, x1 = 2.5, x2 = 4

    f(2) = 0.5, f(2.5) = 0.4, f(4) = 0.25

    P(x) = 0.05x2 - 0.425x + 1.15

    P(3) = 0.325 f(3) = 0.333 |R(3)|= 0.008

    031.02

    6.

    12

    1)(

    12

    1)3(

    )(

    )!3(

    )(

    4

    )3(

    )3(210

    !

    e

    !

    !

    tf

    tfxxxxxx

    x

  • 8/8/2019 Interpolation and Polynomial Approximation

    16/22

    Dr. [email protected] 16

    Comparison between f(x) and P(x)

  • 8/8/2019 Interpolation and Polynomial Approximation

    17/22

    Dr. [email protected] 17

    The Error of the interpolating polynomial Cauchy Th. : Let f(x) be a real-valued function

    defined on [a,b] and (n+1) times differentiable on[a,b]. If P(x) is the polynomial of degree

  • 8/8/2019 Interpolation and Polynomial Approximation

    18/22

    Dr. [email protected] 18

    Interpolation in a function based on equally

    spaced points

    Note : xk = x0 + k.h K= 0,1,,n h: step

    and x = x0 +s.h s : variable

    )(1

    .)()!1(

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

    2

    )1.(

    2;

    1

    !

    )1)..(1.(;1

    0

    )1()1()1(tf

    n

    shtf

    n

    hnshshssR

    ssss

    s

    j

    jsss

    j

    ssNote

    nnn

    !

    !

    !

    !

    !

    !

  • 8/8/2019 Interpolation and Polynomial Approximation

    19/22

    Dr. [email protected] 19

    Lagrange Formula

    hsxxith

    insn

    isxfsP

    xlxfxP

    n

    i

    i

    n

    i

    ii

    .

    )()(

    )()()(

    0

    0

    0

    !

    !

    !

    !

    !

  • 8/8/2019 Interpolation and Polynomial Approximation

    20/22

    Dr. [email protected] 20

    Newton Formula

    !!

    (

    !!

    "((!((

    !!(

    !(

    !(

    n

    i

    in

    i

    ii

    j

    i

    j

    i

    j

    i

    j

    j

    i

    xfi

    sxDxP

    finde

    iforxfxfxf

    ixfxf

    Define

    xfxfxf

    xfhxfxfote

    0

    0

    0

    ..01

    1

    1

    11

    010

    )(.)()(

    0)()()(

    0)()(

    :

    )()()(

    )()()(

    E

  • 8/8/2019 Interpolation and Polynomial Approximation

    21/22

    Dr. [email protected] 21

    Let f(x) = x.e-x

    1) Find the interpolation polynomial p(x)

    which interpolates f(x) at x0 = 3, x1=4

    and x2

    = 5

    2) Find a bound for the interpolating

    error at point x = 3.5

  • 8/8/2019 Interpolation and Polynomial Approximation

    22/22

    Dr. [email protected] 22

    Let f(x) = ex

    1) Find the interpolation polynomial p(x)which interpolates f(x) at x0 = 1, x1=2,x2= 3 and x3=4.

    2) Find a bound for the interpolating

    error at point x = 2.5Where:

    e1 = 2.7183,

    e2

    = 7.389,e3 = 20.085,

    e4 = 54.598,