INTEGRASI NUMERIS - istiarto.staff.ugm.ac.id Integrasi Numeris.pdf · Metode Simpson q Fungsi...
Transcript of INTEGRASI NUMERIS - istiarto.staff.ugm.ac.id Integrasi Numeris.pdf · Metode Simpson q Fungsi...
Numerical Differentiation and Integration
INTEGRASI NUMERIS
https://istiarto.staff.ugm.ac.id
https://istiarto.staff.ugm.ac.id
Integrasi Numeris
❑ Acuan
❑ Chapra, S.C., Canale R.P., 1990, Numerical Methods for Engineers, 2nd
Ed., McGraw-Hill Book Co., New York.
◼ Chapter 15 dan 16, hlm. 459-523.
2
https://istiarto.staff.ugm.ac.id
Diferensial, Derivatif
xi xi +Δx
yi
yi +Δy
Δx
Δy
xi xi +Δx
yi
yi +Δy
xi
yi
(a) (b) (c)
( ) ( )x
xfxxf
x
y ii
−+=
( ) ( )x
xfxxf
x
y ii
x
−+=
→ 0lim
d
d
difference approximation
f(xi+Δx)
f(xi)
3
https://istiarto.staff.ugm.ac.id
Diferensial, Derivatif
( ) ( )x
xfxxf
x
y ii
−+=
( ) ( )x
xfxxf
x
y ii
x
−+=
→ 0lim
d
d
pendekatan beda (hingga)
difference approximationderivatif
( )xfyx
y==
d
d
derivatif = laju perubahan y
terhadap x
4
𝑛=0
∞𝑓(𝑛) 𝑎
𝑛!𝑥 − 𝑎 𝑛
Deret Taylor
https://istiarto.staff.ugm.ac.id
Diferensial
0
40
80
120
160
0 2 4 6 8 10
y
x
slope = dy/dx
0
6
12
18
24
0 2 4 6 8 10
dy/d
x
x
5.15xy =
5.05.7d
dx
x
y=
5
https://istiarto.staff.ugm.ac.id
Integral
0
40
80
120
160
0 2 4 6 8 10
∫y d
x
x
5.05.7 xy =5.15d xxy =
=x
xy0
dluas
▪ “kebalikan” dari proses men-diferensial-kan adalah meng-integral-kan
▪ integrasi ›‹ diferensiasi
0
6
12
18
24
0 2 4 6 8 10
y
x
6
https://istiarto.staff.ugm.ac.id
Fungsi
❑ Fungsi-fungsi yang di-diferensial-kan atau di-integral-kan
dapat berupa:
❑ fungsi kontinu sederhana: polinomial, eksponensial, trigonometri
❑ fungsi kontinu kompleks yang tidak memungkinkan didiferensialkan atau
dintegralkan secara langsung
❑ fungsi yang nilai-nilainya disajikan dalam bentuk tabel [tabulasi data x
vs f(x)]
7
https://istiarto.staff.ugm.ac.id
Cara mencari nilai integral
( )
+
++2
0
5.023
dsin5.01
1cos2xe
x
x x
x f(x)
0.25 2.599
0.75 2.414
1.25 1.945
1.75 1.993 0
1
2
3
4
0 0.5 1 1.5 2 2.5
A1 A2 A3 A4
∫f(x) dx = luas = ∑Ai
8
https://istiarto.staff.ugm.ac.id
Derivatif
x
uun
x
y n
d
d
d
d 1−=
( ) ( )xfvxfu == dan
nuy =
vuy =
v
uy =
x
vu
x
uv
x
y
d
d
d
d
d
d+=
2d
d
d
d
d
d
vx
vu
x
uv
x
y−
=xx ee
x
xx
x
xxx
xxx
xxx
=
=
=
−=
=
d
d
1ln
d
d
sectand
d
sincosd
d
cossind
d
2
aaax
axx
x
xxxx
xxxx
xxx
xx
a
lnd
d
ln
1log
d
d
cotcsccscd
d
tansecsecd
d
csccotd
d 2
=
=
−=
=
−=
9
https://istiarto.staff.ugm.ac.id
Integral
( ) ( ) Cbaxa
xbax
Cxx
x
aaCab
axa
nCn
uvu
uvuvvu
bxbx
nn
++−=+
+=
+=
−++
=
−=
+
cos1
dsin
lnd
1,0ln
d
11
d
dd
1
( ) ( )
( )
Cxa
ab
abbxa
x
Caxa
exex
Ca
exe
Cxxxxx
Cbaxa
xbax
axax
axax
+=+
+−=
+=
+−=
++=+
−
1
2
2
tan1d
1d
d
lndln
sin1
dcos
10
Metode Trapesium
Metode Simpson
Metode Kuadratur Gauss
Metode Integrasi Newton-Cotes11
https://istiarto.staff.ugm.ac.id
Persamaan Newton-Cotes
❑ Strategi
❑ mengganti fungsi kompleks dan rumit atau tabulasi data dengan
yang mudah untuk diintegralkan
( ) ( ) ==b
an
b
axxfxxfI dd
( ) nn
nnn xaxaxaxaaxf +++++= −
−
11
2210 ...
polinomial tingkat n
12
https://istiarto.staff.ugm.ac.id
Persamaan Newton-Cotes
( )xf
xa b
( )xf
xa b
Garis lurus (polinomial tingkat 1)
sbg fungsi pendekatan.
Kurva parabola (polinomial tingkat 2)
sbg fungsi pendekatan.
13
https://istiarto.staff.ugm.ac.id
Persamaan Newton-Cotes
( )xf
xa b
Garis lurus (polinomial tingkat 1)
sbg fungsi pendekatan.
12
3
Fungsi yang diintegralkan didekati
dengan 3 buah garis lurus (polinomial
tingkat 1).
Dapat pula dipakai beberapa kurva
polinomial tingkat yang lebih tinggi.
14
https://istiarto.staff.ugm.ac.id
Metode Trapesium
❑ Fungsi pendekatan untuk menghitung integral adalah
polinomial tingkat 1
❑ Sebuah garis lurus dapat dinyatakan dengan persamaan
( ) ( ) ==b
a
b
axxfxxfI dd 1
( ) ( )( ) ( )
( )axab
afbfafxf −
−
−+=1
15
https://istiarto.staff.ugm.ac.id
Metode Trapesium
( )( ) ( )
( )
( )( ) ( )
2
d
bfafab
xaxab
afbfafI
b
a
+−
−
−
−+
Metode Trapesium
( )xf
xa b
error
16
https://istiarto.staff.ugm.ac.id
Metode Trapesium
( )
640533.16
400180
4
675
3
2005.122.0
d400900675200252.0
8.0
0
65432
8.0
0
5432
=
+−+−+=
+−+−+=
xxxxxx
xxxxxxI
( )
( ) ( ) 232.08.0 dan 2.00
400900675200252.0 5432
==
+−+−+=
ff
xxxxxxf
Penyelesaian eksak
Metode Trapesium
( ) 1728.02
232.02.008.0 =
+−=I [error]( )%89467733.11728.0640533.1 =−=tE
17
https://istiarto.staff.ugm.ac.id
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
Metode Trapesium
❑ Error atau kesalahan
❑ bentuk trapesium untuk
menghitung nilai integral
mengabaikan sejumlah besar
porsi daerah di bawah kurva
❑ Kuantifikasi error pada
Metode Trapesium
error
( ) ( )3
12
1abfEt −−=
adalah titik di antara a dan b
18
https://istiarto.staff.ugm.ac.id
Metode Trapesium
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
error
( ) ( ) 56.208.060.012
1 3=−−−=aE
( ) 323 8000108004050400 xxxxf +−+−=
nilai rata-rata derivatif kedua:
( )( )
6008.0
d80001080040504008.0
0
323
−=−
+−+−= xxxx
xf
error:
order of magnitude nilai error ini sama dengan
order of magnitude nilai error terhadap nilai
penyelesaian eksak dan keduanya sama tanda
(sama-sama positif)
19
https://istiarto.staff.ugm.ac.id
Trapesium multi pias
❑ Peningkatan akurasi
❑ selang ab dibagi menjadi sejumlah n pias dengan lebar seragam h
n
abh
−=
20
https://istiarto.staff.ugm.ac.id
0
1
2
3
4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
x
f(x)
h = 0.1
Trapesium multi pias
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
h = 0.2
n
abh
−=
21
https://istiarto.staff.ugm.ac.id
Trapesium multi pias
n
abh
−=
nxbxa == dan Jika 0
( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( )2
...22
d...dd
12110
1
2
1
1
0
nn
x
x
x
x
x
x
xfxfh
xfxfh
xfxfhI
xxfxxfxxfIn
n
+++
++
+
+++=
−
−
( ) ( ) ( )
+
+ −
=
n
n
ii xfxfxf
hI
1
10 2
2( )
( ) ( ) ( )
rata-rata tinggi
1
10
lebar2
2
n
xfxfxf
abIn
n
ii +
+
−
−
=
22
https://istiarto.staff.ugm.ac.id
Trapesium multi pias
( )( )
=
−
−=n
iit f
n
abE
13
3
12
Error = jumlah error pada setiap pias
( ) ffn
n
ii
==1
1 ( )f
n
abEE at
−
−=2
3
12
setiap kelipatan jumlah pias, error mengecil
dengan faktor kuadrat peningkatan jumlah pias
23
https://istiarto.staff.ugm.ac.id
Trapesium multi pias
( ) 5432 400900675200252.0 xxxxxxf +−+−+=
n h I Et %Et Ea
1 0.8 0.1728 1.4677 89% 2.56
2 0.4 1.0688 0.5717 35% 0.64
4 0.2 1.4848 0.1557 9% 0.16
8 0.1 1.6008 0.0397 2% 0.04
( ) 640533.1d8.0
0== xxfI
( )8.0
01 dxxfI (the trapezoidal rule)
(exact solution)
0
20
40
60
80
100
1 2 4 8n
%Et vs n
24
https://istiarto.staff.ugm.ac.id
Metode Simpson
❑ Fungsi pendekatan:
polinomial tingkat 1
❑ Peningkatan ketelitian dpt
dilakukan dengan
meningkatkan jumlah pias
❑ Fungsi pendekatan:
polinomial:
❑ tingkat 2: Simpson 1/3
❑ tingkat 3: Simpson 3/8
The trapezoidal rule Simpson’s rules
25
https://istiarto.staff.ugm.ac.id
Metode Simpson
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
f2(x)
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
f3(x)
Simpson ⅓ Simpson ⅜
26
https://istiarto.staff.ugm.ac.id
Metode Simpson
❑ Polinomial tingkat 2 atau 3
❑ dicari dengan Metode Newton atau Lagrange (lihat materi tentang
curve fitting)
27
https://istiarto.staff.ugm.ac.id
Simpson ⅓
( ) ( ) =b
a
b
axxfxxfI dd 2
nxbxa == dan Jika 0
( )( )( )( )
( )( )( )( )( )
( )( )( )( )( )
( )
−−
−−+
−−
−−+
−−
−−
b
axxf
xxxx
xxxxxf
xxxx
xxxxxf
xxxx
xxxxI d2
1202
101
2101
200
2010
21
dan f2(x) diperoleh dengan Metode Lagrange
( ) ( ) ( ) 210 43
xfxfxfh
I ++
2
abh
−=
( )( ) ( ) ( )
6
4 210 xfxfxfabI
++−atau
( )( )
−−= 4
4
5
180f
n
abEt
28
https://istiarto.staff.ugm.ac.id
Simpson ⅓ multi pias
( ) ( ) ( )−
+++n
n
x
x
x
x
x
xxxfxxfxxfI
2
4
2
2
0
d...dd
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )6
42...
6
42
6
42 12432210 nnn xfxfxf
hxfxfxf
hxfxfxf
hI++
++++
+++
−−
( )( ) ( ) ( ) ( )
n
xfxfxfxf
abIn
n
ii
n
ii
3
242
6,4,2
1
5,3,10 +++
−
−
=
−
=
( ) 4
4
5
180f
n
abEa
−−= (estimasi error, 4f rata-rata derivatif ke-4)
29
https://istiarto.staff.ugm.ac.id
Simpson ⅜
( ) ( ) =b
a
b
axxfxxfI dd 3
nxbxa == dan Jika 0
( )( )( )( )( )( )
( )( )( )( )( )( )( )
( )( )( )( )( )( )( )
( )( )( )( )( )( )( )
( )
−−−
−−−+
−−−
−−−+
−−−
−−−+
−−−
−−−
b
axxf
xxxxxx
xxxxxxxf
xxxxxx
xxxxxxxf
xxxxxx
xxxxxxxf
xxxxxx
xxxxxxI d3
231303
2102
321202
3101
312101
3200
302010
321
dan f3(x) diperoleh dengan Metode Lagrange
( ) ( ) ( ) ( ) 3210 338
3xfxfxfxf
hI +++
3
abh
−=
( )( ) ( ) ( ) ( )
ratarata tinggi
3210
lebar8
33
−
+++−
xfxfxfxfabIatau
30
https://istiarto.staff.ugm.ac.id
Simpson ⅜
( )( )
−−= 4
5
6480f
abEt
Error
( )−= 45
80
3fhEt atau
31
https://istiarto.staff.ugm.ac.id
Simpson ⅓ dan ⅜
( ) 5432 400900675200252.0 xxxxxxf +−+−+=
( ) 640533.1d8.0
0== xxfI (exact solution)
Metode I Et
Simpson ⅓ (n = 2) 1.367467 0.273067 (27%)
Simpson ⅜ (n = 3) 1.51917 0.121363 (7%)
Simpson ⅓ (n = 4) 1.623467 0.017067 (1%)
32
https://istiarto.staff.ugm.ac.id
Pias tak seragam: Metode Trapesium
( )543
2
400900675
200252.0
xxx
xxxf
+−
+−+=i xi f(xi) I
0 0 0.2
1 0.12 1.309729 0.090584
2 0.22 1.305241 0.130749
3 0.32 1.743393 0.152432
4 0.36 2.074903 0.076366
5 0.4 2.456 0.090618
6 0.44 2.842985 0.10598
7 0.54 3.507297 0.317514
8 0.64 3.181929 0.334461
9 0.7 2.363 0.166348
10 0.8 0.232 0.12975
1.594801
I dihitung dengan Metode
Trapesium di setiap pias:
( ) ( )
( ) ( ) ( ) ( )2
...2
2
1122
011
−+++
+
++
=
nnn
xfxfh
xfxfh
xfxfhI
( ) 594801.1d8.0
0= xxf
33
https://istiarto.staff.ugm.ac.id
Pias tak seragam: Metode Simpson
( )543
2
400900675
200252.0
xxx
xxxf
+−
+−+=i xi f(xi) I
0 0 0.2
1 0.12 1.309729
2 0.22 1.305241
3 0.32 1.743393
4 0.36 2.074903
5 0.4 2.456
6 0.44 2.842985
7 0.54 3.507297
8 0.64 3.181929
9 0.7 2.363
10 0.8 0.232
I dihitung dengan Metode
Simpson ⅓ dan Simpson ⅜:
PR, dikumpulkan minggu depan
34
https://istiarto.staff.ugm.ac.id
Metode Integrasi Numeris
Metode Jumlah pias Lebar pias
Trapesium 1
Trapesium multi pias n > 1 seragam atau tak-seragam
Simpson ⅓ 2 seragam
Simpson ⅓ multi pias genap (2m, m = 2,3,…) seragam
Simpson ⅜ 3 seragam
Kuadratur Gauss 1
35
https://istiarto.staff.ugm.ac.id
Kuadratur Gauss
( )xf
x
( )xf
xerror terlalu besar upaya mengurangi error
36
https://istiarto.staff.ugm.ac.id
Kuadratur Gauss
( )xf
x
( )0xf
( )1xf
0x 1x1− 1
Kuadratur Gauss 2 Titik: Gauss-Legendre
( ) ( ) ( )1100
1
1d xfcxfcxxfI += −
( ) ( )
( ) ( )
( ) ( )
( ) ( ) 0d
32d
0d
2d1
1
1
31100
1
1
21100
1
11100
1
11100
==+
==+
==+
==+
−
−
−
−
xxxfcxfc
xxxfcxfc
xxxfcxfc
xxfcxfc c
0, c
1, x
0, x
1: unknowns
37
https://istiarto.staff.ugm.ac.id
0
0.5
1
1.5
2
-1.5 -1 -0.5 0 0.5 1 1.5 -1.5
-1
-0.5
0
0.5
1
1.5
-1.5 -1 -0.5 0 0.5 1 1.5
Kuadratur Gauss
( )xf
x
( ) 1=xf
( ) xxf =
2d11
1=− x 0d
1
1=− xx
( )xf
x
38
https://istiarto.staff.ugm.ac.id
-3
-2
-1
0
1
2
3
-1.5 -1 -0.5 0 0.5 1 1.5
0
1
2
-1.5 -1 -0.5 0 0.5 1 1.5
Kuadratur Gauss
( )xf
x
( ) 2xxf = ( ) 3xxf =
32d1
1
2 =− xx 0d1
1
3 =− xx
( )xf
x
39
https://istiarto.staff.ugm.ac.id
Kuadratur Gauss
( ) ( )
( ) ( )
( ) ( )
( ) ( ) 0d
32d
2d
2d1
1
1
31100
1
1
21100
1
11100
1
11100
==+
==+
==+
==+
−
−
−
−
xxxfcxfc
xxxfcxfc
xxxfcxfc
xxfcxfc
( ) ( )1100 xfcxfcI +
31
31
1
1
0
10
=
−=
==
x
x
cc
( ) ( )3131 ffI +−
40
https://istiarto.staff.ugm.ac.id
Kuadratur Gauss
Untuk batas integrasi dari a ke b:
▪ diambil asumsi suatu variabel xd yang dapat dihubungkan dengan variabel asli
x dalam suatu relasi linear
dxaax 10 +=
▪ jika batas bawah, x = a, berkaitan dengan xd = −1
▪ jika batas atas, x = b, berkaitan dengan xd = 1
( )110 −+= aaa
( )110 aab +=
2 dan
210
aba
aba
−=
+=
( ) ( )
( )d
d
xab
x
xababx
d2
d
2−
=
−++=
dxaax 10 +=
41
https://istiarto.staff.ugm.ac.id
Kuadratur Gauss
( ) 5432 400900675200252.0 xxxxxxf +−+−+=
( ) 640533.1d8.0
0== xxfI (exact solution)
Penyelesaian dengan Metode Kuadratur Gauss:
( ) ( )
dd
dd
xxx
xx
x
d4.0d2
08.0d
4.04.02
08.008.0
=−
=
+=−++
=
42
https://istiarto.staff.ugm.ac.id
Kuadratur Gauss
( )
( ) ( ) ( )
( ) ( )=
+++
−+++−++
=+−+−+
−
1
1 54
32
8.0
0
5432
d4.04.04.04004.04.0900
4.04.06754.04.02004.04.0252.0
d400900675200252.0
d
dd
dddx
xx
xxx
xxxxxx
( )( ) 305837.131
516741.031
==
=−=
d
d
xf
xf( )
822578.1
305837.1516741.0
d8.0
0
=
+=
xxfI
43
44