66
ECEG-2112 : Computational Methods Introduction to Computational Methods and Taylor Series Lecture 1: 1

numarical metoud Lecture 01

  • Upload
    alula

  • View
    9

  • Download
    0

Embed Size (px)

DESCRIPTION

it is introduction lecture

Citation preview

Page 1: numarical metoud Lecture 01

ECEG-2112 : Computational Methods

Introduction to Computational Methods and Taylor Series

Lecture 1:

1

Page 2: numarical metoud Lecture 01

Lecture 1Introduction to Computational

Methods

What are COMPUTATIONAL METHODS? Why do we need them? Topics covered in ECEG-2112.

Reading Assignment: Pages 3-10 of textbook

What are COMPUTATIONAL METHODS? Why do we need them? Topics covered in ECEG-2112.

Reading Assignment: Pages 3-10 of textbook

2

Page 3: numarical metoud Lecture 01

Numerical MethodsNumerical Methods:

Algorithms that are used to obtain numericalsolutions of a mathematical problem.

Why do we need them?1. No analytical solution exists,2. An analytical solution is difficult to obtain

or not practical.

Numerical Methods:Algorithms that are used to obtain numericalsolutions of a mathematical problem.

Why do we need them?1. No analytical solution exists,2. An analytical solution is difficult to obtain

or not practical.

3

Page 4: numarical metoud Lecture 01

What do we need?Basic Needs in the Numerical Methods: Practical:

Can be computed in a reasonable amount of time. Accurate:

Good approximate to the true value, Information about the approximation error

(Bounds, error order,… ).

Basic Needs in the Numerical Methods: Practical:

Can be computed in a reasonable amount of time. Accurate:

Good approximate to the true value, Information about the approximation error

(Bounds, error order,… ).

4

Page 5: numarical metoud Lecture 01

Outlines of the Course Taylor Theorem Number

Representation Solution of nonlinear

Equations Interpolation Numerical

Differentiation Numerical Integration

Solution of linearEquations

Least Squares curvefitting

Solution of ordinarydifferential equations

Solution of Partialdifferential equations

Taylor Theorem Number

Representation Solution of nonlinear

Equations Interpolation Numerical

Differentiation Numerical Integration

Solution of linearEquations

Least Squares curvefitting

Solution of ordinarydifferential equations

Solution of Partialdifferential equations

5

Page 6: numarical metoud Lecture 01

Solution of Nonlinear Equations Some simple equations can be solved analytically:

Many other equations have no analytical solution:

31

)1(2

)3)(1(444solutionAnalytic

034

2

2

xandx

roots

xx

Some simple equations can be solved analytically:

Many other equations have no analytical solution:

31

)1(2

)3)(1(444solutionAnalytic

034

2

2

xandx

roots

xx

solutionanalyticNo052 29

xex

xx

6

Page 7: numarical metoud Lecture 01

Methods for Solving Nonlinear Equations

o Bisection Method

o Newton-Raphson Method

o Secant Method

o Bisection Method

o Newton-Raphson Method

o Secant Method

7

Page 8: numarical metoud Lecture 01

Solution of Systems of Linear Equations

unknowns.1000inequations1000

have weifdoWhat to

123,2

523,3

:asitsolvecanWe

52

3

12

2221

21

21

xx

xxxx

xx

xx

unknowns.1000inequations1000

have weifdoWhat to

123,2

523,3

:asitsolvecanWe

52

3

12

2221

21

21

xx

xxxx

xx

xx

8

Page 9: numarical metoud Lecture 01

Cramer’s Rule is Not Practical

this.compute toyears10 thanmoreneedscomputersuperA

needed.aretionsmultiplica102.3system,30by30asolveTo

tions.multiplica

1)N!1)(N(Nneed weunknowns,N withequationsNsolveTo

problems.largeforpracticalnotisRulesCramer'But

2

21

11

51

31

,1

21

11

25

13

:system thesolve tousedbecanRulesCramer'

20

35

21

xx

this.compute toyears10 thanmoreneedscomputersuperA

needed.aretionsmultiplica102.3system,30by30asolveTo

tions.multiplica

1)N!1)(N(Nneed weunknowns,N withequationsNsolveTo

problems.largeforpracticalnotisRulesCramer'But

2

21

11

51

31

,1

21

11

25

13

:system thesolve tousedbecanRulesCramer'

20

35

21

xx

9

Page 10: numarical metoud Lecture 01

Methods for Solving Systems of LinearEquations

o Naive Gaussian Elimination

o Gaussian Elimination with ScaledPartial Pivoting

o Algorithm for Tri-diagonalEquations

o Naive Gaussian Elimination

o Gaussian Elimination with ScaledPartial Pivoting

o Algorithm for Tri-diagonalEquations

10

Page 11: numarical metoud Lecture 01

Curve Fitting Given a set of data:

Select a curve that best fits the data. Onechoice is to find the curve so that the sumof the square of the error is minimized.

x 0 1 2

y 0.5 10.3 21.3

Given a set of data:

Select a curve that best fits the data. Onechoice is to find the curve so that the sumof the square of the error is minimized.

x 0 1 2

y 0.5 10.3 21.3

11

Page 12: numarical metoud Lecture 01

Interpolation Given a set of data:

Find a polynomial P(x) whose graphpasses through all tabulated points.

xi 0 1 2

yi 0.5 10.3 15.3

Given a set of data:

Find a polynomial P(x) whose graphpasses through all tabulated points.

xi 0 1 2

yi 0.5 10.3 15.3

tablein theis)( iii xifxPy 12

Page 13: numarical metoud Lecture 01

Methods for Curve Fittingo Least Squares

o Linear Regressiono Nonlinear Least Squares Problems

o Interpolationo Newton Polynomial Interpolationo Lagrange Interpolation

o Least Squareso Linear Regressiono Nonlinear Least Squares Problems

o Interpolationo Newton Polynomial Interpolationo Lagrange Interpolation

13

Page 14: numarical metoud Lecture 01

Integration Some functions can be integrated

analytically:

?

:solutionsanalyticalnohavefunctionsmanyBut

42

1

2

9

2

1

0

3

1

23

1

2

dxe

xxdx

ax ?

:solutionsanalyticalnohavefunctionsmanyBut

42

1

2

9

2

1

0

3

1

23

1

2

dxe

xxdx

ax

14

Page 15: numarical metoud Lecture 01

Methods for Numerical Integration

o Upper and Lower Sums

o Trapezoid Method

o Romberg Method

o Gauss Quadrature

o Upper and Lower Sums

o Trapezoid Method

o Romberg Method

o Gauss Quadrature

15

Page 16: numarical metoud Lecture 01

Solution of Ordinary Differential Equations

only.casesspecial

foravailablearesolutionsAnalytical*

equations. thesatisfies thatfunctionais

0)0(;1)0(

0)(3)(3)(

:equationaldifferenti theosolution tA

x(t)

xx

txtxtx

only.casesspecial

foravailablearesolutionsAnalytical*

equations. thesatisfies thatfunctionais

0)0(;1)0(

0)(3)(3)(

:equationaldifferenti theosolution tA

x(t)

xx

txtxtx

16

Page 17: numarical metoud Lecture 01

Solution of Partial Differential Equations

Partial Differential Equations are moredifficult to solve than ordinary differentialequations:

)sin()0,(,0),1(),0(

022

2

2

2

xxututut

u

x

u

)sin()0,(,0),1(),0(

022

2

2

2

xxututut

u

x

u

17

Page 18: numarical metoud Lecture 01

Summary Numerical Methods:

Algorithms that areused to obtainnumerical solution of amathematical problem.

We need them whenNo analytical solutionexists or it is difficultto obtain it.

Solution of Nonlinear Equations Solution of Linear Equations Curve Fitting

Least Squares Interpolation

Numerical Integration Numerical Differentiation Solution of Ordinary Differential

Equations Solution of Partial Differential

Equations

Topics Covered in the Course Numerical Methods:

Algorithms that areused to obtainnumerical solution of amathematical problem.

We need them whenNo analytical solutionexists or it is difficultto obtain it.

Solution of Nonlinear Equations Solution of Linear Equations Curve Fitting

Least Squares Interpolation

Numerical Integration Numerical Differentiation Solution of Ordinary Differential

Equations Solution of Partial Differential

Equations

18

Page 19: numarical metoud Lecture 01

Number Representation Normalized Floating Point Representation Significant Digits Accuracy and Precision Rounding and Chopping

Reading Assignment: Chapter 3

Number Representation and Accuracy

Number Representation Normalized Floating Point Representation Significant Digits Accuracy and Precision Rounding and Chopping

Reading Assignment: Chapter 3

19

Page 20: numarical metoud Lecture 01

Representing Real Numbers You are familiar with the decimal system:

Decimal System: Base = 10 , Digits (0,1,…,9)

Standard Representations:

21012 10510410210110345.312

You are familiar with the decimal system:

Decimal System: Base = 10 , Digits (0,1,…,9)

Standard Representations:

partpart

fractionintegralsign

54.213

20

Page 21: numarical metoud Lecture 01

Normalized Floating Point Representation Normalized Floating Point Representation:

Scientific Notation: Exactly one non-zero digit appearsbefore decimal point.

Advantage: Efficient in representing very small or verylarge numbers.

exponentsigned:,0

exponentmantissasign

104321.

nd

nffffd

Normalized Floating Point Representation:

Scientific Notation: Exactly one non-zero digit appearsbefore decimal point.

Advantage: Efficient in representing very small or verylarge numbers.

exponentsigned:,0

exponentmantissasign

104321.

nd

nffffd

21

Page 22: numarical metoud Lecture 01

Binary System

Binary System: Base = 2, Digits {0,1}

exponentsignedmantissasign

2.1 4321nffff

Binary System: Base = 2, Digits {0,1}

exponentsignedmantissasign

2.1 4321nffff

10)625.1(10)3212201211(2)101.1(

22

Page 23: numarical metoud Lecture 01

Fact Numbers that have a finite expansion in one numbering

system may have an infinite expansion in anothernumbering system:

You can never represent 1.1 exactly in binary system.

210 ...)011000001100110.1()1.1(

Numbers that have a finite expansion in one numberingsystem may have an infinite expansion in anothernumbering system:

You can never represent 1.1 exactly in binary system.

210 ...)011000001100110.1()1.1(

23

Page 24: numarical metoud Lecture 01

IEEE 754 Floating-Point Standard Single Precision (32-bit representation) 1-bit Sign + 8-bit Exponent + 23-bit Fraction

Double Precision (64-bit representation) 1-bit Sign + 11-bit Exponent + 52-bit Fraction

S Exponent8 Fraction23

Single Precision (32-bit representation) 1-bit Sign + 8-bit Exponent + 23-bit Fraction

Double Precision (64-bit representation) 1-bit Sign + 11-bit Exponent + 52-bit Fraction

S Exponent11 Fraction52

(continued)

24

Page 25: numarical metoud Lecture 01

IEEE 754 Floating-Point Standard

25

Page 26: numarical metoud Lecture 01

Example

26

Page 27: numarical metoud Lecture 01

Significant Digits

Significant digits are those digits that can be

used with confidence.

Single-Precision: 7 Significant Digits

1.175494… × 10-38 to 3.402823… × 1038

Double-Precision: 15 Significant Digits

2.2250738… × 10-308 to 1.7976931… × 10308

Significant digits are those digits that can be

used with confidence.

Single-Precision: 7 Significant Digits

1.175494… × 10-38 to 3.402823… × 1038

Double-Precision: 15 Significant Digits

2.2250738… × 10-308 to 1.7976931… × 10308

27

Page 28: numarical metoud Lecture 01

Remarks

Numbers that can be exactly represented are calledmachine numbers.

Difference between machine numbers is not uniform

Sum of machine numbers is not necessarily a machinenumber

Numbers that can be exactly represented are calledmachine numbers.

Difference between machine numbers is not uniform

Sum of machine numbers is not necessarily a machinenumber

28

Page 29: numarical metoud Lecture 01

Calculator Example Suppose you want to compute:

3.578 * 2.139using a calculator with two-digit fractions

3.57 * 2.13 7.60=

7.653342True answer:

29

Page 30: numarical metoud Lecture 01

48.9

Significant Digits - Example

30

Page 31: numarical metoud Lecture 01

Accuracy and Precision

Accuracy is related to the closeness to the truevalue.

Precision is related to the closeness to otherestimated values.

Accuracy is related to the closeness to the truevalue.

Precision is related to the closeness to otherestimated values.

31

Page 32: numarical metoud Lecture 01

32

Page 33: numarical metoud Lecture 01

Rounding and Chopping

Rounding: Replace the number by the nearestmachine number.

Chopping: Throw all extra digits.

Rounding: Replace the number by the nearestmachine number.

Chopping: Throw all extra digits.

33

Page 34: numarical metoud Lecture 01

Rounding and Chopping

34

Page 35: numarical metoud Lecture 01

Can be computed if the true value is known:

100* valuetrue

ionapproximat valuetrue

ErrorRelativePercentAbsolute

ionapproximat valuetrue

ErrorTrueAbsolute

t

tE

Error Definitions – True Error

100* valuetrue

ionapproximat valuetrue

ErrorRelativePercentAbsolute

ionapproximat valuetrue

ErrorTrueAbsolute

t

tE

35

Page 36: numarical metoud Lecture 01

When the true value is not known:

100*estimatecurrent

estimatepreviousestimatecurrent

ErrorRelativePercentAbsoluteEstimated

estimatepreviousestimatecurrent

ErrorAbsoluteEstimated

a

aE

Error Definitions – Estimated Error

100*estimatecurrent

estimatepreviousestimatecurrent

ErrorRelativePercentAbsoluteEstimated

estimatepreviousestimatecurrent

ErrorAbsoluteEstimated

a

aE

36

Page 37: numarical metoud Lecture 01

We say that the estimate is correct to ndecimal digits if:

We say that the estimate is correct to ndecimal digits rounded if:

n10Error

NotationWe say that the estimate is correct to n

decimal digits if:

We say that the estimate is correct to ndecimal digits rounded if:

n 102

1Error

37

Page 38: numarical metoud Lecture 01

Summary Number Representation

Numbers that have a finite expansion in one numbering systemmay have an infinite expansion in another numbering system.

Normalized Floating Point Representation Efficient in representing very small or very large numbers, Difference between machine numbers is not uniform, Representation error depends on the number of bits used in

the mantissa.

Number RepresentationNumbers that have a finite expansion in one numbering systemmay have an infinite expansion in another numbering system.

Normalized Floating Point Representation Efficient in representing very small or very large numbers, Difference between machine numbers is not uniform, Representation error depends on the number of bits used in

the mantissa.

38

Page 39: numarical metoud Lecture 01

Taylor Theorem

Motivation Taylor Theorem Examples

Reading assignment: Chapter 4

Motivation Taylor Theorem Examples

Reading assignment: Chapter 4

39

Page 40: numarical metoud Lecture 01

Motivation

We can easily compute expressions like:

?)6.0sin(,4.1computeyoudoHowBut,

)4(2

103 2

x

?)6.0sin(,4.1computeyoudoHowBut,

)4(2

103 2

x

way?practicala thisIs

sin(0.6)?computeto

definition theuse weCan

0.6

ab

40

Page 41: numarical metoud Lecture 01

Remark

In this course, all angles are assumed tobe in radian unless you are told otherwise.

41

Page 42: numarical metoud Lecture 01

Taylor Series

∑∞

0

)(

0

)(

3)3(

2)2(

'

)()(!

1)(

: writecan weconverge,series theIf

)()(!

1

...)(!3

)()(

!2)(

)()()(

:about)(ofexpansionseriesTaylorThe

k

kk

k

kk

axafk

xf

axafk

SeriesTaylor

or

axaf

axaf

axafaf

axf

∑∞

0

)(

0

)(

3)3(

2)2(

'

)()(!

1)(

: writecan weconverge,series theIf

)()(!

1

...)(!3

)()(

!2)(

)()()(

:about)(ofexpansionseriesTaylorThe

k

kk

k

kk

axafk

xf

axafk

SeriesTaylor

or

axaf

axaf

axafaf

axf

42

Page 43: numarical metoud Lecture 01

Maclaurin Series Maclaurin series is a special case of Taylor

series with the center of expansion a = 0.

∑∞

0

)(

3)3(

2)2(

'

)0(!

1)(

: writecan weconverge,series theIf

...!3

)0(!2

)0()0()0(

:)(ofexpansionseriesn MaclauriThe

k

kk xfk

xf

xf

xf

xff

xf

∑∞

0

)(

3)3(

2)2(

'

)0(!

1)(

: writecan weconverge,series theIf

...!3

)0(!2

)0()0()0(

:)(ofexpansionseriesn MaclauriThe

k

kk xfk

xf

xf

xf

xff

xf

43

Page 44: numarical metoud Lecture 01

Maclaurin Series – Example 1

∞.xforconvergesseriesThe

...!3!2

1!

)0(!

1

11)0()(

1)0()(

1)0(')('

1)0()(

32∞

0

0

)(

)()(

)2()2(

∑∑

xxx

kx

xfk

e

kforfexf

fexf

fexf

fexf

k

k

k

kkx

kxk

x

x

x

xexf )(ofexpansionseriesn MaclauriObtain

∞.xforconvergesseriesThe

...!3!2

1!

)0(!

1

11)0()(

1)0()(

1)0(')('

1)0()(

32∞

0

0

)(

)()(

)2()2(

∑∑

xxx

kx

xfk

e

kforfexf

fexf

fexf

fexf

k

k

k

kkx

kxk

x

x

x

44

Page 45: numarical metoud Lecture 01

The exponential function ex (in blue), and the sum of thefirst n+1 terms of its Taylor series at 0 (in red).

45

Page 46: numarical metoud Lecture 01

Taylor SeriesExample 1

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

1

1+x

1+x+0.5x2exp(x)

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

2

2.5

3

1

1+x

1+x+0.5x2exp(x)

46

Page 47: numarical metoud Lecture 01

Maclaurin Series – Example 2

∞.xforconvergesseriesThe

....!7!5!3!

)0()sin(

1)0()cos()(

0)0()sin()(

1)0(')cos()('

0)0()sin()(

753∞

0

)(

)3()3(

)2()2(

xxxxx

kf

x

fxxf

fxxf

fxxf

fxxf

k

kk

:)sin()(ofexpansionseriesn MaclauriObtain xxf

∞.xforconvergesseriesThe

....!7!5!3!

)0()sin(

1)0()cos()(

0)0()sin()(

1)0(')cos()('

0)0()sin()(

753∞

0

)(

)3()3(

)2()2(

xxxxx

kf

x

fxxf

fxxf

fxxf

fxxf

k

kk

47

Page 48: numarical metoud Lecture 01

-4 -3 -2 -1 0 1 2 3 4-4

-3

-2

-1

0

1

2

3

4

x

x-x3/3!

x-x3/3!+x5/5!

sin(x)

-4 -3 -2 -1 0 1 2 3 4-4

-3

-2

-1

0

1

2

3

4

x

x-x3/3!

x-x3/3!+x5/5!

sin(x)

48

Page 49: numarical metoud Lecture 01

Maclaurin Series – Example 3

∞.forconvergesseriesThe

....!6!4!2

1)(!

)0()cos(

0)0()sin()(

1)0()cos()(

0)0(')sin()('

1)0()cos()(

642∞

0

)(

)3()3(

)2()2(

x

xxxx

kf

x

fxxf

fxxf

fxxf

fxxf

k

kk

)cos()(:ofexpansionseriesMaclaurinObtain xxf

∞.forconvergesseriesThe

....!6!4!2

1)(!

)0()cos(

0)0()sin()(

1)0()cos()(

0)0(')sin()('

1)0()cos()(

642∞

0

)(

)3()3(

)2()2(

x

xxxx

kf

x

fxxf

fxxf

fxxf

fxxf

k

kk

49

Page 50: numarical metoud Lecture 01

Maclaurin Series – Example 4

1||forconvergesSeries

...xxx1x1

1:ofExpansionSeriesMaclaurin

6)0(1

6)(

2)0(1

2)(

1)0('1

1)('

1)0(1

1)(

ofexpansionseriesn MaclauriObtain

32

)3(4

)3(

)2(3

)2(

2

x

fx

xf

fx

xf

fx

xf

fx

xf

x11

f(x)

1||forconvergesSeries

...xxx1x1

1:ofExpansionSeriesMaclaurin

6)0(1

6)(

2)0(1

2)(

1)0('1

1)('

1)0(1

1)(

ofexpansionseriesn MaclauriObtain

32

)3(4

)3(

)2(3

)2(

2

x

fx

xf

fx

xf

fx

xf

fx

xf

x11

f(x)

50

Page 51: numarical metoud Lecture 01

Example 4 - Remarks

Can we apply the series for x≥1??

How many terms are needed to get a goodapproximation???

How many terms are needed to get a goodapproximation???

These questions will be answered usingTaylor’s Theorem.

51

Page 52: numarical metoud Lecture 01

Taylor Series – Example 5

...)1()1()1(1:)1(ExpansionSeriesTaylor

6)1(6

)(

2)1(2

)(

1)1('1

)('

1)1(1

)(

1atofexpansionseriesTaylorObtain

32

)3(4

)3(

)2(3

)2(

2

xxxa

fx

xf

fx

xf

fx

xf

fx

xf

ax

1f(x)

...)1()1()1(1:)1(ExpansionSeriesTaylor

6)1(6

)(

2)1(2

)(

1)1('1

)('

1)1(1

)(

1atofexpansionseriesTaylorObtain

32

)3(4

)3(

)2(3

)2(

2

xxxa

fx

xf

fx

xf

fx

xf

fx

xf

ax

1f(x)

52

Page 53: numarical metoud Lecture 01

Taylor Series – Example 6

...)1(31

)1(21

)1(:ExpansionSeriesTaylor

2)1(1)1(,1)1(',0)1(

2)(,

1)(,

1)(',)ln()(

)1(at)ln(ofexpansionseriesTaylorObtain

32

)3()2(

3)3(

2)2(

xxx

ffff

xxf

xxf

xxfxxf

axf(x)

...)1(31

)1(21

)1(:ExpansionSeriesTaylor

2)1(1)1(,1)1(',0)1(

2)(,

1)(,

1)(',)ln()(

)1(at)ln(ofexpansionseriesTaylorObtain

32

)3()2(

3)3(

2)2(

xxx

ffff

xxf

xxf

xxfxxf

axf(x)

53

Page 54: numarical metoud Lecture 01

Convergence of Taylor Series

The Taylor series converges fast (few termsare needed) when x is near the point ofexpansion. If |x-a| is large then more termsare needed to get a good approximation.

The Taylor series converges fast (few termsare needed) when x is near the point ofexpansion. If |x-a| is large then more termsare needed to get a good approximation.

54

Page 55: numarical metoud Lecture 01

Taylor’s Theorem

.andbetweenis)()!1(

)(

:where

)(!

)()(

:bygivenis)(of value the thenandcontainingintervalanon

1)(...,2,1,ordersofsderivativepossesses)(functionaIf

1)1(

0

)(

xaandaxn

fR

Raxk

afxf

xfxa

nxf

nn

n

n

n

k

kk

(n+1) terms TruncatedTaylor Series

.andbetweenis)()!1(

)(

:where

)(!

)()(

:bygivenis)(of value the thenandcontainingintervalanon

1)(...,2,1,ordersofsderivativepossesses)(functionaIf

1)1(

0

)(

xaandaxn

fR

Raxk

afxf

xfxa

nxf

nn

n

n

n

k

kk

Remainder

55

Page 56: numarical metoud Lecture 01

Taylor’s Theorem

.applicablenotisTheoremTaylor

defined.notaresderivative

itsandfunction thethen,1If

.1||if0expansionofpoint thewith1

1

:for theoremsTaylor'applycanWe

x

xax

f(x)

.applicablenotisTheoremTaylor

defined.notaresderivative

itsandfunction thethen,1If

.1||if0expansionofpoint thewith1

1

:for theoremsTaylor'applycanWe

x

xax

f(x)

56

Page 57: numarical metoud Lecture 01

Error Term

.andbetweenallfor

)()!1(

)(

:onboundupperanderivecanwe

error,ionapproximatabout theideaangetTo

1)1(

xaofvalues

axn

fR n

n

n

.andbetweenallfor

)()!1(

)(

:onboundupperanderivecanwe

error,ionapproximatabout theideaangetTo

1)1(

xaofvalues

axn

fR n

n

n

57

Page 58: numarical metoud Lecture 01

Error Term - Example

?2.00at

expansionseriesTayloritsof3)( terms4firstthe

by)(replaced weiferror theislargeHow

xwhena

n

exf x

0514268.82.0)!1(

)()!1(

)(

1≥≤)()(

31

2.0

1)1(

2.0)()(

ERn

eR

axn

fR

nforefexf

nn

nn

n

nxn

58

Page 59: numarical metoud Lecture 01

Alternative form of Taylor’s Theorem

hxxwherehn

fR

hRhk

xfhxf

hxx

nxfLet

nn

n

n

n

k

kk

andbetweenis)!1(

)(

size)step(!

)()(

: thenandcontainingintervalanon

1)(...,2,1,ordersofsderivativehave)(

1)1(

0

)(

hxxwhereh

n

fR

hRhk

xfhxf

hxx

nxfLet

nn

n

n

n

k

kk

andbetweenis)!1(

)(

size)step(!

)()(

: thenandcontainingintervalanon

1)(...,2,1,ordersofsderivativehave)(

1)1(

0

)(

59

Page 60: numarical metoud Lecture 01

Taylor’s Theorem – Alternative forms

.andbetweenis

)!1()(

!)(

)(

,

.andbetweenis

)()!1(

)()(

!)(

)(

1)1(

0

)(

1)1(

0

)(

hxxwhere

hn

fh

kxf

hxf

hxxxa

xawhere

axn

fax

kaf

xf

nnn

k

kk

nnn

k

kk

.andbetweenis

)!1()(

!)(

)(

,

.andbetweenis

)()!1(

)()(

!)(

)(

1)1(

0

)(

1)1(

0

)(

hxxwhere

hn

fh

kxf

hxf

hxxxa

xawhere

axn

fax

kaf

xf

nnn

k

kk

nnn

k

kk

60

Page 61: numarical metoud Lecture 01

Mean Value Theorem

)()('

,,0forTheoremsTaylor'Use:Proof

)('

),(exists therethen

),(intervalopen theondefinedisderivativeitsand

],[intervalclosedaonfunctioncontinuousais)(If

abξff(a)f(b)

bhxaxnabf(a)f(b)ξf

baξba

baxf

)()('

,,0forTheoremsTaylor'Use:Proof

)('

),(exists therethen

),(intervalopen theondefinedisderivativeitsand

],[intervalclosedaonfunctioncontinuousais)(If

abξff(a)f(b)

bhxaxnabf(a)f(b)ξf

baξba

baxf

61

Page 62: numarical metoud Lecture 01

Alternating Series Theorem

termomittedFirst:

n terms)first theof(sumsumPartial:

convergesseriesThe

then

0lim

If

S

:seriesgalternatinheConsider t

1

1

4321

4321

n

n

nnnn

a

S

aSS

and

a

and

aaaa

aaaa

termomittedFirst:

n terms)first theof(sumsumPartial:

convergesseriesThe

then

0lim

If

S

:seriesgalternatinheConsider t

1

1

4321

4321

n

n

nnnn

a

S

aSS

and

a

and

aaaa

aaaa

62

Page 63: numarical metoud Lecture 01

Alternating Series – Example

!7

1

!5

1

!3

11)1(s

!5

1

!3

11)1(s

:Then

0lim

:sinceseriesgalternatinconvergentaisThis!7

1

!5

1

!3

11)1(s:usingcomputedbecansin(1)

4321

in

in

aandaaaa

in

nn

!7

1

!5

1

!3

11)1(s

!5

1

!3

11)1(s

:Then

0lim

:sinceseriesgalternatinconvergentaisThis!7

1

!5

1

!3

11)1(s:usingcomputedbecansin(1)

4321

in

in

aandaaaa

in

nn

63

Page 64: numarical metoud Lecture 01

Example 7

?1witheapproximatto

usedare terms1)( whenbeerror thecanlargeHow

expansion)ofcenter(the5.0at)(of

expansionseriesTaylortheObtain

12

12

xe

n

aexf

x

x

?1witheapproximatto

usedare terms1)( whenbeerror thecanlargeHow

expansion)ofcenter(the5.0at)(of

expansionseriesTaylortheObtain

12

12

xe

n

aexf

x

x

64

Page 65: numarical metoud Lecture 01

Example 7 – Taylor Series

...!

)5.0(2...

!2

)5.0(4)5.0(2

)5.0(!

)5.0(

2)5.0(2)(

4)5.0(4)(

2)5.0('2)('

)5.0()(

22

222

0

)(12

2)(12)(

2)2(12)2(

212

212

k

xe

xexee

xk

fe

efexf

efexf

efexf

efexf

kk

k

kk

x

kkxkk

x

x

x

5.0,)(ofexpansionseriesTaylorObtain 12 aexf x

...!

)5.0(2...

!2

)5.0(4)5.0(2

)5.0(!

)5.0(

2)5.0(2)(

4)5.0(4)(

2)5.0('2)('

)5.0()(

22

222

0

)(12

2)(12)(

2)2(12)2(

212

212

k

xe

xexee

xk

fe

efexf

efexf

efexf

efexf

kk

k

kk

x

kkxkk

x

x

x

65

Page 66: numarical metoud Lecture 01

Example 7 – Error Term

)!1(

max)!1(

)5.0(2

)!1(

)5.01(2

)5.0()!1(

)(

2)(

3

12

]1,5.0[

11

1121

1)1(

12)(

n

eError

en

Error

neError

xn

fError

exf

nn

nn

nn

xkk

)!1(

max)!1(

)5.0(2

)!1(

)5.01(2

)5.0()!1(

)(

2)(

3

12

]1,5.0[

11

1121

1)1(

12)(

n

eError

en

Error

neError

xn

fError

exf

nn

nn

nn

xkk

66