We are now Linear Interpolation Page 3 Numerical

  • Slides: 47
Download presentation

We are now … Linear Interpolation 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법

We are now … Linear Interpolation 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법 뉴튼 다항식에 의한 보간법 Page 3 Numerical Analysis by Yang-Sae Moon

선형 보간법 개념 (2/2) Linear Interpolation 선형 보간법의 원리 g(x) f(a) g(a) f(xi+1) f(xi)

선형 보간법 개념 (2/2) Linear Interpolation 선형 보간법의 원리 g(x) f(a) g(a) f(xi+1) f(xi) f(x) xi a Xi+1 Page 5 Numerical Analysis by Yang-Sae Moon

선형 보간법 - 알고리즘 Linear Interpolation procedure linear_inter(x 1, x 2, y 1, y

선형 보간법 - 알고리즘 Linear Interpolation procedure linear_inter(x 1, x 2, y 1, y 2: real numbers, xm: real number) { (x 1, y 1) and (x 2, y 2) are the initial points. } { xm is the value that we want to get the f(x). } g(x) : = return g(xm); Page 6 Numerical Analysis by Yang-Sae Moon

선형 보간법 – 실행 결과 Linear Interpolation Page 8 Numerical Analysis by Yang-Sae Moon

선형 보간법 – 실행 결과 Linear Interpolation Page 8 Numerical Analysis by Yang-Sae Moon

We are now … Lagrange Interpolation 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법

We are now … Lagrange Interpolation 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법 뉴튼 다항식에 의한 보간법 Page 9 Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 - 알고리즘 Lagrange Interpolation procedure lagrange(x 0~xn, y 0~ yn: real numbers,

라그랑제 보간법 - 알고리즘 Lagrange Interpolation procedure lagrange(x 0~xn, y 0~ yn: real numbers, x: real number) { (xi, yi)’s are the given points. } { x is the value that we want to get the f(x). } y : = return y; Page 16 Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 – 프로그램 (2/3) Page 18 Lagrange Interpolation Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 – 프로그램 (2/3) Page 18 Lagrange Interpolation Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 – 프로그램 (3/3) Page 19 Lagrange Interpolation Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 – 프로그램 (3/3) Page 19 Lagrange Interpolation Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 – 실행 결과 (1/2) Lagrange Interpolation 입력 파일 실행 결과 (x =

라그랑제 보간법 – 실행 결과 (1/2) Lagrange Interpolation 입력 파일 실행 결과 (x = 1. 5) Page 20 Numerical Analysis by Yang-Sae Moon

라그랑제 보간법 – 실행 결과 (2/2) Lagrange Interpolation 실행 결과 (x = 2. 7)

라그랑제 보간법 – 실행 결과 (2/2) Lagrange Interpolation 실행 결과 (x = 2. 7) 실행 결과 (x = 3. 4) Page 21 Numerical Analysis by Yang-Sae Moon

We are now … Nevile Interpolation 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법

We are now … Nevile Interpolation 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법 뉴튼 다항식에 의한 보간법 Page 22 Numerical Analysis by Yang-Sae Moon

네빌레의 반복 보간법 – 알고리즘 (1/2) Nevile Interpolation procedure nevile(x 0~xn-1, y 0~ yn-1:

네빌레의 반복 보간법 – 알고리즘 (1/2) Nevile Interpolation procedure nevile(x 0~xn-1, y 0~ yn-1: real numbers, x: real number) { (xi, yi)’s are the given points. } { x is the value that we want to get the f(x). } for i : = 0 to n 1 {increment} begin gcur[0] = yi; // gxxx[0] = gi, gxxx[1] = gi-1, i, gxxx[2] = gi-2, i-1, I, … k : = 1; // gprev[i]: previous row, gcur[i]: current row for j : = i to 1 {decrement} begin gcur[i j+1] : = calc_product(gprev[i j], gcur[i j], xi, x(i-k), x); k : = k+1; end for j : = 0 to i gprev[j] = gcur[j]; end return y; Page 28 Numerical Analysis by Yang-Sae Moon

네빌레의 반복 보간법 – 알고리즘 (2/2) Nevile Interpolation procedure calc_product(gprev, gcur, xe, xs, x:

네빌레의 반복 보간법 – 알고리즘 (2/2) Nevile Interpolation procedure calc_product(gprev, gcur, xe, xs, x: real numbers) y : = return y; Page 29 Numerical Analysis by Yang-Sae Moon

네빌레의 반복 보간법 – 프로그램 (2/4) Page 31 Nevile Interpolation Numerical Analysis by Yang-Sae

네빌레의 반복 보간법 – 프로그램 (2/4) Page 31 Nevile Interpolation Numerical Analysis by Yang-Sae Moon

네빌레의 반복 보간법 – 프로그램 (3/4) Page 32 Nevile Interpolation Numerical Analysis by Yang-Sae

네빌레의 반복 보간법 – 프로그램 (3/4) Page 32 Nevile Interpolation Numerical Analysis by Yang-Sae Moon

네빌레의 반복 보간법 – 프로그램 (4/4) Page 33 Nevile Interpolation Numerical Analysis by Yang-Sae

네빌레의 반복 보간법 – 프로그램 (4/4) Page 33 Nevile Interpolation Numerical Analysis by Yang-Sae Moon

네빌레의 반복 보간법 – 실행 결과 Nevile Interpolation 입력 파일 실행 결과 (x =

네빌레의 반복 보간법 – 실행 결과 Nevile Interpolation 입력 파일 실행 결과 (x = 2. 7) Page 34 Numerical Analysis by Yang-Sae Moon

We are now … Interpolation on Newton Polynomials 선형 보간법 라그랑제 다항식 보간법 네빌레의

We are now … Interpolation on Newton Polynomials 선형 보간법 라그랑제 다항식 보간법 네빌레의 반복 보간법 뉴튼 다항식에 의한 보간법 Page 35 Numerical Analysis by Yang-Sae Moon

분할 차분법 개념 (3/4) Interpolation on Newton Polynomials 분할 차분 기호를 사용하여 Pn(x)를 다시

분할 차분법 개념 (3/4) Interpolation on Newton Polynomials 분할 차분 기호를 사용하여 Pn(x)를 다시 표현하면 다음과 같다. Page 39 Numerical Analysis by Yang-Sae Moon

분할 차분법 개념 (4/4) Interpolation on Newton Polynomials 차분 기호를 이용한 방정식 풀이를 위해

분할 차분법 개념 (4/4) Interpolation on Newton Polynomials 차분 기호를 이용한 방정식 풀이를 위해 차분표를 작성하면 다음과 같다. i xi f[xi] f[xi, xi+1, xi+2] f[xi, xi+1, xi+2, xi+3] 0 1 2 3 4 x 0 x 1 x 2 x 3 x 4 f[x 0] f[x 1] f[x 2] f[x 3] f[x 4] f[x 0, x 1] f[x 1, x 2] f[x 2, x 3] f[x 3, x 4] f[x 0, x 1, x 2] f[x 1, x 2, x 3] f[x 2, x 3, x 4] f[x 0, x 1, x 2, x 3] f[x 1, x 2, x 3, x 4] … … … Page 40 … … Numerical Analysis by Yang-Sae Moon

분할 차분법 – 알고리즘 Interpolation on Newton Polynomials procedure newton-diff(x 0~xn-1, y 0~ yn-1:

분할 차분법 – 알고리즘 Interpolation on Newton Polynomials procedure newton-diff(x 0~xn-1, y 0~ yn-1: real numbers, x: real number) { (xi, yi)’s are the given points. } { x is the value that we want to get the f(x). } for i : = 0 to n 1 fcur[i] : = fprev[i] : = yi; for i : = 1 to n 1 begin for j : = i to n 1 end fcur[j] : = (fprev[j] fprev[j 1])/(xj xj i); fprev[j] : = fcur[j]; y : = 0; t : = 1; for i : = 0 to n 1 begin y : = y + (fprev[i] t); t : = t (x xi); end return y; 교재에서는 2 -D Array를 사용하였으나, 실제로는 1 -D Array들로 해결이 가능하다. Page 41 Numerical Analysis by Yang-Sae Moon

분할 차분법 – 프로그램 (1/3) Interpolation on Newton Polynomials 주어진 문제: 다음 데이터를 참고로

분할 차분법 – 프로그램 (1/3) Interpolation on Newton Polynomials 주어진 문제: 다음 데이터를 참고로 하여, x = 3. 8일 때의 근사 함수 값을 뉴튼의 분할 차분법을 이용하여 구하시오. x f(x) 3. 0 1. 09861 3. 3 1. 19392 3. 5 1. 25276 3. 7 1. 30833 4. 0 1. 33500 Page 42 Numerical Analysis by Yang-Sae Moon

분할 차분법 – 프로그램 (2/3) Page 43 Interpolation on Newton Polynomials Numerical Analysis by

분할 차분법 – 프로그램 (2/3) Page 43 Interpolation on Newton Polynomials Numerical Analysis by Yang-Sae Moon

분할 차분법 – 프로그램 (3/3) Page 44 Interpolation on Newton Polynomials Numerical Analysis by

분할 차분법 – 프로그램 (3/3) Page 44 Interpolation on Newton Polynomials Numerical Analysis by Yang-Sae Moon

분할 차분법 – 실행 결과 Interpolation on Newton Polynomials 입력 파일 실행 결과 (x

분할 차분법 – 실행 결과 Interpolation on Newton Polynomials 입력 파일 실행 결과 (x = 3. 8) Page 45 Numerical Analysis by Yang-Sae Moon

Homework #4 Interpolation on Newton Polynomials Page 47 Numerical Analysis by Yang-Sae Moon

Homework #4 Interpolation on Newton Polynomials Page 47 Numerical Analysis by Yang-Sae Moon