![Page 1: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/1.jpg)
17장 다항식 보간법
17.1 보간법의 소개
17.2 Newton 보간다항식
17.3 Lagrange 보간다항식
17.4 역보간법
17.5 외삽법과 진동
![Page 2: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/2.jpg)
Applied Numerical Methods 장 다항식 보간법
17장 다항식 보간법 (1/2)
White (1999) 보고에 의한 1기압에서 온도(T)에 따른 밀도 (ρ), 점성계수 (µ)와 동점성계수 (v)
T (°C) ρ (kg/m3) µ (N⋅s/m2) v (m2/s)
-4002050
100150200250300400500
1.521.291.201.090.9460.8350.7460.6750.6160.5250.457
1.51 × 10-5
1.71 × 10-5
1.80 × 10-5
1.95 × 10-5
2.17 × 10-5
2.38 × 10-5
2.57 × 10-5
2.75 × 10-5
2.93 × 10-5
3.25 × 10-5
3.55 × 10-5
0.99 × 10-5
1.33 × 10-5
1.50 × 10-5
1.79 × 10-5
2.30 × 10-5
2.85 × 10-5
3.45 × 10-5
4.08 × 10-5
4.75× 10-5
6.20 × 10-5
7.77 × 10-5
17
![Page 3: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/3.jpg)
Applied Numerical Methods 장 다항식 보간법
17장 다항식 보간법 (2/2)
어떻게 원하는 온도에서의 밀도, 점성계수,
그리고 동점성계수를 구할 수 있을까?
→가장 간단한 방법은 인접한 두 점을 잇는 직선을 구한 후,
그 직선 식을 이용하여 원하는 온도에서의 매개변수의
값을 얻는 것이다.
→"선형보간법" (많은 경우에 매우 적절함)이라고 알려진 방법
→데이터가 상당히 큰 곡률을 가지면 오차가 발생
→적절한 추정값을 얻을 수 있는 여러 방법을 검토
17
![Page 4: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/4.jpg)
Applied Numerical Methods 장 다항식 보간법
17.1 보간법의 소개 (1/4)
다항식 보간법
정확한 데이터 점들 사이에 위치한 값을 추정
n 개의 데이터 점을 지나는 유일한 (n – 1)차 다항
식으로 값을 추정
← 두 점을 지나는 유일한 직선 (1차 다항식)
← 세 점을 지나는 유일한 포물선 (2차 다항식)
12321)( −++++= n
n xaxaxaaxf
17
![Page 5: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/5.jpg)
Applied Numerical Methods 장 다항식 보간법
17.1 보간법의 소개 (2/4)
보간다항식의 예: (a) 두 점을 잇는 1차식, (b)세 점을 잇는 포물선, (c) 네 점을 잇는 3차식
17
![Page 6: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/6.jpg)
Applied Numerical Methods 장 다항식 보간법
17.1 보간법의 소개 (3/4)
유의사항: MATLAB은 다항식을 다음과 같이
내림차순으로 표현한다.
다항식 계수의 결정
n 개의 대수 방정식으로 n 개의 계수를 동시에 결정
→ 명료한 방법
nnnn pxpxpxpxf ++++= −−−
12
21
1)(
17
![Page 7: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/7.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.1 (1/3)
Q. 표 17.1의 아래쪽에 기재된 세 개의 밀도값을지나는 포물선 의 계수를 구하라.
풀이)
322
1)( pxpxpxf ++=
4570)( 5005250)( 4006160)( 300
33
22
11
.xfx.xfx.xfx
======
322
1
322
1
322
1
)500()500(4570
)400()400(5250
)300()300(6160
ppp.
ppp.
ppp.
++=
++=
++=
=
457.0525.0616.0
1500000,2501400000,1601300000,90
3
2
1
ppp
17
![Page 8: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/8.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.1 (2/3)
>> format long
>> A = [90000 300 1; 160000 400 1; 250000 500 1];
>> b = [0.616 0.525 0.457]';
>> p = A\b
p = 0.00000115000000
-0.00171500000000
1.02700000000000
17
![Page 9: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/9.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.1 (3/3)
따라서 2차 식은
350°C에서의 밀도를 계산하면
027.1001715.000000115.0)( 2 +−= xxxf
567625.0027.1)350(001715.0)350(00000115.0)350( 2 =+−=f
17
![Page 10: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/10.jpg)
Applied Numerical Methods 장 다항식 보간법
17.1 보간법의 소개 (4/4)
예제 15.1에 나타나는 계수행렬은 특정한 형태의 구조를 가진다.
→ Vandermonde matrix
매우 불량한 조건의 행렬
→ 반올림오차에 매우 민감
다른 방법으로 컴퓨터 실행에 적합한 Newton과 Lagrange다항식을 다룬다.
MATLAB 함수: polyfit과 polyval
데이터 점의 수 > 계수의 수 → 다항식 회귀분석데이터 점의 수 = 계수의 수 → 다항식 보간
=
)()()(
111
3
2
1
3
2
1
323
222
121
xfxfxf
ppp
xxxxxx
17
![Page 11: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/11.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (1/8)
선형보간법닮은꼴 삼각형에서
따라서 Newton 선형보간공식은다음과 같다.
여기서 f1(x) = 1차 보간다항식
간격이 작을수록 → 보다 나은 근사값
12
12
1
11 )()()()(xx
xfxfxx
xfxf−−
=−−
)()()()()( 112
1211 xx
xxxfxfxfxf −
−−
+=
선형보간법의 도식적 표현
17
![Page 12: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/12.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.2 (선형보간법)
Q. 선형보간법을 이용하여 자연로그 ln2의 값을 추정하라. 먼저 보간법으로 과 사이에서 추정하고, 그 다음에 더 작은 간격인 과 사이에서추정하라. 참고로 이다.
풀이) x1 = 1과 x2 = 6에 대하여
x1 = 1과 x2 = 4에 대하여
백분율 상대오차는 각각 48.3%와 33.3%이다.
01ln = 791759.16ln =1ln )386294.1(4ln =
6931472.02ln =
3583519.0)12(16
0791759.10)2(1 =−−
−+=f
4620981.0)12(14
0386294.10)2(1 =−−
−+=f
17
![Page 13: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/13.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (2/8)
2차 보간법세 개의 데이터 점
2차 다항식 = 포물선→ Taylor 급수전개와 유사함
→ 두 점 x1 과 x2를 잇는 직선의 기울기
→ 2차 곡률
→ 2차 도함수의 유한제차분근사와 매우 유사
식 (4.27) 참조
))(()()( 2131212 xxxxbxxbbxf −−+−+=
)( 11 xfb =
12
122
)()(xx
xfxfb−−
=
13
12
12
23
23
3
)()()()(
xxxx
xfxfxx
xfxf
b−
−−
−−−
=
17
![Page 14: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/14.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.3 (2차 보간법)
Q. 예제 17.2에 사용된 세 점과 2차 Newton 다항식을이용하여 ln2의 값을 추정하라.
풀이)
→추정 값이 갖는 백분율 상대오차는 18.4%이다.
1.791759)( 61.386294)( 40)( 1
33
22
11
======
xfxxfxxfx
01 =b 4620981.014
0386294.12 =
−−
=b
0518731.016
4620981.046
386294.1791759.1
3 −=−
−−−
=b
)4)(1(0518731.0)1(4620981.00)(2 −−−−+= xxxxf5658444.0)2(2 =f
17
![Page 15: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/15.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (3/8)
Newton 보간다항식의 일반적인 형태
n 개의 데이터 점에 (n – 1)차 다항식을
접합시키는 것으로 일반화할 수 있다.
n 개의 데이터 점 을
이용하여 계수 을 계산한다.
)())(()()( 1211211 −− −−−++−+= nnn xxxxxxbxxbbxf
)](,[,)],(,[)],(,[ 2211 nn xfxxfxxfx
nbbb ,,, 21
],,,,[
],,[],[
)(
121
1233
122
11
xxxxfb
xxxfbxxfb
xfb
nnn
−=
===
17
![Page 16: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/16.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (4/8)
여기서 괄호로 표시된 함수는 유한제차분을 나타낸다.
1차 유한제차분
2차 유한제차분
(n-1)차 유한제차분
다음과 같은 일반적인 Newton 보간다항식을 얻을 수 있다.
ji
jiji xx
xfxfxxf
−
−=
)()(],[
ki
kjjikji xx
xxfxxfxxxf
−
−=
],[],[],,[
1
12121121
],,,[],,,[],,,,[xx
xxxfxxxfxxxxfn
nnnnnn −
−= −−−
−
],,,,[)())((],,[))((],[)()()(
121121
1232112111
xxxxfxxxxxxxxxfxxxxxxfxxxfxf
nnn
n
−−
−
−−−++−−+−+=
17
![Page 17: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/17.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (5/8)
데이터 점들이 등간격일 필요가 없고, 수평축의 좌표값이
올림차순일 필요도 없다.
고차 차분이 저차 차분의 차이에 의해 계산되어지는
순환적인 시스템이다.
17
![Page 18: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/18.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.4 (Newton 보간다항식) (1/3)
Q. 3차 Newton 보간다항식으로 ln2의 값을 추정하라. 사용되는 네 개의 데이터 점은 x1 = 1, x2 = 4, x3 =
6, 그리고 x4 = 5, [f(x4) = 1.609438]이다.
풀이)
1차 제차분을 계산하면
))()(())(()()( 32142131213 xxxxxxbxxxxbxxbbxf −−−+−−+−+=
4620981.014
0386294.1],[ 12 =−
−=xxf
2027326.046
386294.1791759.1],[ 23 =−−
=xxf
1823216.065
791759.1609438.1],[ 34 =−−
=xxf
17
![Page 19: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/19.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.4 (Newton 보간다항식) (2/3)
2차 제차분을 계산하면
3차 제차분을 계산하면
05187311.016
4620981.02027326.0],,[ 123 −=−−
=xxxf
02041100.045
2027326.01823216.0],,[ 234 −=−−
=xxxf
007865529.015
)05187311.0(02041100.0],,,[ 1234 =−−−−
=xxxxf
17
![Page 20: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/20.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.4 (Newton 보간다항식) (3/3)
그러므로 제차분표를 구성하면 다음과 같다.
→
xi f(xi) First Second Third
1465
01.3862941.7917591.609438
0.46209810.20273260.1823216
-0.05187311-0.02041100
0.007865529
)6)(4)(1(007865529.0 )4)(1(05187311.0)1(4620981.00)(3
−−−+−−−−+=
xxxxxxxf
6287686.0)2(3 =f
17
![Page 21: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/21.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (6/8)
[Newton 보간다항식을 실행하는 M-파일]
function yint = Newint(x,y,xx)
% Newint(x,y,xx)
% Newton interpolation uses an (n-1)-order Newtoninterpolating
% polynomial based on n data points (x,y) to determine yint atxx.
% input
% x = independent variable
% y = dependent variable
% xx = value of independent variable for interpolation
% output
% yint = interpolated value of dependent variable
17
![Page 22: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/22.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (6/8)
[Newton 보간다항식을 실행하는 M-파일]
% compute a difference table
n = length(x);
if length(y) ~=n, error ('x and y must be same length'); end
b = zeros(n,n);
% assign dependent variables to the first column of b
b(:,1) = y(:); % (:) ensures that y is a column vector
for j = 2:n
for i=1:n-j+1
b(i,j) = (b(i+1,j-1)-b(i,j-1))/(x(i+j-1)-x(i));
end
end
17
![Page 23: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/23.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (6/8)
[Newton 보간다항식을 실행하는 M-파일]
% use the finite divided differences to interpolate
xt = 1;
yint = b(1,1);
for j = 1:n-1
xt = xt.*(xx-x(j));
yint = yint + b(1,j+1)*xt;
end
17
![Page 24: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/24.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (7/8)
>> format long
>> x =[1 4 6 5]';
>> y = log(x);
>> Newint(x,y,2) % ln 2의 값을 추정
ans =
0.62876857890841
17
![Page 25: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/25.jpg)
Applied Numerical Methods 장 다항식 보간법
17.2 Newton 보간다항식 (8/8)
>> xx=[1 2 3 4 5 6]'; % 6개 점에서의 값을 추정
>> format short
>> Newint(x,y,xx)
ans =
0
0.6288
1.0751
1.3863
1.6094
1.7918
>> Newint(x,y,2) % ln 2의 값을 추정
ans =
0.6288
17
![Page 26: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/26.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (1/6)
직선으로 연결하고자 하는 두 값의 가중평균으로선형 보간다항식을 만들어 보자.
여기서 L은 직선에 대한 가중계수이다.L1은 x1에서 1이며, x2에서는 0이다.→
L2는 x2에서 1이며, x1에서는 0이다.→
따라서
:선형 Lagrange 보간다항식
)()()( 2211 xfLxfLxf +=
21
21 xx
xxL−−
=
12
12 xx
xxL−−
=
)()()( 212
11
21
21 xf
xxxxxf
xxxxxf
−−
+−−
=
17
![Page 27: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/27.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (2/6)
Lagrange 보간다항식의 근본 원리에 대한 시각적 표현으로 1차식의 경우를나타낸다. 두 항의 합은 두 점을 연결하는 유일한 직선이다.
17
![Page 28: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/28.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (3/6)
세 점에 대해 확장 → 2차 Lagrange 보간다항식
각 포물선은 세 점 중 한 점을 지나고 나머지 점에서는
0이다.
세 포물선의 합은 세 점을 지나는 유일한 포물선이다.
)())((
))(()(
))(())((
)())((
))(()( 3
2313
212
3212
311
3121
322 xf
xxxxxxxxxf
xxxxxxxx
xfxxxx
xxxxxf
−−−−
+−−−−
+−−−−
=
17
![Page 29: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/29.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (4/6)
고차 Lagrange 다항식으로 일반화하면
여기서
n = 데이터 점의 수
∑=
− =n
iiin xfxLxf
11 )()()(
∏≠= −
−=
n
ijj ji
ji xx
xxxL
1)(
17
![Page 30: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/30.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.5 (Lagrange 보간다항식)
Q. 다음에 주어지는 데이터를 사용하여 1차와 2차 Lagrange 보간다항식으로 T = 15 °C 에서의 모터오일의 밀도를 계산하라.
풀이) 1차 Lagrange 다항식:
2차 Lagrange 다항식:
212.0)( 40800.0)( 2085.3)( 0
33
22
11
======
xfxxfxxfx
5625.1800.002001585.3
2002015)(1 =
−−
+−−
=xf
3316875.1212.0)2040)(040()2015)(015(
800.0)4020)(020()4015)(015(85.3
)400)(200()4015)(2015()(2
=−−−−
+
−−−−
+−−−−
=xf
17
![Page 31: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/31.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (5/6)
[Lagrange 보간다항식을 실행하는 M-파일]
function yint = Lagrange(x,y,xx)
% Lagrange(x,y,xx)
% Lagrange interpolation uses an (n-1)-order Lagrange interpolating
% polynomial based on n data points (x,y) to determine yint at xx.
% input
% x = independent variable
% y = dependent variable
% xx = value of independent variable for interpolation
% output
% yint = interpolated value of dependent variable
17
![Page 32: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/32.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (5/6)
[Lagrange 보간다항식을 실행하는 M-파일]
n = length(x);
if length(y) ~=n, error ('x and y must be same length'); end
s = 0;
for i = 1:n
product = y(i);
for j = 1:n
if i ~= j
product = product * (xx-x(j))/(x(i)-x(j));
end
end
s = s + product;
end
yint = s;
17
![Page 33: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/33.jpg)
Applied Numerical Methods 장 다항식 보간법
17.3 Lagrange 보간다항식 (6/6)
>> format long;
T = [-40 0 20 50]';
d = [1.52 1.29 1.2 1.09]';
density = Lagrange(T,d,15)
density =
1.22112847222222
17
![Page 34: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/34.jpg)
Applied Numerical Methods 장 다항식 보간법
17.4 역보간법 (1/2)
주어진 자료를 이용하여 f(x) = 0.3에 해당되는 x값은 어떻게 구하는가?
→ f(x) = 1/x ∴ x = 1/0.3 = 0.3333
→ 역보간법: 주어진 f(x)의 값에 해당하는 x값을 구하는 문제
→ 수평축이 부등간격이 됨(많은 점들이 촘촘히 위치하고 몇 개가 동떨어짐)
→ 진동현상을 초래할 위험이 큼! (다항식 접합에 불량 조건을 갖는 경우)
x 1 2 3 4 5 6 7f(x) 1 0.5 0.3333 0.25 0.2 0.1667 0.1429
f(x) →새로운 x 0.1429 0.1667 0.2 0.25 0.3333 0.5 1x →새로운 f(x) 7 6 5 4 3 2 1
17
![Page 35: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/35.jpg)
Applied Numerical Methods 장 다항식 보간법
17.4 역보간법 (2/2)
극복하는 다른 방법
- 일반적으로 등간격으로 주어지는 x에 대해구해진 다항식 fn(x)을 이용
→ 근을 구하는 문제(5장 또는 6장 참조)
세 점 (2, 0.5), (3, 0.3333), 그리고 (4, 0.25)에 대해2차 보간다항식은 다음과 같으므로
→
→
(참고로 정해는 3.333)
08333.1375.0041667.0)( 22 +−= xxxf
08333.1375.0041667.03.0 2 +−= xx
295842.3704158.5
)041667.0(278333.0)041667.0(4)375.0(375.0 2
=−−±
=x
17
![Page 36: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/36.jpg)
Applied Numerical Methods 장 다항식 보간법
17.5 외삽법과 진동 (1/2)
외삽법주어진 기본 점들의 밖에 위치한 x에 대해 f(x)의 값을 추정하는 과정이다.
실제 곡선은 예측값으로부터 쉽게 벗어날 수 있으므로,
외삽을 수행할 경우 매우 주의하여야 한다.
외삽법을 이용한예측이 발산하는경우의 예시
17
![Page 37: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/37.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.6 (외삽법의 위험성) (1/3)
Q. 다음 표는 1920년부터 2000년까지의 미국의 인구를 백만 명
단위로 나타낸 것이다.
처음 8개의 점(1920년에서 1990년까지)에 대하여 7차 다항식을
접합시켜라. 이 다항식과 외삽법을 이용하여 2000년의 인구를
예측하고 실제 값과 비교하라.
년도 1920 1930 1940 1950 1960 1970 1980 1990 2000
인구 106.46 123.08 132.12 152.27 180.67 205.05 227.23 249.46 281.42
17
![Page 38: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/38.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.6 (외삽법의 위험성) (2/3)
>> t = [1920:10:1990];
>> pop = [106.46 123.08 132.12 152.27 180.67 205.05 227.23 249.46];
>> p = polyfit(t, pop, 7);
Warning: Polynomial is badly conditioned. Remove repeated data points
or try centering and scaling as described in HELP POLYFIT.
17
![Page 39: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/39.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.6 (외삽법의 위험성) (3/3)
>> ts = (t-1955)/35;
>> p = polyfit(ts, pop, 7)
p =
Columns 1 through 8
-61.9393 -32.9356 147.0977 38.1565 -115.3518 6.4156 101.6934 166.3235
>> p2000 = polyval(p, (2000-1955)/35)
p2000 =
175.0800
>> tt=linspace(1920,2000);
>> pp = polyval(p, (tt-1955)/35);
>> plot(t,pop,'o',tt,pp)
17
![Page 40: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/40.jpg)
Applied Numerical Methods 장 다항식 보간법
17.5 외삽법과 진동 (2/2)
진동
"더 많으면 더 좋은가"?
→ 다항식 보간법에서는 절대로 그렇지 않다.
→ 고차 다항식은 반올림오차에 민감 하여매우 불량한 조건이 되기 쉽다.
17
![Page 41: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/41.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.7 (고차 다항식보간법의 위험성) (1/3)
Q. 1901년에 Carl Runge는 아래의 간단한 함수로 고차 다항식보간법의
위험성을 보였다.
이 함수는 Runge 함수라고 불린다. 구간 [-1, 1]에서 등간격으로 5개와
11개로 데이터가 주어질 때 polyfit 함수와 polyval 함수를 사용하여
4차와 10차 다항식으로 접합시켜 예측한 값을 실제 값과 그림으로
비교하라.
22511)(
xxf
+=
17
![Page 42: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/42.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.7 (고차 다항식보간법의 위험성) (2/3)
>> x = linspace(-1,1,5); y = 1./(1+25*x.^2);
xx = linspace(-1,1);
>> p = polyfit(x,y,4); y4 = polyval(p,xx);
yr = 1./(1+25*xx.^2);
plot(x,y,'o',xx,y4,xx,yr,'--') % 4차 보간다항식 결과 그래프
>> x = linspace(-1,1,11); y = 1./(1+25*x.^2);
p = polyfit(x,y,10); y10 = polyval(p,xx);
plot(x,y,'o',xx,y10,xx,yr,'--') % 10차 보간다항식 결과 그래프
17
![Page 43: 17장다항식보간법 - Pusan National Universitybml.pusan.ac.kr/.../NumAnalysis/17_PolyInterpolation.pdf · 2016-03-15 · % Newton interpolation uses an (n-1)-order Newton interpolating](https://reader033.vdocuments.pub/reader033/viewer/2022053017/5f1a0cf6da663145bf4c8a67/html5/thumbnails/43.jpg)
Applied Numerical Methods 장 다항식 보간법
예제 17.7 (고차 다항식보간법의 위험성) (3/3)
접합은 특히 구간의 양 끝 에서 더욱 나빠지게 된다.
고차 다항식이 필요한 상황도 있지만 보통의 경우에는 고차다항식의 사용을 피해야 한다. 대부분의 공학과 과학 문제에서 이 장에서 설명한 형태의 저차 다항식은 데이터의 곡선 형상을 진동 없이 표현하는데 효과적으로 사용할 수 있다.
17