123
Chapter 19 Chapter 19 Chapter 19 Chapter 19 Numerics Numerics in General in General Bo-Yeong Kang, 2009 Kyungpook National University 1

Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Chapter 19Chapter 19Chapter 19Chapter 19NumericsNumerics in Generalin General

Bo-Yeong Kang, 2009Kyungpook National University

1

Page 2: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

What is What is numerical analysis ?y

2

Page 3: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

The study of algorithms to sol e the problems thatsolve the problems thatthere is no solution formula

3

Page 4: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

The steps from problems p pto answer

ModelingModelingChoosing a numeric methodsprogrammingprogrammingDoing the computationInterpreting the results

4

Page 5: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Real number

Fl ti i t f f Floating point form of numbersnumbers

0.6247*103, 0.735*10-13, -0.2000*10-1

Number of significant digits is kept fixedg g pDecimal point “floating”

5

Page 6: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Floating point form of Floating point form of numbersnumbers

a = m*10n , 0.1≤|m| < 1On computers, m & n is limitedp ,ā = m*10n , m=0.d1d2…dk, d1>0

mantissa

exponent

mantissa

6

Page 7: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Floating point form of n mbe snumbers

ā = m*10n , m=0.d1d2…dk, d1>0mantissa

exponent

exponent

tisign mantissaIBM 3000 & 4000 series

Single precision floating point number1 sign, 7 exponent, 24 mantissa, 32 bits

7

Page 8: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Floating point form of oat g po t o onumbers

The number outside that range occursUnderflow when the number is smaller (zero)Overflow when it is larger (halt)

exponent

sign mantissa

8

Page 9: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Roundoff(끝처리)mantissa

Roundoff(끝처리)

0.d1d2…dkdk+1dk +2dk+3 …Roundoff ruleDiscard (k+1)th and all subsequent decimalsDiscard (k+1)th and all subsequent decimalsIf the number discarded is less than half a unit in kth place, leave kth decimal unchanged(rounding down)If it is greater than half a unit, round add one to the kth decimal If it is greater than half a unit, round add one to the kth decimal (rounding up)If it is exactly half a unit, round off to the nearest even decimal

Rounding up/down happens about equallyg p/ pp q y

ex)3.45-3.4, 3.55-3.6

9

Page 10: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Error in RoundingError in Rounding

ā= fl(a), floating point approximation of a by rounding

|m-m| ≤ ½ * 10-k (ex. |0.45-0.4| ≤ ½ * 10-1)

|m| ≥ 0.1 , 1/|m| ≤ 10|(a- ā)/a| ≈|(m-m)/m| ≤ ½ * 101-k

Error bound in rounding

10

Page 11: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Errors of Numeric Results

Finding the results – ApproximationRounding errorsExperimental errors from measurementsT ncating e o s f om p emat el b eaking offTruncating errors from prematurely breaking off

Formulas for ErrorsFormulas for Errorsє = a – ãa = ã + є , True value = Approximation + errora ã + є , True value Approximation + errorã = 10.5, a=10.2, є = -0.3

11

Page 12: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Errors of Numeric Results

є = |a – ã|(absolute error) or ã – a| |( )єr = є/a = (a-ã)/a = Error/True value (relative error )This look useless because a is unknown

/ã єr = є/ã This still looks problematic because є is unknown

One can obtain in practice is an error bound for ã, |є| ≤ , hence |a-ã| ≤ | | | | |єr|≤ r , hence |(a-ã)/a| ≤ r

12

Page 13: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

E P tiError Propagation

How errors at the beginning and in later steps propagate into the computation and affect accuracy

(a) Subtractionx = x+є y=ỹ+є |є |≤ |є | ≤ x = x+є1 , y=ỹ+є2 , |є1|≤ 1 , |є2| ≤ 2 є = |x-y – (x-ỹ)|

= |x-x – (y-ỹ)|True value subtraction

Approximation subtraction= |x x (y ỹ)|= | є1 – є2 | ≤ |є1|+|є2| ≤ 1 + 2

13

Page 14: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Error PropagationError Propagation

(b) Relative error of multiplicationx = x+ є1 , y=ỹ+ є2 , |єr1|≤ r1 , |єr2| ≤ r2

|( ỹ)/ |єr = |(xy – xỹ)/xy|= |(xy – (x- є1)(y-є2))/xy|

|( )/ |= |(є1y+є2y-є1є2)/xy| ≈ |(є1y+є2x)/xy|

| / | | / | | | | | ≤ | є1/x |+ |є2 /y| = |єr1|+|єr2| ≤ r1 + r2

14

Page 15: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.1 Introduction

Error PropagationError PropagationTh 1 E P iTh 1 E P iTh.1 Error PropagationTh.1 Error Propagation

(a)In addition and subtraction, an error boundf th lt i i b th f thfor the results is given by the sum of the errorbounds for the terms(b)I lti li ti d di i i b d(b)In multiplication and division, an error boundfor the relative error of the results is given byh f h b d f h l i fthe sum of the bounds for the relative error of

the given numbers

15

Page 16: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19 2 Solution of 19.2 Solution of Equation by Iterationq o y o

16

Page 17: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

F(x) = 0

17

Page 18: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

F(x) = 0F(x) 0Zeros of Bessel function ?

18

Page 19: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19

Page 20: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Algebraic equationAlgebraic equationTranscendental equation

20

Page 21: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

F(x) = 0

No formula for exact solutionApproximation

Iteration method

21

Page 22: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Iteration methodIteration method

Initial guess x0step by step x1 x2 step by step x1 x2 …

Fi d i t it tiFixed point iterationNewton’s method

Secant method

22

Page 23: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Fixed-point iterationp

Transform f(x) 0 to x g(x)Transform f(x)=0 to x=g(x)Choose x0x1 =g(x0)x2 =g(x1)2 g( 1)…Xn+1 =g(xn)n+1 g n

23

Page 24: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex1. Fixed-point iterationp

Transform to x=g(x)

Converge

Diverge24

Page 25: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex1. Fixed-point iterationp

Divide by x

25

Page 26: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Indexing Indexing

Extract the index terms Extract the index terms Weights Data structure

26

Page 27: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Header fileEx. stdlib.h

27

Page 28: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Data typeData type

Int integerInt, integer

Long, long integer

Float, floating-point

Double, double precision floating point

28

Page 29: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Indexing Indexing

Extract the index terms Extract the index terms Weights Data structure

29

Page 30: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Indexing Indexing

Extract the index terms Extract the index terms Weights Data structure

30

Page 31: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

x0 =1 0x0 =1.0

31

Page 32: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

3 0x0 =3.0

(+,-)1.#INF, infinite numberNaN not a number =NaN, not a number =(+,-)1.#IND (indeterminate)

32

Page 33: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex1. Fixed-point iterationp

lower part, the slope of g1(x) is less than the slope of y=xof y x

upper part, the slope of g1(x) is steeper than the slope of y=x

|g1’(x)| < 1 is sufficient for convergence

1.0 3.0 33

Page 34: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

C f Fi d P i t 19.1 Introduction

Convergence of Fixed-Point IterationIteration

Th 1 CTh 1 CTh.1 ConvergenceTh.1 Convergence

Let x=s be a solution of x=g(x) and supposethat g has a continuous derivative in someinterval J containing s. Then if |g’(x)| ≤ K < 1 inJ, the iteration process defined by (3) convergesfor any x0 in J, and the limit of the sequence {xn}is s.

34

Page 35: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

C f Fi d P i t 19.2 Solution of Equation by Iteration

Convergence of Fixed-Point IterationIteration

|g’(x)|<1

SS

J35

Page 36: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Proof19.2 Solution of Equation by Iteration

Proof

|g’(x)|<1

SS

36

Page 37: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex1. Fixed-point iterationp

Transform to x=g(x)

| ’( )| |2 /3||g1’(x)| = |2x/3|<1-3/2 < x < 3/2 의 어떤 x0에서라도 수렴

37

Page 38: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex1. Fixed-point iterationp

Divide by x

|g1’(x)| = |1/x2|<1 1 1 의 어떤 에서라도 수렴-∞< x <-1, 1<x<∞ 의 어떤 x0에서라도 수렴

38

Page 39: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Iteration methodIteration method

Initial guess x0step by step x1 x2 step by step x1 x2 …

Fi d i t it tiFixed point iterationNewton’s method

Secant method

39

Page 40: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Newton’s Method

F(x)=0

Commonly usedSimplicity and great speedSimplicity and great speed

40

Page 41: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Newton’s Method

Idea

Tangent

41

Page 42: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Newton’s Method

42

Page 43: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Fail, Try another x0

Success

Fail, Try another x0, y 0

43

Page 44: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex3. Square Rootq

44

Page 45: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

45

Page 46: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

46

Page 47: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex4. Transcendental Equationq

47

Page 48: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

48

Page 49: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

49

Page 50: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex5. Algebraic Equationg q

50

Page 51: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

51

Page 52: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

52

Page 53: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Order of an Iteration methodSpeed of Convergence

53

Page 54: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Subtract g(s)=s

xn+1 – s = -g’(s) єn + 1/2 g’’(s) єn2 + …

є = g’(s) є + 1/2 g’’(s) є 2 + -єn+1 = -g (s) єn + 1/2 g (s) єn2 + …

єn+1 = g’(s) єn - 1/2 g’’(s) єn2 + …

(a) єn+1 ≈ g’(s) єn in the case of first order

(b) є +1 ≈ -1/2 g’’(s) є 2 in the case of second order(b) єn+1 ≈ 1/2 g (s) єn in the case of second order

Ex. єn=10-k, єn+1 = c*(10-k)2=c*10-2k

54

Page 55: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

C f N t ’ 19.2 Solution of Equation by Iteration

Convergence of Newton’s MethodMethod

єn+1 = g’(s) єn - 1/2 g’’(s) єn2 + …єn+1 g (s) єn 1/2 g (s) єn + …

єn+1 ≈ -1/2 g’’(s) єn2 , second order

if f’ and f’’ are not zero at a solution s

55

Page 56: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Taylor Series

미분가능한 어떤 함수를 다항식의 형태미분가능한 어떤 함수를 다항식의 형태로 근사화하는 방법

어떤 한 점에서 그것의 미분값으로 계산되는 항들의 무한 합으로 표현

56

Page 57: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Taylor SeriesTaylor Series

f(x) = c0+c1(x-a)+c2(x-a)2+c3(x-a)3+…(단, |x-a|<R 때 수렴)( | | )

x=a, f(a) = c0

f’(x) = c1+2c2(x-a)+3c3(x-a)2+…x=a, f’(a) = c1

f’’(x) = 2c2+3*2c3(x-a)+…x=a, f’’(a) = 2c2, f’’(a)/2 = c2

Cn =

f’’’(x) = 3*2c3+…x=a, f’’’(a) = c3, f’’’(a)/(3*2) = c3…

57

Page 58: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Taylor SeriesTaylor SeriesThe Taylor series of a real or complex function ƒ(x) y p ƒ( )that is infinitely differentiable in a neighborhood of a real or complex number a, is the power series

where n! denotes the factorial of n and ƒ (n)(a) denotes the nth derivative of ƒ evaluated at the point a; the zeroth derivative of ƒ is derivative of ƒ evaluated at the point a; the zeroth derivative of ƒ is defined to be ƒ itself and (x − a)0 and 0! are both defined to be 1.

In the particular case where a 0 the series is also In the particular case where a = 0, the series is also called a Maclaurin series.

58

Page 59: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

처음 몇 항까지를 선택함으로써 x = a 주변에서의 f(x)의 근사식으로 사용

The exponential function y = ex (continuous red line) and the corresponding Taylor polynomial of degree four (dashed green line) around the originline) around the origin.

59

Page 60: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

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

60

Page 61: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Iteration methodIteration method

Initial guess x0step by step x1 x2 step by step x1 x2 …

Fi d i t it tiFixed point iterationNewton’s method

Secant method

61

Page 62: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Secant Method

f’(x)

A far more difficult expressionComputationally expensiveComputationally expensive

62

Page 63: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Secant Method

초기치 2개 필요초기치 2개 필요

63

Page 64: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Ex8. Secant Method

64

Page 65: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Convergence of Secant Method

Evaluation of derivativesAvoided

Convergence Almost quadratic like NewtonAlmost quadratic like Newton

|є | ≈ const| є |1 62|єn+1| ≈ const| єn |1.62

65

Page 66: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.2 Solution of Equation by Iteration

Iteration methodIteration method

Initial guess x0step by step x1 x2 step by step x1 x2 …

Fi d i t it tiFixed point iterationNewton’s method

Secant method

66

Page 67: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

67

Page 68: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

approximate values approximate values of a function f(x) for an x

between different x-values x0,x1,…,xn

68

Page 69: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

69

Page 70: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Lagrange Interpolation

70

Page 71: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

y-f1=(f1-f0/x1-x0)(x-x1)

71

Page 72: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Lagrange Interpolationg g p

IdeaIdea

(x0,f0), (x1,f1)x=x0 P1(x)=f0x=x0, P1(x)=f0x=x1, P1(x)=f1

72

Page 73: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

(x0,f0), (x1, f1)x=x0, P1(x)=f0x=x1 P1(x)=f1x=x1, P1(x)=f1

P (x ) =f L +f L =f (L =1 L =0)P1(x0) =f0L0+f1L1 =f0 (L0=1, L1=0)P1(x1) =f0L0+f1L1 = f1 (L0=0, L1=1)

L0= (x-x1)/(x0-x1)L0= (x x1)/(x0 x1)L1= (x-x0)/(x1-x0)

73

Page 74: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

y-f1=(f1-f0/x1-x0)(x-x1)y=(f1-f0/x1-x0)(x-x1)+f1={(f1-f0)(x-x1)+f1(x1-x0)}/(x1-x0)={(-f0)(x-x1)+f1(x-x1)+f1(x1-x0)}/(x1-x0)={(-f0)(x-x1)+f1(x-x0)}/(x1-x0) =(-f0)(x-x1) /(x1-x0)+f1(x-x0) /(x1-x0)= f0(x-x1) /(x0-x1)+f1(x-x0) /(x1-x0)= f0L0+f1L1 74

Page 75: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Ex1. Linear Lagrange Interpolation

P1(x) =f0L0+f1L1 ,L = (x x )/(x x ) L = (x x )/(x x ) L0= (x-x1)/(x0-x1), L1= (x-x0)/(x1-x0)

75

Page 76: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

L0= (x-x1)(x-x2)/(x0-x1)(x0-x2)L0 (x x1)(x x2)/(x0 x1)(x0 x2)L1= (x-x0)(x-x2)/(x1-x0)(x0-x2)L2= (x-x0)(x-x1)/(x2-x0)(x2-x1)

76

Page 77: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Quadratic InterpolationQ p

three pointsthree points(x0,f0), (x1,f1), (x2,f2)

x=x0, P2(x)=f0x=x1 P2(x)=f1 x=x1, P2(x)=f1 x=x2, P2(x)=f2

77

Page 78: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

P2(x) =f0L0+f1L1+f2L2

(x0,f0), (x1,f1), (x2,f2)x=x (L =1 L =0 L =0) x=x0, (L0=1, L1=0, L2=0) x=x1, (L0=0, L1=1, L2=0) x=x2, (L0=0, L1=0, L2=1)

L0= (x-x1)(x-x2)/(x0-x1)(x0-x2)L ( )( )/( )( )L1= (x-x0)(x-x2)/(x1-x0)(x0-x2)L2= (x-x0)(x-x1)/(x2-x0)(x2-x1)2 ( 0)( 1)/( 2 0)( 2 1)

78

Page 79: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Ex2. Quadratic Lagrange Interpolation

79

Page 80: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

L ( )( )/( )( )L0= (x-x1)(x-x2)/(x0-x1)(x0-x2)L1= (x-x0)(x-x2)/(x1-x0)(x0-x2)L2= (x-x0)(x-x1)/(x2-x0)(x2-x1)

80

Page 81: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

L = (x x )(x x )/(x x )(x x )L0= (x-x1)(x-x2)/(x0-x1)(x0-x2)L1= (x-x0)(x-x2)/(x1-x0)(x0-x2)Code 작성Code 작성

81

Page 82: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

General Lagrange I t l ti P l i lInterpolation Polynomial

82

Page 83: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error Estimate

83

Page 84: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Ex3. Error Estimate of Linear Interpolation

9 0 ≤ t ≤ 9 59.0 ≤ t ≤ 9.5

84

Page 85: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Ex3. Error Estimate of Linear Interpolation

85

Page 86: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

Ex3. Error Estimate of Linear Interpolation

86

Page 87: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

InterpolationInterpolation

Linear Lagrange InterpolationQuadratic Lagrange Interpolation Quadratic Lagrange Interpolation General Lagrange Interpolation

Error Estimate

87

Page 88: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19 5 Numeric Integration 19.5 Numeric Integration & Differentiation

88

Page 89: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

N i l ti f Numeric evaluation of integralsintegrals

89

Page 90: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Rectangular Rule

middle point of 1-st subinterval

90

Page 91: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Trapezoidal Rule

91

Page 92: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.5 Numeric Integration

Ex1. Trapezoidal Rule

F(0)+f(1)

92

Page 93: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

93

Page 94: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

0.746824

94

Page 95: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

95

Page 96: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

0.746824

96

Page 97: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error Bounds and Estimate for Trapezoidal Rule

97

Page 98: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error Bounds and Estimate for Trapezoidal Rule

98

Page 99: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error Bounds and Estimate for Trapezoidal Rule

99

Page 100: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error Bounds and Estimate for Trapezoidal Rule

f

100

Page 101: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.5 Numeric Integration

Ex2. Error Estimation for Trapezoidal Rule

101

Page 102: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Simpson’s Rule Simpson s Rule of Integration

102

Page 103: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Piecewise constant approximation ppRectangular rule

Piecewise linear approximationTrapezoidal ruleTrapezoidal rule

Piecewise quadratic approximationSimpson’s rulep

103

Page 104: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Divide the intervali t binto even number

of equal subintervalsof equal subintervals

104

Page 105: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.5 Numeric Integration

105

Page 106: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

-h -2h h -h 2h h

106

Page 107: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.5 Numeric Integration

107

Page 108: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

108

Page 109: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error of Simpson’s Rule Error Bound

19.5 Numeric Integration

Error of Simpson s Rule, Error Bound, Degree of Precision

Because Simpson rule uses second order, if n=2, error ofSimpson rule has f(3) derivatives ((5) in pp.800 & (3*) in pp.819).B hi th bl i T l l i lBy approaching the problem using Taylor polynomial, we canderive the error involves the fourth derivative of f(4) .Simpson’s rule gives exact results when applied to anypolynomial of degree three or lesspolynomial of degree three or less.

109

Page 110: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error of Simpson’s Rule Error Bound

19.5 Numeric Integration

Error of Simpson s Rule, Error Bound, Degree of Precision

110

Page 111: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error of Simpson’s Rule Error Bound

19.5 Numeric Integration

Error of Simpson s Rule, Error Bound, Degree of Precision

111

Page 112: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Error of Simpson’s Rule Error Bound

19.5 Numeric Integration

Error of Simpson s Rule, Error Bound, Degree of Precision

• Newton–Cotes formulas are a group of formulas for numerical integration based on evaluating the integrand at equally-spaced points

Closed Newton-cotes formula, [a,b]Open Newton-cotes formula, (a,b)

112

Page 113: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Numeric Differentiation

113

Page 114: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Computation of values of derivative of f(x)

from a given value of f(x)from a given value of f(x)

114

Page 115: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Numeric differentiation should be avoided whenever possiblewhenever possible

115

Page 116: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

큰 값의 작은 차를큰 값의 작은 차를작은 양으로 나눈 것의 극한

약간의 부정확한 f(x) 값이라도약간의 부정확한 f(x) 값이라도f’(x)에 큰 영향을 줄 수 있음

116

Page 117: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.5 Numeric Differentiation

f(x )f(x1)f(x0)

x0 x1x1/2

h

117

Page 118: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.5 Numeric Differentiation

f(x) = x4

f’(1.5) = ?

f(x )f(x1)f(x0)

1.5x1/2

2.0x1

1.0x0

118

x1/2

h=1

x1 x0

Page 119: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

f’’(x ) ?

19.5 Numeric Differentiation

f’’(x1) = ?

119

Page 120: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

19.3 Interpolation

f(x) x4f(x) = x4

f’’(2) = ?

120

Page 121: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Lagrange polynomial Lagrange polynomial approximation, differentiation

P2(x) =f0L0+f1L1+f2L2-h -2h

L0= (x-x1)(x-x2)/(x0-x1)(x0-x2)L1= (x-x0)(x-x2)/(x1-x0)(x0-x2)L ( )( )/( )( )L2= (x-x0)(x-x1)/(x2-x0)(x2-x1)

121

Page 122: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Lagrange polynomial Lagrange polynomial approximation, differentiation

x=x0

x=x1

x=x2122

Page 123: Chapter 19 NumericsNumerics in General in Generalwebbuild.knu.ac.kr/~bykang/chapter19.pdf · 2009-11-20 · Chapter 19 NumericsNumerics in General in General Bo-Yeong Kang, 2009 Kyungpook

Numeric Integration gRectangular RuleTrapezoidal RuleTrapezoidal Rule

Simpson RuleError Estimate

DifferentiationDifferentiation

123