Numerik
Numerik
Metode Numerik hanya diperoleh solusi yang mendekati solusi sejati sehingga solusi
numerik dikatakan solusi pendekatan. Solusi pendekatan jelas tidak sama dengan solusi
sejati sehingga ada selisih antara kedua solusi tersebut. Selisih ini lah yang disebut
dengan ERROR( galat/kesalahan )
kesalahan
Kesalahan Relatif = solusisejati
100%
1
Metoda : (a). Bisection
(b). Regulafasi ( False Position )
(c). Sekan
(d). Iterasi Titik Tetap
II. Interpolasi
Metoda perhitungan Poliom Interpolasi yaitu :
1. Polinom Lagrange
2. Polinom Newton
3. Polinom Newton Gregory : ( Forward & Backward)
III. Integral
METODE BISEKSI
x0 x2 x1
r
x0 x 2 f(x)
I xk+1 - xk I <
PROSEDUR
2akar
!x1 x0! !x1 x0! Selesai
1. Pilih interval awal [x0 , x1 ] tentukan nilai ,
2.
x2 x x1]/2
= [ 0+
x0 x 2
Mulai
ya
tidak
tidak tidak
f(x0 )
f(x2)<0
ya ya
4
si
5
x 0 f ( x1 ) x1 f ( x0 )
2. x 2 f ( x1 ) f ( x 0 )
4. STOP , jika
x2 x0 x2 x1
(i) atau
x0 x1
(ii) f ( x2 )
(X0 ,f(X0 ))
r X1
X0 X2
(X1 ,f(X1 ))
3
Contoh : f(x) = x x 1, = 0,01
x 0 f ( x1 ) x1 f ( x0 )
x2
f ( x1 ) f ( x0 )
x2 x0 x x0
n X0 X1 f(X0 ) f(X1 ) X2 f(X2 ) f(X0 ) f(X2 ) 2
x0 x0
6
1 1 2 -1 5 1,167 -0,578 0,578 0,167 0,416
2 1,167 2 -0,578 5 1,253 -0,286 0,165 0,074 0,374
3 1,253 2 -0,286 5 1,293 -0,131 0,037 0,032 0,354
4 1,293 2 -0,131 5 1,311 -0,058 0,007 0,014 0,344
x2 x0 x x0
n X0 X1 f(X0 ) f(X1 ) X2 f(X2 ) f(X0 ) f(X2 2
) x0 x0
1 0 1 1 -2,2817 0,3047 0,8920 0,8920 0,6953
2 0,3097 1 0,8920 -1,1408 0,6098 -0,0192 -0,0171 0,9690 0,3902
3 0,3097 0,6098 0,8920 -0,0192 0,6034 0,0080 0,0071 0,9483 0,0105
4 0,6034 0,6098 0,0080 -0,0192 0,6052 0,0003 0 0,0030 0,0075
5 0,6052 0,6098 0,0003 -0,0096 0,6052 0,0000 0 0 0,0075
METODE SEKAN
PROSEDUR
x 0 f ( x1 ) x1 f ( x0 )
2. x 2 f ( x1 ) f ( x 0 )
x 0 x1
3. x1 x 2
4. STOP , jika
7
x2 x0 x2 x1
(i) atau
x0 x1
(ii) f ( x2 )
x2 r
x0 x1
f(x )
x2 x0 x x0
n X0 X1 f(X0 ) f(X1 ) X2 f(X2 ) 2
x0 x0
1 2 3 5 23 1,722 2,384 0,139 0,426
2 3 1,722 23 2,384 1,574 1,325 0,475 0,086
3 1,722 1,574 2,384 1,325 1,917 4,128 0,113 0,218
4 1,574 1,917 1,325 4,128 1,412 0,403 0,103 0,263
5 1,917 1,412 4,128 0,403 1,357 0,142 0,292 0,039
6 1,412 1,357 0,403 0,142 1,327 0,010 0,060 0,022
7
8
8
Kerjakan f(x) = e x 5x2
x2 x0 x x0
n X0 X1 f(X0 ) f(X1 ) X2 f(X2 ) 2
x0 x0
1 1 2 -0,4366 -12,6109 0,9641 -2,0250 0,0359 0,5180
2 2 0,9641 -12,6109 -2,0250 0,7659 -0,7821 0,6171 0,2056
3 0,9641 0,7659 -2,0250 -0,7821 0,6412 -0,1569 0,3349 0,1628
4 0,7659 0,6412 -0,7821 -0,1569 0,6099 -0,0196 0,2037 0,0488
5 0,6412 0,6099 -0,1569 -0,0196 0,6054 -0,0006 0,0558 0,0074
6 0,6099 0,6054 -0,0196 -0,0006 0,6052 0,0003 0,0077 0,0003
7
8
NEWTON RHAPSON
S (x0, f(x0))
x1
x0
f(x )
9
f ( x0 )
x1 x0
f ' ( x0 )
f ( xk )
xk 1 xk k= 0,1,2,
f ' ( xk )
1. Pilih x0 sebarang ; ,
2. Tentukan f(x0)
3. Untuk k = 0,1,2,..
Hitung berturut2 :
f ( xk )
xk 1 xk
f ' ( xk )
x k x k 1
4. STOP , jika
xk 1 xk
(i)
xk
(ii) f ( xk 1 )
10
Contoh : f(x) = x3 x 1, = 0,1
x2 x0
n X0 f(X0 ) f(X0 ) X1 f(X1 )
x0
1 2 5 5 1 -1 1
2 1 -1 -4 0,75 -1,328 1,328
3 0,75 -1,328 1,25 1,812 3,137 1,416
4 1,812 3,137 4,436 1,105 -0,756 0,390
5 1,105 -0,756 2,315 1,432 0,504 0,296
6 1,432 0,504 3,296 1,279 0,187 0,107
7 1,279 -0,187 2,837 1,345 0,088 0,052
x2 x0
n X0 f(X0 ) f(X0 ) X1 f(X1 )
x0
1 1 -2,2817 -7,2817 0,6867 -0,3706 0,6294
2 0,6867 -0,3706 -4,8799 0,6108 -0,0135 0,1105
11
3 0,6108 -0,0135 -4,2661 0,6053 -0,0001 0,0090
4 0,6053 -0,0001 -4,2212 0,6053 -0,0001 0
PROSEDUR:
1
Contoh : f(x) = x3 x 1 x r 1 ( x r 1) 3
Iterasi xr x r 1 x r
1 2 -
2 1,4422 0,5578
3 1,3467 0,0955
4 1,3289 0,0178
5 1,3255 0,0034
6 1,3249 0,0006
7 1,3248 0,0001
8 1,3247 0,0001
9 1,3247 0
Kerjakan f(x) = e 5x x 2 xr 1 (e x / 5) 2
Iterasi xr x r 1 x r
1 1 - 7 0,6056 0,0008
12
2 0,7373 0,2627 8 0,6054 0,0002
3 0,6466 0,0907 9 0,6053 0,0001
4 0,6179 0,0287
5 0,6091 0,0088
6 0,6064 0,0027
Sistem Persamaan Linier.(SPL)
Eliminasi
Substitusi Hasil (Jawab ) Eksak
Metode Eliminasi Gauss Jordan
Metode Iterasi Gauss Seidel
Contoh : SPL
2x + y = 4 ..(1)
x - y = -1...(2)
Cara
Eliminasi
2x + y = 4
2x - 2y = -2
3y = 6 y=2
x = -1 + y = -1 +2 = 1
x = 1; y = 2
Substitusi
(2) x = y -1
(1) 2x + y = 4
2(y-1) + y = 4 2y 2 + y = 4 3y = 6 y = 2
x=1;y=2
2 1 4 1 0,5 2 1 0,5 2
2 2 2 2 2 2 0 3 6
13
1 0,5 2 1 0 1
0 1 2 0 1 2
x=1 ; y=2
Iterasi Gauss Seidel
Contoh : SPL
2x + y = 4 ..(1)
x - y = -1...(2)
4 y
x ; y x 1
2
Nilai awal x0 = 2 ; y0 = 0
Iterasi x y x k 1 x k y k 1 y k
0 2 0 - -
1 0,5 3 0,5 3
2 1,25 1,5 0,75 1,5
3 0,875 2,25 0,375 0,75
4 1,0625 1,875 0,1875 0,375
5 0,9688 2,0625 0,0937 0,1875
6 1,0156 1,9688 0,0468 0,0937
7 0,9922 2,0156 0,0234 0,0468
8 1,0039 1,9922 0,0117 0,0234
9 0,9981 2,0039 0,0058 0,0117
10 1,0010 1,9981 0,0029 0,0058
Contoh : SPL
4x - y + z = 7 ..(1)
4x - 8 y + z = -21...(2)
-2x + y + 5z = 15...(3)
14
1 0,25 0,25 1,75 1 0,25 0,25 1,75
0 1 0 4 0 1 0 4
0 0 5,5 16,5
0 0 1 3
1 0 0,25 2,75 1 0 0 2
0 1 0 4 0 1 0 4
0
0 1
3 0 0 1 3
x=2 ;y=4;z=3
4x - y + z = 7 ..(1)
4x - 8 y + z = -21...(2)
-2x + y + 5z = 15...(3)
7 yz 21 4 x z 15 2 x y
x ; y ; z
4 8 5
Nilai awal x0 = 1 ; y0 = 2 ; z0 = 2
Iterasi x y z x k 1 x k y k 1 y k z k 1 z k
0 1,75 2 2
1 3,75 1,75 3
2 1,95 3,96875 2,98625
3
4
5
6
7
8
9
10 2 4 3
Interpolasi Polinom
15
Tentukan polinom Pn(x) yang melalui semua titik tersebut sedemikian sehingga
Yi = Pn(xi) untuk i = 0,1,2,, n, Yi dari fungsi matematika f(x) missal ln(x) , sin (x) dll
sedemikian sehingga yi = f(xi) sedangkan Pn(x) fungsi hampiran terhadap f(x), dengan yi
adalah nilai empiris diperoleh dari percobaan.
x1 , y1 x2 , y 2 a, p n ( a )
xn , y n
x0 , y 0 b, p n (b)
x=a x =b
Interpolasi Linier
16
Misal dua buah titik x0 , y 0 dan x1 , y1 b, maka polinom yang menginterpolasi ke dua
y y0 x x0
x1 , y1
y1 y 0 x1 x 0
x0 , y 0
( y y 0 )( x1 x 0 ) ( x x 0 )( y1 y 0 )
( x x 0 )( y1 y 0 )
y y0
( x1 x0 )
( x x0 )( y1 y0 )
y P1 ( x) y0
( x1 x0 )
Contoh : (1)
Jika ln ( 9.0 ) = 2.1972 , ln (9.5) = 2.2513 maka ln ( 9.2 ) = ?
Jawab :
(9.2 9.0)(2.2513 2.1972)
y 2.1972 2.1972 0.02164 2.21884
(9.5 9.0)
Interpolasi Kuadratik
Melalui Tiga buah titik x 0 , y 0 , x1 , y1 dan x 2 , y 2
P2(x) = a0 + a1 x + a2 x2
x0 , y 0 a0 + a1 x0 + a2 x02 = y0
x1 , y1 a0 + a1 x1 + a2 x12 = y1 gunakan Eliminasi Gauss
17
x2 , y 2 a0 + a1 x2 + a2 x22 = y2
Contoh :
Ln (8.0) = 2.0794 ; ln (9.0) = 2.1972 ; dan ln (9.5) = 2.2513
Ln ( 9.2) = ?
Jawab :
(8, 2.0794) a0 + 8 a1 + 64 a2 = 2.0794
(9, 2.1972) a0 + 9 a1 + 81 a2 = 2.1972
(9.5 , 2.2513) a0 + 9.5 a1 + 90.25 a2 = 2.2513
Dengan menggunakan Eliminasi Gauss diperoleh :
a0 = 0,6762 ; a1 = 0,2266 ; a3 = - 0,0064
maka polinom nya : P2(x) = 0,6762 + 0,2266 x - 0,0064 x2
Sehingga P2(9,2) = 2,2192
Interpolasi Kubik
Melalui Empat buah titik x 0 , y 0 , x1 , y1 , x 2 , y 2 dan x3 , y 3
P2(x) = a0 + a1 x + a2 x2
x0 , y 0 a0 + a1 x0 + a2 x02 + a3 x03 = y0
x1 , y1 a0 + a1 x1 + a2 x12 + a3 x13 = y1 gunakan Eliminasi Gauss
x2 , y 2 a0 + a1 x2 + a2 x22 + a3 x23 = y2
x3 , y 3 a0 + a1 x3 + a2 x32 + a3 x33 = y2
Dengan cara yang sama untuk Interpolasi berderajat n
Metode perhitungan Poliom Interpolasi ( dengan tidak menggunakan cara di atas )
yaitu : 1. Polinom Lagrange
2. Polinom Newton
3. Polinom Newton Gregory : ( Forward & Backward)
1. Polinom Lagrange
18
Dari persamaan yang diperoleh :
( x x0 )( y1 y0 )
y P1 ( x) y0
( x1 x0 )
( y0 )( x x0 ) ( y1 )( x x0 )
y0
( x1 x0 ) ( x1 x0 )
y0 x1 y0 x0 y0 x y0 x0 ( y1 )( x x0 ) ( x x1 ) y0 ( y1 )( x x0 )
y
( x1 x0 ) ( x1 x0 ) ( x0 x1 ) ( x1 x0 )
y 0 ( x x1 ) y1 ( x x0 )
P1 ( x)
( x0 x1 ) ( x1 x0 )
( x x0 )
a1 y1 , L1 ( x)
( x1 x0 )
P1 ( x) a 0 L0 ( x) a1 L1 ( x )
( x x0 )( x x1 )....( x xn1 )
Dengan an y n , Ln ( x)
( xn xn1 )
Contoh :
10
Nilai yang berkorespondensi dengan y = log x adalah :
i = 0,1,2,3
Carilah: 10
log 301
19
Maka dengan menggunakan Rumus Polinomial Lagrange di peroleh :
P3 ( x ) a0 L0 ( x) a1L1 ( x ) a2 L2 ( x ) a3 L3 ( x )
Dengan :
( x x1 )( x x2 )( x x3 )
a0 y 0 , L0 ( x)
( x0 x1 )( x0 x2 )( x0 x3 )
( x x0 )( x x2 )( x x3 )
a1 y1 , L1 ( x )
( x1 x0 )( x1 x2 )( x1 x3 )
( x x0 )( x x1 )( x x3 )
a2 y 2 , L2 ( x)
( x2 x0 )( x2 x1 )( x2 x3 )
( x x0 )( x x1 )( x x2 )
a3 y 3 , L3 ( x )
( x3 x0 )( x 3 x1 )( x3 x2 )
Dengan mensubstitusikan : x = 301 dan
x 0 = 300 x1 = 304 x 2 = 305 x3 = 307
y 0 = 2.4771 y1 = 2.4829 y 2 = 2.4843 y 3 = 2.4871
2. Polinom Newton
( x x0 )( y1 y0 )
y P1 ( x ) y0
( x1 x0 )
( y1 y 0 )
y0 ( x x0 )
( x1 x0 )
a0 a1 ( x x0 )
Sehingga diperoleh :
a 0 y 0 f ( x0 )
( y1 y0 ) ( f ( x1 ) f ( x0 ))
a1 f [ x1 , x0 ]
( x1 x0 ) ( x1 x0 )
a2 f [ x2 , x1 , x0 ]
.
an f [ xn , xn 1 ,..., x1 , x0 ]
20
Karena a0 , a1 .. an merupakan nilai selisih terbagi maka Polinom Newton dinamakan
Polinom Interpolasi Selisih Terbagi Newton.
Dinyatakan dalam bentuk tabel berikut :
i xi yi=f(xi) ST-1 ST-2 ST-3
0 X0 f(X0)
f [X1, X0]
1 X1 f(X1) f [X2, X1 ,X0]
f [X2, X1] f [X3, X2 X1,X0]
2 X2 f(X2) f [X3, X2 X1]
f [X3, X2]
3 X3 f(X3)
Pn ( x) f ( x0 ) ( x x0 ) f [ x1 , x 0 ] ( x x0 )( x x1 ) f [ x 2 , x1 , x0 ] ( x x 0 )( x x1 )( x x 2 ) f [ x3 , x 2 , x1 , x 0 ]
Hitung f(9,2) dari nilai nilai (x,y) pada tabel dengan polinom Newton derajat 3
Dinyatakan dalam bentuk tabel berikut :
i xi yi=f(xi) ST-1 ST-2 ST-3
0 8 2,079442
0,117783
1 9 2,197225 -0,006433
0,108134 0,000411
2 9,5 2,251292 -0,005200
0,097735
3 11,0 2,397895
21
3. Polinom Newton Gregory : ( Forward & Backward)
Merupakan kasus khusus dari Polinom Newton untuk titik yang berjarak
sama.Sehingga rumus Polinomnya menjadi lebih sederhana, selain itu tabel selisih
terbaginya pun menjadi lebih mudah terbentuk , dan tabel tersebut hanya sebagai
Tabel Selisih saja , karena tidak ada proses pembagian dalam pembentukan elemen
tabel.
Ada 2 macam Tabel Selisih , yaitu -Tabel Selisih Maju ( Forward Difference) dan
-Tabel Selisih Mundur ( Backward Difference)
Karena itu ada 2 macam Polinom Newton Gregory yaitu :
- Forward Newton Gregory
- Backward Newton Gregory
1.Tabel Selisih Maju ( Forward Difference)
I xi yi=f(xi) f 2 f 3 f
0 X0 f(X0) = f0
f 0
1 X1 f(X1) 2 f 0
f1 3 f 0
2 X2 f(X2) 2 f1
f 2
3 X3 f(X3)
f ( x1 ) f ( x0 ) 1 f 0
f [ x1 , x0 ] , dimana h = x1 x0
x1 x0 1! h
2 f 0
f [ x2 x1 , x0 ]
2! h
22
n f ( x0 ) n f 0
Bentuk umum f [ x n ,....x1 , x0 ]
n!h n n!h n
Rumus Polinom
Pn ( x) f ( x0 ) ( x x0 ) f [ x1 , x0 ] ( x x 0 )( x x1 ) f [ x 2 , x1 , x 0 ] ( x x0 )( x x1 )( x x 2 ) f [ x3 , x 2 , x1 , x 0 ]
f 0 2 f 0 3 f 0
Pn ( x) f 0 ( x x0 ) ( x x0 )( x x1 ) ( x x0 )( x x1 )( x x 2 )
1!h 2!h 2 3!h 3
f 2
-2 X-2 f(X-2) 2 f 1
f 1 3 f 0
-1 X-1 f(X-1) 2 f0
f 0
0 X0 f(X0)
23
Bentuk umum k 1 f i k f i k f i 1
Integral Numerik
24
b
f ( x)dx
a
secara numerik dipandang sebagai luas daerah yang dibatasi kurva y =
f(x)
a b
METODE ( Aproksimasi )
1. Persegi Panjang
Daerah integral di bagi-bagi menjadi n buah subinterval dengan lebar interval
sama.
a. Tinggi diambil dari Ujung Kiri SubInterval
ba
h =
n
f(x) y0 y1 y2 y3
I II III IV
h h h h
a b
I = h ( y 0 y1 ... y n 1 )
25
f(x) y1 y2 y3 y4
I II III IV
h h h h
a b
I = h ( y1 y2 ... yn )
c. Tinggi diambil dari Titik Tengah SubInterval
f(x) y1 y2 y3 y4
I II III IV
h h h h
a b
(y y ... y )
I=h h
( a ) ( a
3h
) [ a (
2 n 1
)]
2 2 2
Contoh :
4
x dx
2
Hitung
0
26
I = h ( y 0 y1 ... y n 1 )
40
h= =1
4
I = 1 { f(0) + f(1) + f(2) + f(3) } = 1 { 0 + 1 + 4 + 9 } = 14
40
h= =1
4
I = 1 { f(0,5) + f(1,5) + f(2,5) + f(3,5) }
= 1 { 0,25 + 2,25 + 6,25 + 12,25} = 21
2. Trapesium
Daerah integral di bagi-bagi menjadi n buah subinterval dengan lebar interval
sama.
ba
h =
n
27
f(x) y0 y1 y2 y3 y4
I II III IV
h h h h
a b
I = LI + LII + LIII + LIV =
= h/2 ( y0 y1 y1 y2 y2 ... yn1 yn1 yn )
h
I = ( y0 2 y1 2 y 2 ... 2 y n1 yn )
2
Contoh :
4
x dx
2
Hitung
0
3. Simpson
Daerah integral di bagi-bagi menjadi n buah subinterval dengan lebar interval
sama.( n adalah kelipatan dua )
ba
h =
n
Pada Pendekatan Integral numerik menggunakan metode Simpson kita gunakan
pendekatan dengan cara trapesium dengan mengambil dua subinterval dengan
mengasumsikan pengambilan dua buah trapesium yang berdampingan kurva yang
28
terbentuk mendekati bentuk kurva parabola.Untuk itu perhitungan integral dengan
cara simpson tersebut hasil nya untuk kurva berpangkat kurang atau sama dengan
dua mendekati nilai sebenarnya ( perhitungan dengan kalkulus dasar )
f(x) y0 y1 y2 y3 y4
I II III IV
h h h h
a
2h 2h
h
Ih = ( y0 2 y1 2 y 2 ... 2 yn1 y n ) ..(1)
2
Untuk k = 2h
Ik = h( y0 2 y1 2 y 2 ... 2 yn1 y n ) .(2)
Integral Trapesium .
I = Ih + c h2 .(3) I = Ih + c h2 = Ik + c k2
I = Ik + c k2 . (4) Ih - Ik= c (k2 - h2 )
Ih Ik Ih Ik Ih Ik
error trapesium c= 2 = 2 =
k h
2
4h h
2
3h 2
Ih Ik
Dari persamaan (3) jika di subtitusikan nilai c = diperoleh
3h 2
Ih Ik
I = Ih + . h2
3h 2
4 1
= Ih Ik Substitusikan persamaan(1) dan (2)
3 3
2 1
I= h( y 0 2 y1 2 y 2 ... 2 y n 1 y n ) - 3 h( y 0 2 y1 2 y 2 ... 2 y n1 y n )
3
29
h
I= ( y0 4 y1 2 y 2 4 y3 ... 2 y n 2 4 y n1 y n )
3
Contoh :
4
x dx
2
Hitung
0
30