Pendahuluan
2
pn ( x) a0 a1 x a2 x 2 ... an x n
Pendahuluan (Cont.)
3
X X
Regresi Interpolasi
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Regresi
4
Regresi (Cont.)
5
Regresi Linier
6
i 1
Agar R minimum, maka haruslah :
dan
R 2 yi a bxi 0 R
b
2 xi yi a bxi 0
a
Kedua persamaan dibagi -2, menjadi :
n n n n
y
i 1
i a bxi 0 yi a bxi 0
i 1 i 1 i 1
n n n
Selanjutnya :
n n
na b xi yi
n n n
a bx y
i 1 i 1
i
i 1
i atau
i 1 i 1
n n n
a xi b xi xi yi
n n n
ax bx xi yi
2 2
i i
i 1 i 1 i 1 i 1 i 1 i 1
i
b i 1 i 1 i 1
n x i a y 2
i 1 Solusinya :
n
n
n i 1
n xi xi
2
2 i 1
n n
x xi b xi yi
i 1
i 1
i
i 1
i 1 a y bx
Contoh :
9
Setiap biaya promosi (x) yang dikeluarkan oleh suatu perusahaan akan selalu
berpengaruh terhadap keuntungan (y) pada tiap tahun. Dari data suatu perusahaan
tertentu diperoleh data dalam jutaan rupiah sebagai berikut :
1 1,5 3,6
2 1,0 2,8
3 2,0 4,3
4 2,8 5,4
5 0,4 1,9
6 1,3 2,9
Tentukanlah :
i. Persamaan garis regresinya
ii. Berapa keuntungan yang diperkirakan jika biaya promosi 10 Juta
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Solusi :
Pertama kita tentukan variabel bebas (x) dan variabel takbebasnya (y). Dari data
tersebut kita dapat menentukan variabel bebasnya (x) adalah biaya promosi sedangan
variabel tak bebasnya (y) adalah keuntungan. Buat tabel untuk menghitung nilai b dan a
x y x.y x2
1,5 3,6 5,4 2,25
1,0 2,8 2,8 1,00
2,0 4,3 8,6 4,00
2,8 5,4 15,12 7,84
0,4 1,9 0,76 0,16
1,3 2,9 3,77 1,69
∑x = 9 ∑y = 20,9 ∑xy = 36,45 ∑ x 2 = 16,94
Solusi :
11
n xy x y.
b =
n x 2 ( x ) 2
Regresi Kuadratik
12
i 1
Agar R minimum, maka haruslah :
x ( y a bx cx ) x y ax bx cx
i i i
2
i i i i
2
i
3
i
x ( y a bx cx ) x y ax bx cx
2
i i i
2
i
2
i i
2
i
3
i
4
i
a bx cx y
i
2
i i
ax bx cx x y
i
2
i
3
i i i
ax bx cx x y
2
i
3
i
4
i
2
i i
n
x x i
2
i
a yi
xi x x i i
2 3
i i b x y
xi2 x x3 4 c xi2 yi
i i
Soal Kuadratik
Nomor Pasangan
Hasil Gabah (kg/ha) N (kg/ha)
Y X 𝑋2 𝑋3 𝑋4 X.Y 𝑋 2 .Y
1 4,878 0 0
2 5,506 30 900
3 6,083 60 3.600
4 6,291 90 8.100
5 6,361 120 14.400
Soal Kuadratik
Soal Kuadratik
X y = 12.503x + 5073.6
7,000
6,000
y = -0.1179x2 + 26.646x + 4861.5
5,000
Gabah (kg/Ha)
4,000
X
3,000 Linear (X)
Poly. (X)
2,000
1,000
-
0 20 40 60 80 100 120 140
N (kg/Ha)
Soal Kuadratik
Y X X2 X3 X4 X.Y X2.Y
4.878 0 0 0 0 0 0
5.506 30 900 27000 810000 165.18 4955.4
6.083 60 3600 216000 12960000 364.98 21898.8
6.291 90 8100 729000 65610000 566.19 50957.1
6.361 120 14400 1728000 207360000 763.32 91598.4
Soal Kuadratik
Linearisasi
20
C e a e1.8515 6.369366
Jadi kurva yang dipakai :
y 6.369366 x 0.1981
Y a bX C e a e a .......
Jadi kurva yang dipakai :
y Cebx
INTERPOLASI
23
Contoh :
x 5 10 15 20 25 30 35
y 40 30 25 40 18 20 22
25
x x0 x1 x2 ……. xn
Jenis Interpolasi
28
Interpolasi Linier
Interpolasi Kuadrat
Interpolasi Lagrange
Interpolasi Newton
f(x)
L(x)
x0 x1 x
L(x)
f(x)
x0 h x1 h x2 x
Interpolasi Qubic
31
L(x) f(x)
x0 h x1 h x2 h x3 x
? y*
yk
xk x* xk+1 x
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
yk+1
? y*
yk
xk x* xk+1 x
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Contoh – 1 : (1)
35
Contoh – 1 : (2)
36
Alternatif 2 :
x = 6,5 terletak antara x=1 & x=7
x xk
y yk ( yk 1 yk )
xk 1 xk
(6,5 1) (5,5)
y 1 (49 1) 1 (48) 45
(7 1) (6)
Hasilnya
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Contoh – 1 : (3)
37
x -3 -2 -1 0 1 2 3 4 5 6 7
y 9 4 1 0 1 4 9 16 25 36 49
sesungguhnya ..??
Karena hub. x & y adalah y = x2 maka untuk harga x =
Contoh – 1 : (4)
38
Sedangkan untuk
y = 45 |45 – 42,25| = 3,25 = 325 %
Contoh :
40
Contoh :
41
L(x)
f(x)
x0 h x1 h x2 x
INTERPOLASI KUADRAT
43
P(x) = a0 + a1 x + a2 x2 …..(*)
3 titik (xk-1,yk-1), (xk,yk) & (xk+1,yk+1) dilalui fgs. P(x) berarti:
yk-1 = a0 + a1 xk-1 + a2 xk-12
yk = a0 + a1 xk + a2 xk2 …………………………. (**)
Contoh 3:
45
Solusi
46
1600𝑎 + 40𝑏 + 𝑐 = 65
𝑎 = −0,02, b = 4,3, c = −75
2500𝑎 + 50𝑏 + 𝑐 = 90
𝑦 = −0,02. 𝑥 2 + 4,3. 𝑥 − 75
3600𝑎 + 60𝑏 + 𝑐 = 111
Contoh :
47
INTERPOLASI LAGRANGE
48
Contoh 1:
50
Contoh Soal
Polinom Newton
Polinom Lagrange kurang disukai dalam praktek karena :
Jumlah komputasi yang dibutuhkan untuk satu kali interpolasi
adalah besar. Interpolasi untuk nilai x yang lain memerlukan jumlah
komputasi yang sama karena tidak ada bagian komputasi
sebelumnya yang dapat digunakan.
Bila jumlah titik data meningkat atau menurun, hasil komputasi
sebelumnya tidak dapat digunakan. Karena tidak ada hubungannya
antara pn-1(x) dan pn(x) pada polinom Lagrange
Polinom yang dibentuk sebelumnya dapat digunakan untuk
membentuk polinom derajat yang lebih tinggi.
Polinom Newton
Persamaan Polinom Linier
( y1 y0 )
p1 ( x) y 0 ( x x0 )
( x1 x0 )
Bentuk pers ini dapat ditulis :
p1 ( x) a0 a1 ( x x0 )
Yang dalam hal ini (1)
a 0 y 0 f ( x0 )
( y1 y0 ) f ( x1 ) f ( x0 )
Dan a1 (2)
( x1 x0 ) ( x1 x0 )
Pers ini mrpk bentuk selisih terbagi (divided-difference)
a1 f [ x1 , x0 ]
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Polinom Newton
Polinom kuadratik p2 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 )
Atau p2 ( x) p1 ( x) a2 ( x x0 )( x x1 )
Dari pers ini menunjukkan bahwa p2(x) dapat dibentuk dari pers
sebelumnya p1(x). Nilai a2 dapat ditemukan dengan mengganti x=x2
untuk mendapatkan f ( x ) a a ( x x ) (3)
a2 2 0 1 2 0
( x2 x0 )( x2 x1 )
Nilai a0 dan a1 pada pers 1 dan 2 dimasukkan pada pers 3
f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 )
x2 x1 x1 x0
a2
x2 x0
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Polinom Newton
Polinom Newton
Jadi tahapan pembentukan polinom Newton :
p1 ( x) p0 ( x) a1 ( x x0 )
p1 ( x) a0 a1 ( x x0 )
p2 ( x) p1 ( x) a2 ( x x0 )( x x1 )
p2 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 )
p3 ( x) p 2 ( x) a3 ( x x0 )( x x1 )( x x2 )
p3 ( x) a0 a1 ( x x0 ) a2 ( x x0 )( x x1 ) a3 ( x x0 )( x x1 )( x x2 )
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Polinom Newton
Nilai konstanta a0, a1, a2,…, an, merupakan nilai selisih terbagi , dg nilai
a0 f ( x0 )
a1 f [ x1 , x0 ]
a 2 f [ x 2 , x1 , x0 ]
Yang dalam hal ini a n f [ x n , x n 1 ,..., x1 , x0 ]
f ( xi ) f ( x j )
f [ xi , x j ]
xi x j
f [ xi , x j ] f [ x j , x k ]
f [ xi , x j , x k ]
xi x k
f [ x n , x n 1 ,..., x1 ] f [ x n 1 , x n 2 ,..., x1 , x0 )
f [ x n , x n 1 ,..., x1 , x0 ]
x n x0
Integrating academic excellence and humanistic values
Universitas Sanata Dharma
Polinom Newton
Dengan demikian polinom Newton dapat ditulis
dalam hub rekursif sebagai :
Rekurens
pn ( x) pn1 ( x) ( x x0 )( x x1 )...( x xn1 ) f [ xn , xn1 ,..., x1 , x0 ]
basis p0 ( x) f ( x0 )
Atau dalam bentuk polinom yang lengkap sbb :
p n ( x) f ( x0 ) ( x x0 ) f [ x1 , x0 ] ( x x0 )( x x1 ) f [ x2 , x1 , x0 ]
( x x0 )( x x1 )...( x xn1 ) f [ xn , xn 1 ,..., x1 , x0 ]
Contoh Soal :
Bentuklah polinom Newton derajat satu, dua, tiga dan empat yang
menghampiri f(x)=cos(x) dalam range[0.0, 4] dan jarak antar titik
adalah 1.0. Lalu taksirlah f(x) dengan x=2.5 dengan Polinom Newton
derajat 3.
Solusi:
Contoh cara menghitung nilai selisih terbagi
pada tabel :
f ( x1 ) f ( x0 ) 0.5403 1
f [ x1 , x0 ] 0.4597
( x1 x0 ) 1 0
f ( x2 ) f ( x1 ) 0.4161 0.5403
f [ x2 , x1 ] 0.9564
( x2 x1 ) 2 1
f ( x3 ) f ( x2 ) 0.99 0.4161
f [ x3 , x2 ] 0.5739
( x3 x2 ) 3 2
f [ x2 , x1 ] f [ x1 , x0 ] 0.9564 0.4597
f [ x2 , x1 , x0 ] 0.2484
( x2 x0 ) 20
f [ x3 , x2 ] f [ x2 , x1 ] 0.5739 0.9564
f [ x3 , x2 , x1 ] 0.1913
( x3 x1 ) 3 1
f [ x3 , x2 , x1 ] f [ x2 , x1 , x0 ] 0.1913 0.2484
f [ x3 , x2 , x1 , x0 ] 0.1466
( x3 x0 ) 30
Contoh Soal :
Bentuklah polinom Newton derajat satu, dua, tiga dan empat yang
menghampiri f(x)=cos(x) dalam range[0.0, 4] dan jarak antar titik
adalah 1.0. Lalu taksirlah f(x) dengan x=2.5 dengan Polinom Newton
derajat 3.
Solusi:
Maka polinom Newton derajat 1,2 dan 3 dengan x0 = 0
sebagai titik pertama :
cos( x) p1 ( x) 1.0 0.4597( x 0.0)
cos( x) p2 ( x) 1.0 0.4597 ( x 0.0) 0.2484( x 0.0)( x 1.0)
cos( x) p3 ( x) 1.0 0.4597 ( x 0.0) 0.2484( x 0.0)( x 1.0)
0.1466( x 0.0)( x 1.0)( x 2.0)
cos( x) p4 ( x) 1.0 0.4597 ( x 0.0) 0.2484( x 0.0)( x 1.0)
0.1466( x 0.0)( x 1.0)( x 2.0) 0.0147( x 0.0)( x 1.0)( x 2.0)( x 3.0)
Solusi:
Maka polinom Newton derajat 1,2 dan 3 dengan x0 = 0
sebagai titik pertama :
Contoh Soal
Solusi
Solusi
Tugas MetNum
70
Solusi
Tabel Polinomial Newton
x 45 Y 76.9
Integrating academic excellence and humanistic values