TaylorSeriesdn1-2

Embed Size (px)

Citation preview

  • 8/13/2019 TaylorSeriesdn1-2

    1/7

    Taylor Series

    &

    Error

  • 8/13/2019 TaylorSeriesdn1-2

    2/7

    Series and Iterative methods

    Any series xncan be turned into an

    iterative method by considering the

    sequence of partial sumssn. nnn

    n

    n

    k

    kn

    xss

    xxxxxs

    1

    210

    0

    Functions and Taylor Expansions

    From Intermediate Calculus we know any function that has n+1derivatives at a

    point ahas a nthTaylor Polynomial expansion centered at aand an expression for

    the error.

    xRaxnaf

    ax

    af

    ax

    af

    afxf

    erroraxk

    afxf

    n

    nn

    n

    k

    kk

    !!2!1

    !

    2

    '''

    0

    The valuef(k)(a) is the kthderivative

    evaluated at a. The functionRn(x)

    represents the error where cis a value

    betweenxand a.

    1

    1

    !1

    n

    n

    n axn

    cfxR

  • 8/13/2019 TaylorSeriesdn1-2

    3/7

  • 8/13/2019 TaylorSeriesdn1-2

    4/7

    To find the Taylor series for the function f(x) = arctan(x).

    75312

    1

    arctan

    111

    1

    111

    11

    1

    753

    0

    12

    642

    0

    2

    2

    32

    0

    32

    0

    xxxxk

    xx

    xxxxx

    xxxxx

    xxxxx

    k

    kk

    k

    kk

    k

    k

    k

    kStart with known Taylor Series

    Substitutexforx

    Substitutex2forx

    Integrate both sides.

    !6!4!2!2cosh

    !6!4!21

    !2cosh

    !6!4!21!2cosh

    654

    3

    0

    3

    3

    32

    0

    642

    0

    2

    xxxx

    k

    xxx

    xxx

    k

    xx

    xxx

    k

    xx

    k

    k

    k

    k

    k

    k

    To find the Taylor series for the function xxxg cosh3

    Start with known Taylor Series

    Substitute

    Multiply byx3

    xxfor

  • 8/13/2019 TaylorSeriesdn1-2

    5/7

    A second version of Taylor Polynomials

    For any functionf(x) consider the function

    f(x+h) where we think ofxas a constant and h

    is the variable. Consider the Taylor expansion

    forf(x+h) (with variable h) centered at 0. The

    kthderivatives are found to the right.

    xfhxfdh

    hxfd kh

    k

    h

    k

    k

    0

    0

    1

    1

    2

    '''

    0 !1!!2!1!

    k

    kk

    kn

    k

    kk

    h

    k

    cxfh

    k

    xfh

    xfh

    xfxfh

    k

    xfhxf

    This is a more computationally useful way of applying Taylor Series to

    approximate functions. We think of the value of has small (close to zero) and

    will represent the distance between computable derivatives andx. Consider the

    following example.

    Approximate sin(30.01) with an error of less than 0.00000001.

    We first need to convert to radians to get the value for h.

    180

    01.

    6180 sin01.30sin01.30sin01.30sin

    180

    01. h

  • 8/13/2019 TaylorSeriesdn1-2

    6/7

    We need to figure out the value of kthat

    gives the desired accuracy. The exact

    error is given by the expression to the

    right.

    1

    66

    180

    01.

    !1

    cosorsinError

    k

    k

    cc

    00000001.

    4500

    1

    !1

    1

    180

    01.

    !1

    cosorsinError

    1

    66

    kk

    kk

    cc

    We know the values for sine and cosine are always less than 1 in absolute

    value and is less than 4. Try different values of kthat make this inequality true.

    When we try k=2 we find the right side is 0.000000000001829. This means

    we need go out to the k=2 term.

    2

    180

    01.

    6180

    01.

    66180

    01.

    6

    sincossinsin01.30sin

    47161480.50015113180

    01.

    2

    1

    180

    01.

    2

    3

    2

    1 2

    2330817...0.5001511401.30sin

  • 8/13/2019 TaylorSeriesdn1-2

    7/7

    Alternating Series and Error

    From intermediate calc remember that a series (-1)kakconverges if the

    sequence akare positive terms that decrease to zero, this was called the

    alternating series test. The series (-1)kakis called an Alternating Series. The

    nice thing about alternating series is that keeping tract of the error is very easy asgiven by the theorem below.

    Alternating Series Error Theorem

    In any convergent alternating series (-1)kakthe error is always less than the

    first term omitted. In other words:

    |Error| < ak+1

    Example: Compute 1/eaccurate to .0001

    !4

    1

    !3

    1

    !2

    1

    11

    1 1

    ee The series for 1/eis alternating so the theorem applies.

    .0001160.00002480!8

    1 We need to go to the k=7 term.

    290.36785714!7

    1

    !6

    1

    !5

    1

    !4

    1

    !3

    1

    !2

    111

    1

    e10.36787944

    1

    e