You are on page 1of 44

Numerical Differentiation and Integration

INTEGRASI NUMERIS
Integrasi Numeris
2
Acuan
Chapra, S.C., Canale R.P., 1990, Numerical Methods for
Engineers, McGraw-Hill Book Co., printed in Singapore.
Chapter 15 dan 16, hlm. 459-523.
Diferensial, derivatif
x
i
x
i
+x
i
y
i
y
i
+y
i
x
y
x
i
x
i
+x
i
y
i
y
i
+y
i
x
i
y
i
(a) (b) (c)
( ) ( )
x
x f x x f
x
y
i i
A
A +
=
A
A ( ) ( )
x
x f x x f
x
y
i i
x
A
A +
=
A 0
l i m
d
d
difference approximation
3
Diferensial, derivatif
( ) ( )
x
x f x x f
x
y
i i
A
A +
=
A
A ( ) ( )
x
x f x x f
x
y
i i
x
A
A +
=
A 0
l i m
d
d
pendekatan beda (hingga)
difference approximation
derivatif
4
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
d
y
/
d
x
x
5 . 1
5x y =
5 . 0
5 . 7
d
d
x
x
y
=
5
0
6
12
18
24
0 2 4 6 8 10
y
x
Integral
0
40
80
120
160
0 2 4 6 8 10

y

d
x
x
5 . 0
5 . 7 x y =
5 . 1
5 d x x y =
}
}
=
x
x y
0
d l uas
6
Fungsi
7
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)]
Cara mencari nilai integral
8
( )
}
+
+ +
2
0
5 . 0
2 3
d
si n 5 . 0 1
1 cos 2
x e
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
A
1
A
2
A
3
A
4
f(x) dx = luas = A
i
Derivatif
9
x
u
u n
x
y
n
d
d
d
d
1
=
( ) ( ) x f v x f u = = dan
n
u y =
v u y =
v
u
y =
x
v
u
x
u
v
x
y
d
d
d
d
d
d
+ =
2
d
d
d
d
d
d
v
x
v
u
x
u
v
x
y

=
x x
e e
x
x
x
x
x x
x
x x
x
x x
x
=
=
=
=
=
d
d
1
l n
d
d
sec tan
d
d
si n cos
d
d
cos si n
d
d
2
a a a
x
a x
x
x
x x x
x
x x x
x
x x
x
x x
a
l n
d
d
l n
1
l og
d
d
cot csc csc
d
d
tan sec sec
d
d
csc cot
d
d
2
=
=
=
=
=
Integral
10
( ) ( ) C b ax
a
x b ax
C x
x
x
a a C
a b
a
x a
n C
n
u
v u
u v uv v u
bx
bx
n
n
+ + = +
+ =
= > + =
= +
+
=
=
}
}
}
}
} }
+
cos
1
d si n
l n
d
1 , 0
l n
d
1
1
d
d d
1
( ) ( )
( )
C x
a
ab
ab bx a
x
C ax
a
e
x e x
C
a
e
x e
C x x x x x
C b ax
a
x b ax
ax
ax
ax
ax
+ =
+
+ =
+ =
+ =
+ + = +

}
}
}
}
}
1
2
2
tan
1 d
1 d
d
l n d l n
si n
1
d cos
Metode Trapesium
Metode Simpson
Metode Kuadratur Gauss
Metode Integrasi Newton-Cotes
11
The Newton-Cotes Formulae
12
Strategi
mengganti fungsi kompleks dan rumit atau tabulasi
data dengan yang mudah untuk
diintegralkan
( ) ( )
} }
= =
b
a
n
b
a
x x f x x f I d d
( )
n
n
n
n n
x a x a x a x a a x f + + + + + =

1
1
2
2 1 0
...
polinomial orde n
The Newton-Cotes Formulae
13
( ) x f
x a b
( ) x f
x a b
Garis lurus (polinomial orde 1) sbg
fungsi pendekatan.
Kurva parabola (polinomial orde 2) sbg
fungsi pendekatan.
The Newton-Cotes Formulae
14
( ) x f
x a b
Garis lurus (polinomial orde 1) sbg
fungsi pendekatan.
1
2
3
Fungsi yang diintegralkan didekati
dengan 3 buah garis lurus (polinomial
orde 1).
Dapat pula dipakai beberapa kurva
polinomial orde yang lebih tinggi.
Metode Trapesium
15
Fungsi pendekatan untuk menghitung integral adalah
polinomial orde 1.
( ) ( )
} }
= =
b
a
b
a
x x f x x f I d d
1
Sebuah garis lurus dapat dinyatakan dengan
persamaan
( ) ( )
( ) ( )
( ) a x
a b
a f b f
a f x f

+ =
1
Metode Trapesium
16
( )
( ) ( )
( )
( )
( ) ( )
2
d
b f a f
a b
x a x
a b
a f b f
a f I
b
a
+
~
(

+ ~
}
metode trapesium
( ) x f
x a b
error
Metode Trapesium
17
( )
640533 . 1
6
400
180
4
675
3
200
5 . 12 2 . 0
d 400 900 675 200 25 2 . 0
8 . 0
0
6 5 4 3 2
8 . 0
0
5 4 3 2
=
|
.
|

\
|
+ + + =
+ + + =
}
x x x x x x
x x x x x x I
( )
( ) ( ) 232 . 0 8 . 0 dan 2 . 0 0
400 900 675 200 25 2 . 0
5 4 3 2
= =
+ + + =
f f
x x x x x x f
Penyelesaian eksak
Metode trapesium
( ) 1728 . 0
2
232 . 0 2 . 0
0 8 . 0 =
+
= I
[error] ( ) % 89 467733 . 1 1728 . 0 640533 . 1 ~ = =
t
E
Metode Trapesium
Error atau kesalahan
bentuk trapesium untuk
menghitung nilai integral
mengabaikan sejumlah besar
porsi daerah di bawah kurva
Kuantifikasi error pada
metode trapesium
18
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
error
( ) ( )
3
12
1
a b f E
t
' ' =
adalah titik di antara a dan b
Metode Trapesium
19
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
error
( )( ) 56 . 2 0 8 . 0 60 . 0
12
1
3
= =
a
E
( )
3 2 3
8000 10800 4050 400 x x x x f + + = ' '
nilai rata-rata derivatif kedua:
( )
( )
60
0 8 . 0
d 8000 10800 4050 400
8 . 0
0
3 2 3
=

+ +
= ' '
}
x x x x
x f
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)
Trapesium multi pias
20
Peningkatan akurasi
selang ab dibagi menjadi sejumlah n pias dengan lebar
seragam h
n
a b
h

=
Trapesium multi pias
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
h = 0.2
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
21
n
a b
h

=
Trapesium multi pias
22
n
a b
h

=
n
x b x a = = dan Ji ka
0
( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( )
2
...
2 2
d ... d d
1 2 1 1 0
1
2
1
1
0
n n
x
x
x
x
x
x
x f x f
h
x f x f
h
x f x f
h I
x x f x x f x x f I
n
n
+
+ +
+
+
+
~
+ + + =

} } }

( ) ( ) ( )
(

+
)
`

+ ~

=
n
n
i
i
x f x f x f
h
I
1
1
0
2
2
( )
( ) ( ) ( )


rata - rata tinggi
1
1
0
lebar
2
2
n
x f x f x f
a b I
n
n
i
i
+
)
`

+
~

=
Trapesium multi pias
23
( )
( )

=
' '

=
n
i
i t
f
n
a b
E
1
3
3
12
Error = jumlah error pada setiap pias
( ) f f
n
n
i
i
' ' = ' '

=1
1 ( )
f
n
a b
E E
a t
' '

= ~
2
3
12
setiap kelipatan jumlah pias, error mengecil
dengan faktor kuadrat peningkatan jumlah pias
Trapesium multi pias
24
( )
5 4 3 2
400 900 675 200 25 2 . 0 x x x x x x f + + + =
n h I E
t
%E
t
E
a
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 . 1 d
8 . 0
0
= =
}
x x f I
( )
}
~
8 . 0
0
1
dx x f I (the trapezoidal rule)
(exact solution)
0
20
40
60
80
100
1 2 4 8
n
%E
t
vs n
Metode Simpson
Fungsi pendekatan:
polinomial orde 1
Peningkatan ketelitian
dpt dilakukan dengan
meningkatkan jumlah
pias
Fungsi pendekatan:
polinomial:
orde 2: Simpson 1/3
orde 3: Simpson 3/8
25
The trapezoidal rule Simpsons rules
Metode Simpson
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
f
2
(x)
0
1
2
3
4
0 0.2 0.4 0.6 0.8
x
f(x)
f
3
(x)
26
Simpson Simpson
Metode Simpson
27
Polinomial orde 2 atau 3
dicari dengan metode Newton atau Lagrange (lihat
materi tentang curve fitting)
Simpson
28
( ) ( )
} }
~ =
b
a
b
a
x x f x x f I d d
2
n
x b x a = = dan Ji ka
0
( )( )
( )( )
( )
( )( )
( )( )
( )
( )( )
( )( )
( )
}
(



+


+


~
b
a
x x f
x x x x
x x x x
x f
x x x x
x x x x
x f
x x x x
x x x x
I d
2
1 2 0 2
1 0
1
2 1 0 1
2 0
0
2 0 1 0
2 1
dan f
2
(x) diperoleh dengan metode Lagrange
( ) ( ) ( ) | |
2 1 0
4
3
x f x f x f
h
I + + ~
2
a b
h

=
( )
( ) ( ) ( )
6
4
2 1 0
x f x f x f
a b I
+ +
~
atau
( )
( )

=
4
4
5
180
f
n
a b
E
t
Simpson multi pias
29
( ) ( ) ( )
} } }

+ + + ~
n
n
x
x
x
x
x
x
x x f x x f x x f I
2
4
2
2
0
d ... d d
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )
6
4
...
6
4
2
6
4
2
1 2 4 3 2 2 1 0 n n n
x f x f x f
h
x f x f x f
h
x f x f x f
h I
+ +
+ +
+ +
+
+ +
~

( )
( ) ( ) ( ) ( )
n
x f x f x f x f
a b I
n
n
i
i
n
i
i
3
2 4
2
6 , 4 , 2
1
5 , 3 , 1
0
+ + +
~


=

=
( )
4
4
5
180
f
n
a b
E
a

= (estimasi error,
4
f rata-rata derivatif ke-4)
Simpson
30
( ) ( )
} }
~ =
b
a
b
a
x x f x x f I d d
3
n
x b x a = = dan Ji ka
0
( )( )( )
( )( )( )
( )
( )( )( )
( )( )( )
( )
( )( )( )
( )( )( )
( )
( )( )( )
( )( )( )
( )
} (



+


+


+


~
b
a
x x f
x x x x x x
x x x x x x
x f
x x x x x x
x x x x x x
x f
x x x x x x
x x x x x x
x f
x x x x x x
x x x x x x
I d
3
2 3 1 3 0 3
2 1 0
2
3 2 1 2 0 2
3 1 0
1
3 1 2 1 0 1
3 2 0
0
3 0 2 0 1 0
3 2 1
dan f
3
(x) diperoleh dengan metode Lagrange
( ) ( ) ( ) ( ) | |
3 2 1 0
3 3
8
3
x f x f x f x f
h
I + + + ~
3
a b
h

=
( )
( ) ( ) ( ) ( )


rata rata tinggi
3 2 1 0
lebar
8
3 3

+ + +
~
x f x f x f x f
a b I
atau
Simpson
31
( )
( )

=
4
5
6480
f
a b
E
t
Error
( ) =
4 5
80
3
f h E
t
atau
Simpson dan
32
( )
5 4 3 2
400 900 675 200 25 2 . 0 x x x x x x f + + + =
( ) 640533 . 1 d
8 . 0
0
= =
}
x x f I (exact solution)
Metode I E
t
Simpson (n = 2) 1.367467 0.273067 (17%)
Simpson (n = 3) 1.51917 0.121363 (7%)
Simpson (n = 4) 1.623467 0.017067 (1%)
Pias tak seragam: metode trapesium
33
( )
5 4 3
2
400 900 675
200 25 2 . 0
x x x
x x x f
+
+ + =
i x
i
f(x
i
) 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
1 1 2
2
0 1
1

+
+ +
+
+
+
=
n n
n
x f x f
h
x f x f
h
x f x f
h I
( ) 594801 . 1 d
8 . 0
0
=
}
x x f
Pias tak seragam: metode Simpson
34
( )
5 4 3
2
400 900 675
200 25 2 . 0
x x x
x x x f
+
+ + =
i x
i
f(x
i
) 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
Metode Integrasi Numeris
35
Metode Jumlah pias Lebar pias
Trapesium 1
Trapesium multi pias n > 1 seragam
Simpson 2 seragam
Simpson multi pias genap (2m, m = 2,3,) seragam
Simpson 3 seragam
Kuadratur Gauss 1
Kuadratur Gauss
36
( ) x f
x
( ) x f
x
error terlalu besar upaya mengurangi error
Kuadratur Gauss
37
( ) x f
x
( )
0
x f
( )
1
x f
0
x
1
x 1 1
Kuadratur Gauss 2 Titik: Gauss-Legendre
( ) ( ) ( )
1 1 0 0
1
1
d x f c x f c x x f I + ~ =
}

( ) ( )
( ) ( )
( ) ( )
( ) ( ) 0 d
3 2 d
2 d
2 d 1
1
1
3
1 1 0 0
1
1
2
1 1 0 0
1
1
1 1 0 0
1
1
1 1 0 0
= = +
= = +
= = +
= = +
}
}
}
}

x x x f c x f c
x x x f c x f c
x x x f c x f c
x x f c x f c
unknowns : , , ,
1 0 1 0
x x c c
Kuadratur Gauss
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
38
( ) x f
x
( ) 1 = x f
( ) x x f =
2 d 1
1
1
=
}

x 0 d
1
1
=
}

x x
( ) x f
x
Kuadratur Gauss
0
1
2
-1.5 -1 -0.5 0 0.5 1 1.5
-3
-2
-1
0
1
2
3
-1.5 -1 -0.5 0 0.5 1 1.5
39
( ) x f
x
( )
2
x x f = ( )
3
x x f =
3 2 d
1
1
2
=
}

x x 0 d
1
1
3
=
}

x x
( ) x f
x
Kuadratur Gauss
40
( ) ( )
( ) ( )
( ) ( )
( ) ( ) 0 d
3 2 d
2 d
2 d 1
1
1
3
1 1 0 0
1
1
2
1 1 0 0
1
1
1 1 0 0
1
1
1 1 0 0
= = +
= = +
= = +
= = +
}
}
}
}

x x x f c x f c
x x x f c x f c
x x x f c x f c
x x f c x f c
( ) ( )
1 1 0 0
x f c x f c I + ~
3 1
3 1
1
1
0
1 0
=
=
= =
x
x
c c
( ) ( ) 3 1 3 1 f f I + ~
Kuadratur Gauss
41
Untuk batas integrasi dari a ke b:
diambil asumsi suatu variabel x
d
yang dapat dihubungkan dengan variabel asli
x dalam suatu relasi linear
d
x a a x
1 0
+ =
jika batas bawah, x = a, berkaitan dengan x
d
= 1
jika batas atas, x = b, berkaitan dengan x
d
= 1
( ) 1
1 0
+ = a a a
( ) 1
1 0
a a b + =
2
dan
2
1 0
a b
a
a b
a

=
+
=
( ) ( )
( )
d
d
x
a b
x
x a b a b
x
d
2
d
2

=
+ +
=
d
x a a x
1 0
+ =
Kuadratur Gauss
42
( )
5 4 3 2
400 900 675 200 25 2 . 0 x x x x x x f + + + =
( ) 640533 . 1 d
8 . 0
0
= =
}
x x f I (exact solution)
Penyelesaian dengan metode Kuadratur Gauss:
( ) ( )
d d
d
d
x x x
x
x
x
d 4 . 0 d
2
0 8 . 0
d
4 . 0 4 . 0
2
0 8 . 0 0 8 . 0
=

=
+ =
+ +
=
Kuadratur Gauss
43
( )
( ) ( ) ( )
( ) ( )
=

(
(

+ + +
+ + + + +
= + + +
}
}

1
1
5 4
3 2
8 . 0
0
5 4 3 2
d 4 . 0
4 . 0 4 . 0 400 4 . 0 4 . 0 900
4 . 0 4 . 0 675 4 . 0 4 . 0 200 4 . 0 4 . 0 25 2 . 0
d 400 900 675 200 25 2 . 0
d
d d
d d d
x
x x
x x x
x x x x x x
( )
( ) 305837 . 1 3 1
516741 . 0 3 1
= =
= =
d
d
x f
x f
( )
822578 . 1
305837 . 1 516741 . 0
d
8 . 0
0
=
+ =
~
}
x x f I
44

You might also like