Numerical Analysis Interpolation 22 Linear Interpolation gx fa

  • Slides: 47
Download presentation
수치해석 (Numerical Analysis) 보간법 (Interpolation)

수치해석 (Numerical Analysis) 보간법 (Interpolation)

선형 보간법 개념 (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

선형 보간법 - 알고리즘 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

선형 보간법 – 실행 결과 Linear Interpolation Page 8

선형 보간법 – 실행 결과 Linear Interpolation Page 8

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

라그랑제 보간법 - 알고리즘 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 Lagrange Interpolation

라그랑제 보간법 – 프로그램 (2/3) Page 18 Lagrange Interpolation

라그랑제 보간법 – 프로그램 (2/3) Page 18 Lagrange Interpolation

라그랑제 보간법 – 프로그램 (3/3) Page 19 Lagrange Interpolation

라그랑제 보간법 – 프로그램 (3/3) Page 19 Lagrange Interpolation

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

네빌레의 반복 보간법 – 알고리즘 (1/2) 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 Nevile Interpolation

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

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

네빌레의 반복 보간법 – 프로그램 (2/4) Page 31 Nevile Interpolation

네빌레의 반복 보간법 – 프로그램 (2/4) Page 31 Nevile Interpolation

네빌레의 반복 보간법 – 프로그램 (3/4) Page 32 Nevile Interpolation

네빌레의 반복 보간법 – 프로그램 (3/4) Page 32 Nevile Interpolation

네빌레의 반복 보간법 – 프로그램 (4/4) Page 33 Nevile Interpolation

네빌레의 반복 보간법 – 프로그램 (4/4) Page 33 Nevile Interpolation

분할 차분법 개념 (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 … …

분할 차분법 – 알고리즘 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

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

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

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

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

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

분할 차분법 – 실행 결과 Interpolation on Newton Polynomials 입력 파일 실행 결과 (x = 3. 8) Page 45

Homework #4 Interpolation on Newton Polynomials Page 47

Homework #4 Interpolation on Newton Polynomials Page 47