Anda di halaman 1dari 45

Integrasi Numerik

Pendahuluan
• Pengintegralan numerik merupakan alat atau
cara yang digunakan untuk memperoleh
jawaban hampiran (aproksimasi) dari
pengintegralan yang tidak dapat diselesaikan
secara analitik.
– Respons struktur berupa perpindahan, kecepatan,
dan percepatan
– 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

e ax
 e dx  a  C
ax

1
 sin( ax  b ) dx   a cos( a  b )  C
1
 cos( ax  b ) dx 
a
sin( a  b )  C

1
 x dx  ln | x |  C
 ln | x |dx  x ln | x |  x  C
Integrasi Numerik
• Fungsi yang rumit:

2 3
2  cos(1  x ) 2


0,5 x
e dx
0 1  0,5 sin x
Integrasi Numerik
• Perhitungan integral adalah perhitungan
dasar yang digunakan dalam kalkulus
digunakan untuk menghitung luas
daerah yang dibatasi oleh fungsi y = f(x)
dan sumbu x.
• Penerapan integral:
– menghitung luas dan volume benda putar
Dasar Pengintegralan Numerik
• Penjumlahan berbobot
n
dari nilai fungsi
b
 f ( x)dx   ci f ( xi )
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
(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   f n ( x)dx
a a

• Nilai hampiran f(x) dengan polinomial

f n ( x )  a 0  a1 x    a n 1 x n 1  a n 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:


b
L   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]
• Hitung 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  x 2  x 2  ...  f  x n  x3
n
  f  xi xi
i 0

Dimana: x  x  x  ...  x  h
0 1 2 n
Didapat:
b n
 f  x dx  h f  xi 
a i 0
Contoh
• Hitung luas yang dibatasi y = x2 dan sumbu x untuk range x=[0,1]
1
L  
0
x 2 dx
1
x**2

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
Penyelesaian
• Ambil h=0,1 maka diperoleh:
x 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1
f(x) 0 0,01 0,04 0,09 0,16 0,25 0,36 0,49 0,64 0,81 1

10
L  h. f ( x i )
i0

 0 ,1 0  0 ,01  0 , 04  0 , 09  0 ,16  0 , 25  0 ,36  0 , 49  0 , 64  0 ,81  1, 00 


  0 ,1 3,85   0 ,385

1
• Solusi eksak: 1
L   x 2 dx  x 3 |10  0,3333.....
0 3

0,333  0,385
• Kesalahan:  x100%  15,61%
0,333
Algoritma Metode Integral
Reimann
• Definisikan fungsi f(x)
• Tentukan batas bawah dan batas atas
integrasi
• Tentukan jumlah pembagi area N
• Hitung: h   b  a 
N
N
• Hitung: L  h. f ( xi )
i 0
Metode Integrasi Trapezoida
• Aproksimasi garis lurus (linier)
1
f ( x)dx   ci f ( xi )  c0 f ( x0 )  c1 f ( x1 )
b
a
i 0

h
  f ( x0 )  f ( x1 )
2
f(x)

L(x)

x0 x1 x
Aturan Komposisi Trapesium
b x1 x2 xn

 f  x dx   f  x dx   f  x dx  ...   f  x dx


a x0 x1 xn 1

h
  f  x0   f  x1   h  f  x1   f  x2   ...  h  f  x n1   f  xn 
2 2 2
h
  f  x0   2 f  x1   ...2 f  xi   ...  2 f  x n 1   f  x n 
2
f(x)

ba
h
n

x
x0 h x1 h x2 h x3 h x4
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 
Metode Integrasi Simpson
• Luas daerah yang dibatasi fungsi y=f(x) dan
sumbu x dapat dihitung:
N=0–n
L = L1 + L3 + L5 + . . . + Ln

h
L  f0  2 f1   h  2 f1  f2   h  f2  2 f3   h  2 f3  f4  ... h  fn2  2 fn1 
3 3 3 3 3
h
  2 fn1  fn 
3
atau:
h 
L   f 0  4  f i  2  f i  f n 
3 i ganjil i genap 
Aturan Simpson 1/3
• Aproksimasi dengan fungsi parabola
2
f ( x)dx   ci f ( xi )  c0 f ( x0 )  c1 f ( x1 )  c 2 f ( x 2 )
b

a
i 0

h
  f ( x0 )  4 f ( x1 )  f ( x2 )
3
L(x)
f(x)

x0 h x1 h x2 x
Aturan Komposisi Simpson
ba
h
n
f(x)

…...

x0 h x1 h x2 h x3 h x4 xn-2 xn-1 xn x
Aturan Simpson 1/3

(x  x1)(x  x2 ) (x  x0 )(x  x2 ) (x  x0 )(x  x1)


L(x)  f (x0 )  f (x1)  f (x2 )
(x0  x1)(x0  x2 ) (x1  x0 )(x1  x2 ) (x2  x0 )(x2  x1)

ab
let x0  a, x 2  b, x1 
2
ba x  x1 dx
h ,  , d 
2 h h
 x  x0    1

 x  x1    0
 x  x  1
 2

 (  1)  (  1)
L( )  f ( x 0 )  (1   ) f ( x1 ) 
2
f ( x2 )
2 2
Aturan Simpson 1/3
 (  1)  (  1)
L( )  f ( x0 )  (1   2 ) f ( x1 )  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
3 2 1 3 1 3 2 1
h ξ ξ ξ h ξ ξ
 f ( x0 ) (  )  f ( x1 )h(ξ  )  f ( x2 ) (  )
2 3 2 1 3 1 2 3 2 1
b
h
 f  x  dx   f ( x0 )  4 f ( x1 )  f ( x 2 )
a
3
Aturan Simpson 3/8
• Aproksimasi dengan fungsi kubik
3

 f ( x ) dx   c f ( x )  c f  x   c f  x   c f  x   c f  x 
b
i i 0 0 1 1 2 2 3 3
a
i0

3h
  f ( x 0 )  3 f ( x1 )  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  x2 )(x  x3 ) (x  x0 )(x  x2 )(x  x3 )
L(x)  f (x0 )  f (x1)
(x0  x1)(x0  x2 )(x0  x3 ) (x1  x0 )(x1  x2 )(x1  x3 )
(x  x0 )(x  x1)(x  x3 ) (x  x0 )(x  x1)(x  x2 )
 f (x2 )  f (x3 )
(x2  x0 )(x2  x1)(x2  x3 ) (x3  x0 )(x3  x1)(x3  x2 )

b b ba
a
f(x)dx  
a
L(x)dx ; h 
3
3h
  f ( x0 )  3 f ( x1 )  3 f ( x2 )  f ( x3 )
8
• Error pemenggalan
3 5 (b  a ) 5
ba
Et   h f ( 4)
( )   f ( ) ; h 
( 4)

80 6480 3
Interpolasi Newton-Gregory

• Polinom interpolasi Newton-Gregory


derajat 2 yang melalui ketiga titik tersebut
x x ( x  h) 2
p 2 x  f ( x0 )  f ( x0 )  2
 f ( x0 )
h 2!h
x x ( x  h) 2
 f0  f0  2
 f0
h 2!h
Interpolasi Newton-Gregory

• Integrasikan p2(x) pada selang [0,2h]


2h 2h
L  f ( x)dx   p
0 0
2 xdx

2h
 x x ( x  h) 2 
L    f 0  f 0  2
 f 0 dx
0
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 4h 2  2
L  2hf 0 x  f 0   2   f 0
2h  6h 4h 
 4h  h
L  2hf 0 x  2hf 0    h 2 f 0  2hf 0 x  2hf 0  2 f 0
 3  3
Interpolasi Newton-Gregory
• 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:
h
L  2 hf 0 x  2 h ( f 1  f 0 )  ( f 2  2 f 1  f 0 )
3
h 2h h
L  2 hf 0 x  2 hf 1  2 hf 0  f 2  f1  f 0
3 3 3
h 4h h h
L  f0  f1  f 2  ( f 0  4 f1  f 2 )
3 3 3 3
Metode Integrasi Gauss
• Metode Newton-Codes (Trapezoida,
Simpson), berdasarkan titik-titik 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
h
I   f (x)dx   f (1)  f (1)  f (1)  f (1)
1
2
h2
• Persamaan ini dapat ditulis (persamaan Kuadratur Gauss)

1
I  f ( x)dx c
1
1 f ( x1 )  c 2 f ( x 2 )
• Misal x1=-1, x2=1 dan c1=c2=1  menjadi metode trapezoida
• Karena x1, x2,,c1 dan c2 sembarang, maka nilai tersebut harus dipilih
sehingga error integrasinya minimal.
Metode Integrasi Gauss
• Bagaimana mencari x1, x2,,c1 dan c2. Persamaan di bawah ini
dianggap memenuhi secara tepat bila empat polinom berikut
dijadikan fungsi integral pada interval integrasi [-1, 1]
• f(x) = 1 ; f(x) = x ; f(x) = x2 ; f(x) = x3
1 1
c1  c 2   1dx  2
1
I  f ( x)dx c
1
1 f ( x1 )  c 2 f ( x 2 )
1
c1 x1  c 2 x 2   xdx  0
1
Didapat: c1  c 2  1
1
1
c x  c 2 x   x dx  2
2 2 2 x1 
1 1 2 3 3
1
1 1
c1 x13  c 2 x 23   x 3 dx  0 x2 
1
3
Metode Integrasi Gauss
• Persamaan metode Gauss-Legendre 2 titik
1
1 1

1
f ( x)dx  f (
3
) f(
3
)
Transformasi

b 1
Li   f ( x)dx Li   g (u )du
a 1

• Range [a,b]  [-1,1]


• xu
• f(x)  g(u)
• dx du
Transformasi

x  a u 1

ba 2
2 x  2a  (u  1)(b  a) a x b
2 x  (u  1)(b  a )  2a
a  b  bu  au
x
2
-1 u 1
(a  b)  (b  a )u
x
2
ba
dx   du
 2 
Transformasi
1
Li   g (u )du
1

g (u )  (b  a ) f  12 (b  a )u  12 (b  a) 
1
2

1 1
1  (a  b)  (b  a )u 
1 g (u )du  2 (b  a)1 f  2
du

Analisis
• Metode Gauss-Legendre 2 titik lebih sederhana
dan efisien dalam operasi aritmatika
dibandingkan dengan metode Newton-Cotes
(Trapezoida, Simpson 1/3, Simpson 3/8), karena
hanya membutuhkan dua buah evaluasi fungsi.
• Metode Gauss-Legendre 2 titik lebih teliti
dibandingkan dengan metode Newton-Cotes.
• Namun kaidah ini harus mentransformasi
terlebih dahulu menjadi
1

 g (u )du
1
Algoritma Integrasi Kuadratur
Gauss Pendekatan 2 titik
• Definisikan fungsi f(x)
• Tentukan batas bawah (a) dan batas atas integrasi (b)
• Hitung nilai konversi variabel:

1
x  b  a  u  1 (b  a)
2 2
• Tentukan fungsi g(u) dengan:

g (u )  (b  a ) f  12 (b  a )u  12 (b  a ) 
1
2
• Hitung:
 1   1 
L  g     g  
 3  3
Contoh Soal
Metode Gauss-Legendre 3 Titik
1
I  f ( x)dx c
1
1 f ( x1 )  c 2 f ( x 2 )  c3 f ( x3 )

• Parameter x1, x2 , x3 ,c1 ,c2 dan c3 dapat dicari dengan membuat


penalaran bahwa kuadratur Gauss bernilai tepat untuk 6
buah fungsi berikut:
f ( x)  1; f ( x)  x; f ( x)  x 2
f ( x)  x 3 ; f ( x)  x 4 ; f ( x)  x 5
• Dengan cara yang sama didapat
5 8 5
c1  ; c 2  ; c3 
9 9 9
x1   3 5 ; x 2  0; x3  3 5
Metode Gauss Legendre 3 Titik

5  3 8 5  3
1

1 g (u )du  9 g   5   9 g  0  9 g  5 
   
Algoritma Metode Integrasi Gauss
dengan Pendekatan 3 Titik
• Definisikan fungsi f(x)
• Tentukan batas bawah (a) dan batas atas integrasi (b)
• Hitung nilai konversi variabel:

1 1
x   b  au   b  a 
2
• Tentukan fungsi2 g(u) dengan:

gu 
1
 b  a  f  1  b  a  u  1  b  a  
• Hitung: 2 2 2 
8 5  3 5  3
L  g  0  g     g 
9 9  5  9  5 
 
Terima Kasih

Anda mungkin juga menyukai