Integrasi Numerik PDF
Integrasi Numerik PDF
Pengantar
Pengintegralan numerik merupakan alat
atau cara yang digunakan oleh ilmuwan
untuk memperoleh jawaban hampiran
(aproksimasi) dari pengintegralan yang
tidak dapat diselesaikan secara analitik.
Misalnya dalam termodinamik, model
Debye untuk menghitung kapasitas
panas dari benda padat.
INTEGRASI NUMERIK
Fungsi yang dapat dihitung integralnya :
ax n 1
ax dx n 1 C
n
ax
e
dx a C
ax
e
1
xdx ln | x | C
3
2 cos(1 x 2 )
2
1 0.5 sin x
e 0.5 x dx
0 ln | x |dx x ln | x | x C
INTEGRASI NUMERIK
Perhitungan integral adalah perhitungan
dasar yang digunakan dalam kalkulus,
dalam banyak keperluan.
digunakan untuk menghitung luas daerah
yang dibatasi oleh fungsi y = f(x) dan
sumbu x.
Penerapan integral : menghitung luas dan
volume-volume benda putar
Dasar Pengintegralan Numerik
Penjumlahan berbobot dari nilai fungsi
n
f ( x)dx ci f ( xi )
b
a
i 0
f(x) c0 f ( x0 ) c1 f ( x1 ) ... cn f ( xn )
x0 x1 xn-1 xn x
Dasar Pengintegralan Numerik
Melakukan penginteralan pada bagian-bagian kecil, seperti
saat awal belajar integral – penjumlahan bagian-bagian.
Metode Numerik hanya mencoba untuk lebih cepat dan
lebih mendekati jawaban eksak.
12
10
0
3 5 7 9 11 13 15
Dasar Pengintegralan Numerik
Formula Newton-Cotes
- Berdasarkan pada
b b
I f ( x )dx fn ( x )dx
a a
fn ( x ) a0 a1 x an1 x n1 an x n
fn (x) bisa fungsi linear
fn (x) bisa fungsi kuadrat
fn (x) bisa juga fungsi kubik atau
polinomial yang lebih tinggi
Polinomial dapat didasarkan pada data
INTEGRASI NUMERIK
Luas daerah yang
diarsir L dapat
dihitung dengan :
L= b
f x dx
a
Metode Integral Reimann
0.5
x*cos(3*x)*exp(-2*x)+0.35
x*cos(3*x)*exp(-2*x)+0.35
0.45
0.4
0.35
0.3
0.25
0.2
0 0.5 1 1.5 2 2.5 3
Metode Integral Reimann
Luasan yang dibatasi y = f(x) dan
sumbu x
Luasan dibagi menjadi N bagian pada
range x = [a,b]
Kemudian dihitung Li : luas setiap
persegi panjang dimana Li=f(xi). xi
Metode Integral Reimann
Luas keseluruhan adalah jumlah Li dan
dituliskan :
L L0 L1 L2 .. Ln
f x0 x0 f x1 x1 f x2 x 2 ... f x n x3
n
f xi xi
i 0
0.8
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Contoh
Dengan mengambil h=0.1 maka diperoleh tabel :
10
L h. f ( xi )
i 0
0.10 0.01 0.04 0.09 0.16 0.25 0.36 0.49 0.64 0.81 1.00
0.13,85 0,385 1
1
Secara kalkulus :
L x 2 dx x 3 |10 0,3333.....
0 3
Terdapat kesalahan e = 0,385-0,333
= 0,052
Algoritma Metode Integral
Reimann:
Definisikan fungsi f(x)
Tentukan batas bawah dan batas ata
integrasi
Tentukan jumlah pembagi area N
Hitung h=(b-a)/N
Hitung N
L h. f ( xi )
i 0
Metode Integrasi Trapezoida
Aproksimasi garis lurus (linier)
1
f ( x )dx c i f ( x i ) c0 f ( x0 ) c 1 f ( x1 )
b
a
i 0
f ( x0 ) f ( x 1 )
h
2
f(x)
L(x)
x0 x1 x
Contoh: Aturan Trapesium
Hitung integral dari
4
xe dx
2x
0
Solusi eksak
4
4 x 2x 1 2x
xe dx e e
2x
0
2 4 0
4
1 2x
e (2 x 1) 5216.926477
4 0
Aturan trapesium
4 0
f (0 ) f ( 4 ) 2(0 4 e 8 ) 23847.66
4
I xe dx
2x
0 2
5216.926 23847.66
357.12%
5216.926
Aturan Komposisi
Trapesium
b x1 x2 xn
a
f ( x )dx f ( x )dx f ( x )dx
x0 x1 xn 1
f ( x )dx
h
f ( x0 ) f ( x 1 ) h f ( x 1 ) f ( x 2 ) h f ( x n 1 ) f ( x n )
2 2 2
f ( x0 ) 2 f ( x1 ) 2f ( x i ) 2 f ( x n1 ) f ( x n )
h
2
f(x)
ba
h
n
x0 h x1 h x2 h x3 h x4 x
Metode Integrasi
Trapezoida
Li f xi f xi 1 .xi
1
2
atau 1
Li f i f i 1 .xi
1 L Li
2 i 0
n 1
L h f i f i 1 f 0 2 f1 2 f 2 ... 2 f n1 f n
1 h
i 0 2 2
h n 1
L f 0 2 f i f n
2 i 1
Algoritma Metode
Integrasi Trapezoida
Definisikan y=f(x)
Tentukan batas bawah (a) dan batas
atas integrasi (b)
Tentukan jumlah pembagi n
Hitung h=(b-a)/n
Hitung h n 1
L f 0 2 f i f n
2 i 1
Aturan Komposisi Trapesium
function f = example1(x)
2 % a = 0, b = pi
x sin( 2 x )dx f=x.^2.*sin(2*x);
0
Aturan Komposisi Trapesium
» a=0; b=pi; dx=(b-a)/100; » I=trap('example1',a,b,64)
» x=a:dx:b; y=example1(x); I =
» I=trap('example1',a,b,1) -4.9308
I = » I=trap('example1',a,b,128)
-3.7970e-015 I =
» I=trap('example1',a,b,2) -4.9338
I = » I=trap('example1',a,b,256)
-1.4239e-015 I =
» I=trap('example1',a,b,4) -4.9346
I = » I=trap('example1',a,b,512)
-3.8758 I =
» I=trap('example1',a,b,8) -4.9347
I = » I=trap('example1',a,b,1024)
-4.6785 I =
» I=trap('example1',a,b,16) -4.9348
I = » Q=quad8('example1',a,b)
-4.8712 Q =
» I=trap('example1',a,b,32) -4.9348 MATLAB
I =
-4.9189
function
0
x 2 sin( 2 x )dx
n=2
I = -1.4239 e-15
Exact = -4. 9348
0
x 2 sin( 2 x )dx
n=4
I = -3.8758
Eksak = -4. 9348
0
x 2 sin( 2 x )dx
n=8
I = -4.6785
Eksak = -4. 9348
0
x 2 sin( 2 x )dx
n = 16
I = -4.8712
Eksak = -4. 9348
Aturan Komposisi Trapesium
4
Hitung integral dari I xe dx
2x
0
n 1, h 4 I
h
f (0 ) f ( 4 ) 23847.66 357.12%
2
n 2, h 2 I f (0 ) 2 f ( 2 ) f ( 4 ) 12142.23
h
132.75%
2
n 4 , h 1 I f (0 ) 2 f ( 1) 2 f ( 2 )
h
2
2 f ( 3 ) f ( 4 ) 7288.79 39.71%
n 8, h 0.5 I
h
f (0 ) 2 f (0.5 ) 2 f ( 1)
2
2 f ( 1.5 ) 2 f ( 2 ) 2 f ( 2.5 ) 2 f ( 3 )
2 f ( 3.5 ) f ( 4 ) 5764.76 10.50%
n 16 , h 0.25 I
h
f (0 ) 2 f (0.25 ) 2 f (0.5 )
2
2 f ( 3.5 ) 2 f ( 3.75 ) f ( 4 ) 5355.95 2.66%
Aturan Komposisi Trapesium
» x=0:0.04:4; y=example2(x);
» x1=0:4:4; y1=example2(x1);
» x2=0:2:4; y2=example2(x2);
» x3=0:1:4; y3=example2(x3);
» x4=0:0.5:4; y4=example2(x4);
» H=plot(x,y,x1,y1,'g-*',x2,y2,'r-s',x3,y3,'c-o',x4,y4,'m-d');
» set(H,'LineWidth',3,'MarkerSize',12);
» xlabel('x'); ylabel('y'); title('f(x) = x exp(2x)');
» I=trap('example2',0,4,1)
I =
2.3848e+004
» I=trap('example2',0,4,2)
I =
1.2142e+004
» I=trap('example2',0,4,4)
I =
7.2888e+003
» I=trap('example2',0,4,8)
I =
5.7648e+003
» I=trap('example2',0,4,16)
I =
5.3559e+003
Aturan Komposisi Trapesium
4
I xe 2 x dx
0
Aturan Simpson 1/3
Aproksimasi dengan fungsi parabola
2
f ( x )dx c i f ( x i ) c0 f ( x0 ) c 1 f ( x1 ) c 2 f ( x 2 )
b
a
i 0
h
f ( x0 ) 4 f ( x 1 ) f ( x 2 )
3
L(x)
f(x)
x0 h x1 h x2 x
Aturan Simpson 1/3
( x x1 )( x x 2 ) ( x x0 )( x x 2 )
L( x ) f ( x0 ) f ( x1 )
( x0 x1 )( x0 x 2 ) ( x1 x0 )( x 1 x 2 )
( x x0 )( x x1 )
f ( x2 )
( x 2 x0 )( x 2 x1 )
ab
let x0 a, x 2 b, x 1
2
ba x x1 dx
h , , d
2 h h
x x0 1
x x1 0
x x 1
2
( 1) ( 1)
L( ) f ( x0 ) ( 1 2 ) f ( x 1 ) f ( x2 )
2 2
Aturan Simpson 1/3
( 1) ( 1)
L( ) f ( x0 ) ( 1 ) f ( x 1 )
2
f ( x2 )
2 2
b 1 h 1
a
f ( x)dx h L( )dξ f ( x0 ) ξ (ξ 1)dξ
1 2 1
1 h 1
f ( x1 )h ( 1 ξ )dξ f ( x2 ) ξ (ξ 1)dξ
2
0 2 1
1 1
h ξ ξ 3 2
ξ 3
f ( x0 ) ( ) f ( x1 )h(ξ )
2 3 2 1 3 1
1
h ξ ξ 3 2
f ( x2 ) ( )
2 3 2 1
f ( x )dx f ( x0 ) 4 f ( x1 ) f ( x2 )
b h
a 3
Aturan Komposisi
Simpson
ba
h
n
f(x)
…...
x0 h x1 h x2 h x3 h x4 xn-2 xn-1 xn x
Metode Integrasi Simpson
Dengan menggunakan aturan simpson, luas
dari daerah yang dibatasi fungsi y=f(x) dan
sumbu X dapat dihitung sebagai berikut:
N=0–n
L = L1 + L3 + L5 + . . . + Ln
h
L f 0 4 f i 2 f i f n
3 i ganjil i genap
Cara II
(Buku Rinaldi Munir)
x x( x h) 2 x x ( x h) 2
p 2 x f ( x0 ) f ( x0 ) 2
f ( x 0 ) f 0 f 0 2
f0
h 2!h h 2!h
Cara II
(Buku Rinaldi Munir)
Integrasikan p2(x) pd selang [0,2h]
2h 2h
L f ( x)dx p
0 0
2 xdx
x ( x h) 2
2h
x
L f 0 f 0 f 0 dx
0
2
h 2!h
x2 x3 x2 2
L f0 x f 0 2 2 f 0 | xx 02 h
2h 6h 4h
4h 2 8h 3 4 h 2 2
L 2hf 0 x f 0 2 f 0
2h 6h 4h
4h
L 2hf 0 x 2hf 0 h 2 f 0
3
h
L 2hf 0 x 2hf 0 2 f 0
3
Cara II
(Buku Rinaldi Munir)
Mengingat f 0 f1 f 0
2 f 0 f1 f 0 ( f 2 f1 ) ( f1 f 0 ) f 2 2 f1 f 0
Maka selanjutnya
h
L 2hf 0 x 2h( f1 f 0 ) ( f 2 2 f1 f 0 )
3
h 2h h
L 2hf 0 x 2hf1 2hf 0 f 2 f1 f 0
3 3 3
h 4h h
L f0 f1 f 2
3 3 3
h
L ( f 0 4 f1 f 2 )
3
Aturan Simpson 3/8
Aproksimasi dengan fungsi kubik
3
f ( x )dx c i f ( x i ) c0 f ( x0 ) c 1 f ( x1 ) c 2 f ( x 2 ) c 3 f ( x 3 )
b
a
i 0
3h
f ( x0 ) 3 f ( x 1 ) 3 f ( x 2 ) f ( x 3 )
8
L(x) f(x)
x0 h x1 h x2 h x3 x
Aturan Simpson 3/8
( x x1 )( x x 2 )( x x 3 ) ( x x0 )( x x 2 )( x x 3 )
L( x ) f ( x0 ) f ( x1 )
( x0 x1 )( x0 x 2 )( x0 x 3 ) ( x1 x0 )( x1 x 2 )( x1 x 3 )
( x x0 )( x x1 )( x x 3 ) ( x x0 )( x x1 )( x x 2 )
f ( x2 ) f ( x3 )
( x 2 x0 )( x 2 x1 )( x 2 x 3 ) ( x 3 x0 )( x 3 x1 )( x 3 x 2 )
b b ba
a
f(x)dx
a
L(x)dx ; h
3
3h
f ( x0 ) 3 f ( x 1 ) 3 f ( x 2 ) f ( x 3 )
8
Error Pemenggalan
3 5 (4) ( b a) 5 ( 4 ) ba
Et h f ( ) f ( ) ; h
80 6480 3
Metode Integrasi Gauss
Metode Newton Code (Trapezoida,
Simpson) berdasarkan titik2 data
diskrit. Dengan batasan :
H sama
Luas dihitung dari a sampai b
Mengakibatkan error yang dihasilkan
cukup besar.
Metode Integrasi Gauss
Misal menghitung Luas dengan metode trapezoida dengan selang
[-1,1] 1
I f ( x)dx f (1) f (1) f (1) f (1)
h
1
2
h2
Persamaan ini dapat ditulis (disebut pers Kuadratur Gauss)
1
I f ( x)dx c
1
1 f ( x1 ) c2 f ( x2 )
c1 c 2 1dx 2
1
I f ( x)dx c
1
1 f ( x1 ) c2 f ( x2 )
1
c1 x1 c 2 x 2 xdx 0
1
Didapat
c1 c 2 1
1
c1 x12 c 2 x 22 x 2 dx 2
3 1 1
1 x1 x2
1 3 3
c x c 2 x x dx 0
3
1 1
3
2
3
1
Metode Integrasi Gauss
Persamaan dibawah ini dinamakan
metode Gauss Legendre 2 titik
1
1
1
f ( x)dx f (
1 3
) f(
3
)
Transformasi
1
Li g (u )du
b
Li f ( x)dx 1
a
1
g (u ) (b a) f 12 (b a)u 12 (b a)
2
(a b) (b a)u
1 1
1
1 g (u ) du
2
(b a)
1
f
2
du
Analisa
Dibandingkan dengan metode Newton-Cotes
(Trapezoida, Simpson 1/3, 3/8) metode Gauss-
Legendre 2 titik lebih sederhana dan efisien
dalam operasi aritmatika, karena hanya
membutuhkan dua buah evaluasi fungsi.
Lebih teliti dibandingkan dengan metode Newton-
Cotes.
Namun kaidah ini harus mentransformasi terlebih
dahulu menjadi
1
g (u)du
1
Algoritma Integrasi Kuadratur
Gauss dengan Pendekatan 2 titik
Definisikan fungsi f(x)
Tentukan batas bawah (a) dan batas atas
integrasi (b)
Hitung nilai konversi variabel :
x
1
b a u 1 (b a)
2 2
Tentukan fungsi g(u) dengan:
(b a) f 12 (b a)u 12 (b a)
1
g (u )
2
1 1
Hitung L g g
3 3
Contoh Soal
Metode Gauss Legendre 3
Titik
1
I f ( x)dx c
1
1 f ( x1 ) c2 f ( x2 ) c3 f ( x3 )
5 3 8 5 3
1
Skala 1:100000
0 5 10 15
Untuk menghitung luas integral di peta di atas, yang perlu dilakukan adalah menandai
atau membuat garis grid pada setiap step satuan h yang dinyatakan dalam satu kotak.
Bila satu kotak mewakili 1 mm, dengan skala yang tertera maka berarti panjangnya
adalah 100.000 mm atau 100 m.
Pada gambar di atas, mulai sisi kiri dengan grid ke 0 dan sisi kanan grid ke n (dalam hal
ini n=22). Tinggi pada setiap grid adalah sebagai berikut:
Menghitung Luas Daerah
Berdasarkan Gambar
Dari tabel di atas, luas area dapat dihitung
dengan menggunakan 3 macam metode:
Dengan menggunakan metode integrasi Reimann
16
L h yi 73.5
i 0
a
5
Contoh :
cm
7 I II III IV
cm
6 12 7
cm cm cm
4
cm satuan dalam cm
h 4
LII ( LIV ) 2 y0 y5 2 yi 108
2 i 1
h 2 4
VII VIV y0 y5 2 yi2 1187.5
2
2 i 1
Contoh :
Luas permukaan dari botol adalah:
L LI LII LIII LIV
56 108 288 108
560
Luas = 1758.4 cm2 1758.4
Volume botol adalah: V VI VII VIII VIV
196 1187.5 1728 1187.5
4299