Professional Documents
Culture Documents
beberapa titik x yang diketahui/diberikan. y Metoda: - Lagrange Interpolation Polynomial - Newton Interpolation Polynomial - Spline Interpolation
y Persamaan Lagrange:
p1 (x)= L0(x).f(x0) + L1(x).f(x1) y x = x0 : p1 (x0)= f(x0) L0(x0)=1 dan L1(x0)=0. y x = x1 : p1 (x1) = f(x1) L0(x1)=0 dan L1(x1)=1.
x x1 L0 x
! x0 x1
y Persamaan Lagrange menjadi:
x x0 , L1 x ! x1 x0
x x1 x x0 p1 x ! . f x0 . f x1 x0 x1 x1 x0
menggunakan persamaan Lagrange orde-2: p1 (x)= L0(x).f(x0) + L1(x).f(x1) + L2(x).f(x2) y Pengali Lagrange:
x
. f x0
1 x
. f x1
... n x
. f xn
! k x
. f xk
k !0
y Pengali Lagrange:
l x x x1 x x2 ...x xn . ! 0 x ! l0 x0 x0 x1 x0 x2 x0 xn . ...
selisih antara nilai fungsi-x sebenarnya f(x) dengan nilai pendekatan pn(x).
en x ! f x pn x
metoda Lagrange Interpolation Polynomial, jika diketahui: x0=9,0; f(x0)=2,1972 x1=9,5; f(x1)=2,2513 x2=11,0; f(x2)=2,3979
Penaksiran nilai fungsi dari x=9,2 (ln(9,2)): y f(9,2) = 2.219203484054995 y p2(9,2) = 2.219163429636708 y e2(9,2) = 0,000040054418286
K urva K oefisien Lagrange 40 30 2.5 20 10 0 -10 -20 -30 -40 -50 1 1.5
p L(0)
p f(x)
p L(2)
2
p P (x)
0.5
p L(1)
-60 6 8 10 12 14 16 18 0 6 8 10 12 14 16 18
-Newton s Divided Difference Interpolation -- Newton s Forward Difference Formula -- Newton s Backward Difference Formula
y n=1: y n=2:
a2 ! ! !
a1 !
f1 p0 x
f1 f 0 ! ! f ?x0 , x1 A x1 x0
x1 x0
f 2 p1 x
a2 ! . x2 x0
x2 x1
f 2 f 0 x2 x0
f1 f 0 x1 x0
x1 x0
f 2 f 0
x2 x0
f1 f 0
! x2 x0
x2 x1
x2 x0
x2 x1
x1 x0
. . .
x1 x0 f 2 x1 x0 f1 x2 x1 f1 x2 x1 f 0 x1 x0 f 2 f1 x2 x1 f1 f 0 . . ! x2 x0 x2 x1 x1 x0 x2 x0 x2 x1 x1 x0 . . . . f 2 f1 f1 f 0 x x x1 x0 ! 2 1 Secara umum dituliskan: x2 x0 f ?x1 , x2 A f ?x0 , x1 A f ?x1 ,..., xk A f ?x0 ,..., xk 1 A ! ! f ?x0 , x1 , x2 A ak ! f ?x0 ,..., xk A! x2 x0
x2 f 0 x2 f1 x1 f 2 x1 f 0 x0 f 2 x0 f1 ?x0 f 0 x0 f 0 A x2 f 0 x2 f1 x1 f 2 x1 f 0 ?x1 f1 x1 f1 A x0 f 2 x0 f1 ! x2 x0 x2 x1 x1 x0 x2 x0 x2 x1 x1 x0 . . . .
f 2 f 0 x2 x0 f ?x0 , x1 A ! x2 x0 x2 x1 .
xk x0
f x } pn x ! f 0 x x0 f ?x0 , x1 A .
y Kesalahan:
en x ! f x pn x
metoda Newton s Devided Difference Interpolation, jika diketahui: x0=8,0; f(x0)=2,079442 x1=9,0; f(x1)=2,197225 x2=9,5; f(x2)=2,251292 x3=11,0; f(x3)=2,397895
Penaksiran nilai fungsi dari x=9,2 (ln(9,2)): y f(9,2) = 2.219203484054995 y p2(9,2) = 2.219163429636708 y e2(9,2) = 0,000040054418286
fj = fj+1 fj.
2f j
fj+1
fj.
(k f j ! (k 1 f j 1 (k 1 f j .
k ! 1,2,3,..., n
y y
f ?x0 , x1 A!
f1 f 0 1 1 ! f 1 f 0 ! (f 0 x1 x0 h h
f x } pn x ! f 0 x x0 f ?x0 , x1 A .
x x0
x xn1
f ?x0 ,..., xn A ... y Persamaan Newton beda maju (dg subsitusi ) diperoleh:
(f 0 (2 f 0 (n f 0 2 n h .r .r 1
... h .r .r 1
r n 1
f x
} p n x
! f 0 h.r . . ... . 2 2!.h h n!.h n
x x0 x x1 f ?x0 , x1 , x2 A ... . .
disederhanakan menjadi:
... r r 1
2 r r 1
r n 1
n f x
} pn x
! f 0 r.(f 0 .( f 0 ... .( f 0 2! n!
y Kesalahan:
en x ! f x pn x
metoda Newton s Forward Devided Difference Interpolation, jika diketahui: x0=0,5; f0=1,127626 x1=0,6; f1=1,185465 x2=0,7; f2=1,255169 x3=0,8; f3=1,337435
Penaksiran nilai fungsi dari x=0,56 (f(0,56)=cosh(0,56)): y f(0,56) = 1,160940782072458 y p2(0,56) = 1,160944839565795 y e2(0,56) = 0,000004057493336873108
fj-1.
= fj fj-1.
k ! 1,2,3,..., n
k f j ! k 1 f j k 1 f j 1
y y
f ?x1 , x0 A!
f 0 f 1 1 1 ! f 0 f 1 ! f 0 x0 x1 h h
f 0 f 1 f 1 f 2 1 f 0 f 1 2 f f ?x1 , x0 A f ?x 2 , x1 A x0 x1 x1 x 2 h 0 f ?x 2 , x1 , x0 A! ! ! ! 2 x0 x 2 2.h 2.h 2!.h
f ?x1 , x0 A f ?x 2 , x1 A f ?x2 , x1 A f ?x3 , x2 A x0 x 2 x1 x3 f ?x 2 , x1 , x0 A f ?x3 , x 2 , x1 A ! f ?x3 , x 2 , x1 , x0 A! x0 x 3 x0 x 3
f x } pn x ! f 0 x x0 f ?x0 , x1 A .
x x0
x xn1
f ?x0 ,..., xn A ... y Persamaan Newton beda maju (dg subsitusi ) diperoleh:
f0 2 f0 n f0 2 n h .r .r 1
... h .r .r 1
r n 1
f x
} p n x
! f 0 h.r . . ... . 2 2!.h h n!.h n
x x0 x x1 f ?x0 , x1 , x2 A ... . .
disederhanakan menjadi:
... r r 1
2 r r 1
r n 1
n f x
} pn x
! f 0 r.f 0 . f 0 ... . f 0 2! n!
y Kesalahan:
en x ! f x pn x
metoda Newton s Backward Devided Difference Interpolation, jika diketahui: x-3=0,5; f(x0)=1,127626 x-2=0,6; f(x0)=1,185465 x-1=0,7; f(x1)=1,255169 x0=0,8; f(x2)=1,337435
Penaksiran nilai fungsi dari x=0,56 (f(0,56)=cosh(0,56)): y f(0,56) = 1,160940782072458 y p2(0,56) = 1,160944839565795 y e2(0,56) = 0,000004057493336873108
Cubic Polynomial
x b, dimana partisi (1) diberikan, pada bagian partisi tersebut k0 dan kn merupakan dua bilangan yang diberikan. Kemudian hanya ada satu dan hanya satu cubic spline terhadap (1) dan memenuhi (2) dan (3).
y (1) a =x0 < x1 < ... < xn = b y (2) g(x0) = f(x0) = f0, g(x1) = f(x1) = f1,..., g(xn) = f(xn) = fn, y (3) g (x0) = k0,
g (xn) = kn.
y y y y
persamaan cubic polynomial orde rendah (max orde 3) untuk setiap selang/interval datanya. Jika diberikan n titik data, maka kurva dibentuk oleh n-1 persamaan cubic polynomial orde rendah. Setiap persamaan cubic polynomial memiliki koefisien yang berbeda-beda satu sama lain. Setiap persamaan cubic polynomial berlaku untuk interval: xi pj(x) xi+1. Semua persamaan cubic polynomial kontinu pada setiap titik batas interval persamaannya.
p j x
! f j
c j . x j 1
1 2c j . x j
x . x x
2 2 2 2 j 1 2 j j j j 2
? A A . 1 f x
c . x
? 2c . x
x x . k .c . x
x x
x k .c .x x
.x x
j 1 j j j 1 2 2 j 1 j j j 1
1 cj ! x j 1 x j
y Nilai konstanta h:
h ! x j 1 x j
y Nilai konstanta cj menjadi:
1 1 cj ! ! x j 1 x j h
2c j .x 3 4c j .x j 1 2c j .x j x 2 1 . y 2 2 p j x ! f j c j . 4c j .x j 1.x j 2c j .x j 1 2 x j 1 .x x . 2 2 x j 1 2c j .x j 1 .x j
2c j .x 3 4c j .x j 2c j .x j 1 x 2 1 . 2 2 x . f j 1 c j . 4c j .x j 1.x j 2c j .x j 2 x j .x 2 2 x j 2c j .x j 1.x j k j 1
k j .c j . x 3 x j 1 x j
x 2 x j 1 2 x j 1.x j .x x j 1 .x j 2 .
2 2 2 2 3 2 j j 1 j j 1.x j x j 2 j 1.x j 2
? x x .c .?
2 x x x . 2
x x .
A A
6c j .x 2 8c j .x j 1 4c j .x j x 2 . 2 . p j ' x ! f x j c j . 2 y 4c j .x j 1.x j 2c j .x j 1 2 x j 1
fungsi-x:
4 . k j .c j . 3x 2 x j 1 2 x j
x x j 1 2 x j 1.x j
2 2
6c j .x 2 8c j .x j 4c j .x j 1 x 1 . 2 x . f j 1 c j . 2 4c j .x j 1.x j 2c j .x j 2 x j
k j 1
? .c .? x x 3 2
2 2 j
j 1
. 2 4 x
x x
j
j 1
.x j x j
A A
pj
. 12 x
! f x j
c j 2 .? c j .x 2 8c j .x j 1 4c j .x j
A k j .c j
2
1 x . f j 1
c j . 12c j .x 8c j .x j 4c j .x j 1
2 j 1
? .? x x 6 4
A A
A 2x
k
j
j 1
.c j . 6 x x j 1 4 x j
2
2
pj
x
! 12c j 3 . f x j
12c j 3 . f x j 1
6c j 2 .k j 6c j 2 .k j 1
! 12c j . f x j
f x j 1
6c j . k j k j 1
3 2
interval: xj pj(x) xj+1: y Perlu ditinjau persamaan dan turunannya pada titik xj dan xj+1. y Lakukan dengan subsitusi nilai x xj dan x xj+1 dimana: j = 0, 1, 2, ..., n y Tinjau titik batas tersebut menggunakan persamaan: - pj(x) pj(xj) dan pj(xj+1) - pj (x) pj (xj) dan pj (xj+1) - pj (x) pj (xj) dan pj (xj+1) - pj (x) pj (xj) dan pj (xj+1)
= f(xj) = f j dan pj(xj+1) = f(xj+1) = f j+1 = kj dan pj (xj+1) = kj+1 = - 6cj2f(xj) + 6cj2f(xj+1) - 4cjkj 2cjkj+1 = 6cj2[f(xj+1) - f(xj)] - 2cj[2kj + kj+1] pj (xj+1) = 6cj2f(xj) - 6cj2f(xj+1) + 2cjkj + 4cjkj+1 = 6cj2[f(xj) - f(xj+1)] + 2cj[kj + 2kj+1] - pj (xj) = 12cj3[f(xj) - f(xj+1)] + 6cj2[kj + kj+1] = pj (xj+1)
turunan kedua dari persamaan cubic polynomial j-1 sama dengan turunan kedua dari persamaan cubic polynomial j di titik xj. Pj-1 (xj) = pj (xj) Pj-1 (xj) = 6cj-12[f(xj-1) - f(xj)] + 2cj-1[kj-1 + 2kj] pj (xj) = 6cj2[f(xj+1) - f(xj)] - 2cj[2kj + kj+1] Pj-1 (xj) = pj(xj) 6cj-12[f(xj-1)-f(xj)] + 2cj-1[kj-1+2kj]= 6cj2[f(xj+1)-f(xj)] - 2cj[2kj+kj+1] 3cj-12[f(xj-1)-f(xj)] + cj-1[kj-1+2kj]= 3cj2[f(xj+1)-f(xj)] - cj[2kj+kj+1] cj-1kj-1 + 2(cj-1+cj)kj + cjkj+1 = 3{cj-12[f(xj)-f(xj-1) ]+ cj2[f(xj+1)-f(xj)]}
f(xj) - f(xj-1) = f j dan f(xj+1) - f(xj) = f j+1 cj = 1/(xj+1 - xj) = 1/h dan cj-1 = 1/(xj xj-1) = 1/h
y Persamaan menjadi:
(1/h)kj-1 + (4/h)kj + (1/h)kj+1 = (3/h2)(f j + f j+1) kj-1 + 4kj + kj+1 = (3/h)(f j +f j+1) kj-1 + 4kj + kj+1 = (3/h)(f j+1 f j-1)
pj(x) = aj0 + aj1(x-xj) + aj2(x-xj)2 + aj3(x-xj)3 untuk: xj x xj+1 dimana: j= 0,1,2,...,n-1 Jika diketahui x: x0, x1, x2,...,xn maka akan ada : p0(x), p1(x), p2(x),..., pn-1(x)
pj(x) = aj0 + aj1(x-xj) + aj2(x-xj)2 + aj3(x-xj)3 pj(xj) = aj0 aj0 = pj(xj) = f j pj (x) = aj1 + 2aj2(x-xj) + 3aj3(x-xj)2 pj (xj) = aj1 aj1 = pj (xj) = kj pj (x) = 2aj2 + 6aj3(x-xj) pj (xj) = 2aj2 aj2 =(3/h2)(f j+1-f j) (1/h)(kj+1+2kj) pj (x) = 6aj3 aj3 =(2/h2)(f j-f j+1)+(1/h2)(kj+1+kj)
k0= f 0 dan kn = f n. y Tentukan koefisien persamaan cubic spline (aj0, aj1, aj2, aj3), untuk j=0,1,...,n-1 y Bentuk persamaan cubic splines:
p0 x
, p x
, 1 g x
! n 1 x
, p x0 e x e x1 x1 e x e x2 ... xn 1 e x e xn
maka akan ada n buah persamaan cubic spline (p0(x), pn-1(x)), bagaimana cara penyelesaiannya..? y Tujuan akhir dari metoda ini adalah mencari persamaan cubic spline yang terdiri dari persamaan cubic polynomial tiap partisinya:
p0 x , p x , 1 g x ! n 1 x , p
x0 e x e x1 x1 e x e x2 ... xn 1 e x e xn
x0, x1,...,xn; x0, x1,...,xn; f 0 dan f n. y Perhitungan dimulai dengan menentkan konstanta k: k0, k1,.., kn; untuk dua partisi (tiga titik data) dapat dilakukan dengan subsitusi langsung. Tetapi untuk >3data sebaiknya menggunakan aturan cramer (penyelesaian dengan operasi matrik). y k0=f 0 dan kn=f n.
j=0: k0 j=1: k0+4k1+k2 ... ... j=n-1: kn-2+4kn-1+kn j=n: kn y Susun dalam bentuk matrik:
1 1 0 0 0 0 4 1 1 4 0 0 f '0 0 k 0 3 0 k1 h f 2 f1
! 1 ... 3 f f
2 h 3 1 k n f 'n
1 1 0 0 k1 !
3 f 2 f1 h 3 f3 f 2 h f n 1 0 0 1 4 1 0 1 4 0 0 0
0 0 1 0 4 1 0 1 ; k ! 2 0 0 1 1
1 1 0 0
0 4 1 0 1 1 0 0
3 f 2 f1 h 3 f3 f2 h f n 0 0 0 4 1 0 1 4 1 0 0 1
0 0 1 1
Menentukan koefisien a dari po(x), p1(x),..pn-1(x): po(x): a00 = f0 a02 =(3/h2)(f1-f0) (1/h)(k1+2k0) a01 = k0 a03 =(2/h2)(f0-f1)+(1/h2)(k1+k0) p1(x): a10 = f1 a12 =(3/h2)(f2-f1) (1/h)(k2+2k1) a11 = k1 a13 =(2/h2)(f1-f2)+(1/h2)(k2+k1)
...
pn-1(x):
po(x)= a00 + a01 (x-x0) + a02 (x-x0)2+ a03 (x-x0)3 p1(x)= a10 + a11 (x-x1) + a12 (x-x1)2+ a13 (x-x1)3
...
Interpolasi-lah f(x)=x4 pada interval -1 x 1 dengan cubic spline g(x) terhadp partisi x0=-1, x1=0, x2=1 dan memenuhi kondisi g (-1) = f (-1), g (1)=f (1).
= -4 dan f 2 = 4 y Lebar interval: h=x1 - x0 = 0 (-1) = 1 y Jumlah partisi: n=2 p0(x) = a00 + a01(x-x0)+a02(x-x0)2+a03(x-x0)3 -1 x 0 p1(x) = a10 + a11(x-x1) + a12(x-x1)2 +a13(x-x1)3 0 x 1 y Konstanta k: k0 = f 0 = -4 dan k2 = f 2 = 4 k0+4k1+k2=(3/h)(f2 f0) =(3/1)(1-1)=0 -4 + 4k1 + 4 = 0 k1 = 0
y f
0
y Koefisien p0:
a00 =f0 = 1 a01 =k0 = -4 a02 = (3/h2)(f1-f0)-(1/h)(k1+2k0)=3.(0-1)-1.(0-8)=5 a03 = (2/h3)(f0-f1)+(1/h2)(k1+k0)=2.(1-0)+1.(0-4)=-2 y Koefisien p1: a10 =f1 = 0 a11 =k1 = 0 a12 = (3/h2)(f2-f1)-(1/h)(k2+2k1)=3.(1-0)-1.(4-0)=-1 a13 = (2/h3)(f1-f2)+(1/h2)(k2+k1)=2.(0-1)+1.(4+0)=2
I t p l t
p
S pl
C bc
ly
-1
-0.5
0.5
m l
1.5