Anda di halaman 1dari 38

METODE NUMERIK UNTUK

SOLUSI (AKAR)
PERSAMAAN

PENYELESAIAN PERSAMAAN
Banyak permasalahan keteknikan dalam
bentuk persamaan non-linier, CONTOH:
Koefisien gesek pada saluran


9.3
1.14 2 log D 2 log 1

Re

/
D
f

PENYELESAIAN PERSAMAAN
Dalam menyelesaikan persamaan implisit
mencari akar persamaan:

f ( x) 0

AKAR PERSAMAAN
Akar suatu persamaan merupakan
bilangan yang memenuhi suatu
persamaan
Pada persamaan-persamaan linier
atau persamaan kuadrat, akar dari
persamaan dapat dicari dengan
2
mudah:
x 4x 3 0

Find the root of an equation


What Goes
Wrong?

Tangent point:
very difficult
to find

CSE 330: Numerical Methods

Singularity:
brackets dont
surround root

Pathological case:
infinite number of
roots e.g. sin(1/x)

10/11/15

Find the root of an equation


Different approaches to solve
equations:
Bisection Method
Iteration (fixed point) Method
Newton-Raphson Method

CSE 330: Numerical Methods

these

10/11/15

METODE NUMERIK UNTUK


MENCARI AKAR (1
VARIABEL)

1. Bisection method

Metode Ini lebih sederhana, akan tetapi memerlukan iterasi yang lebih banyak
(konvergensi lebih lama)

ALGORITMA sbb:
Menetapkan dua batas nilai. Batas tidak boleh melalui dua titik potong
pada absis. Uji f(bawah) dan f(atas), f dari batas tersebut harus berbeda
tanda. Jika f(bawah)>f(atas) maka fungsi turun
Hitung beda/2 dan nilai tengah
Hitung f (n tengah)
Hitung beda baru = beda lama/2
Untuk f(x) naik ketika memotong, maka apabila f(ntengah) < 0 maka
ntengah baru = ntengah lama + beda jika f (ntengah)>0 maka ntengah
lama - beda
Untuk f(x) turun ketika memotong, maka apabila f(ntengah) < 0 maka
ntengah baru = ntengah lama - beda jika f (ntengah)>0 maka ntengah
lama + beda

Bisection Method
f(x) is continuous between xa and xb
f(b) is positive

The root of this equation


f(a) negative

CSE 330: Numerical Methods

10/11/15

Bisection Method
f(b) is positive

xc= (a+b)/2

f(c) negative

f(a) negative

CSE 330: Numerical Methods

What will be the next interval?


10

10/11/15

Contoh 1:
Selesaikan x3+6x-3=0 dengan metode bisection

Bisection Method
Theorem:

If function f(x) in f(x)=0 does not change sign between


two points, roots may still exist between the two points.

f(x)

CSE 330: Numerical Methods

xu

12

10/11/15

Bisection Method
Theorem:

If the function f(x) in f(x)=0 does not change sign


between two points, there may not be any roots
between the two points.

f(x)

f(x)

x
x

CSE 330: Numerical Methods

xu

xu
x

13

10/11/15

Bisection Method
Theorem:

If the function f(x) in f(x)=0 changes sign between two


points, more than one root may exist between the two
points.

f(x)

xu

CSE 330: Numerical Methods

14

10/11/15

Bisection Method
If the function f(x) is not continuous between a and b, but f(a)
and f(b) has opposite signs, then there may not exist any root
between a and b.

1
f x
x

f(x)

CSE 330: Numerical Methods

15

10/11/15

Bisection Method
Advantages:

Disadvantages:

Simple and easy to


implement

We need two initial guesses a and b


which bracket the root.

One function
evaluation per iteration

Slowest method to converge to the


solution.

No knowledge of the
derivative is needed

When an interval contains more than


one root, the bisection method can find
only one of them.

CSE 330: Numerical Methods

16

10/11/15

2. Iteration Method (fixed point


method)

Suppose we have an equation in the form g(x) = 0


Rewrite the equation in the form x = f(x).
Start with an initial guess x0, which is an approximation of the
root.
Calculate x1, ..., xn,... such that
x1 = f(x0)
x2= f(x1)
x3= f(x2) ...
Iterate the same process until (xn xn-1) smaller than some
specified tolerance.
Geometrically, where the two graphs x and f(x) intersects, that is
the real root of the equation.

CSE 330: Numerical Methods

17

10/11/15

Iteration Method: Convergence


Conditions
The equation x = f(x) converges to the real root x,
if f(x) is continuous
If | f (x) | < 1 For all x in [a,b]
The equation x = f(x) does not converges to the real root x if | f
(x) | > 1 (TIDAK SELALU (Lihat contoh 2)), kecuali jika | f (x) |
memang dalam bentuk yang tidak mungkin <1
Therefore, g(x) = 0 has to be re-written as x = f(x) in such a way
that | f (x) | < 1
For all x in [a,b]

CSE 330: Numerical Methods

18

10/11/15

Contoh 2:
Selesaikan x3+6x-3=0 dengan metode
iterasi (fixed point)
Gunakan nilai awal: 0,5; 2,2 dan 2,6

Iteration Method: Convergence


Conditions
Convergence of xn+1 = f(xn), when | f (x) | < 1

y=f(x)

The root of this equation


CSE 330: Numerical Methods

20

10/11/15

Iteration Method: Convergence


Conditions
xn+1 = f(xn) oscillates but ultimately converges, when | f (x) | < 1, but f
(x) < 0
y=f(x)

The root of this equation

CSE 330: Numerical Methods

21

10/11/15

Iteration Method: Convergence


Conditions
xn+1 = f(xn) diverges, when f (x) > 1

y=f(x)

The root of this equation


CSE 330: Numerical Methods

22

10/11/15

Iteration Method: Convergence


Conditions
xn+1 = f(xn) diverges, when f (x) > 1

y=f(x)
The root of this equation

CSE 330: Numerical Methods

23

10/11/15

Latihan
Gambarlah kurva y=x dan y=f(x) pada
contoh 2

Contoh 3:
Find the real root of the equation using
iterative method (till 4 decimal places).
e-x = 10x

Answer: 0.091276527

Newton Raphson
This method is more efficient than the Bisection
and Iteration methods.
If
x is the real root and x0 is an initial approximation of
the real root of an equation f(x) = 0,
f (x0) 0,
f(x) has the same sign between x0 and x,

Then, the tangent at f(x0) can lead to the real root


x.

Newton-Raphson Method: Geometric


Significance
f(x0)

tangent at f(x0)

The initial guess


f(x1)
CSE 330: Numerical Methods

27

10/11/15

Newton-Raphson Method: Geometric


Significance
Here,
The slope at x0 is tan (PTM)

tan (PTM) = PM/TM


tan (PTM) = f (x0)/h

Again, tan (PTM) = f (x0)

Therefore, f (x0) = f (x0)/h

Or, h = f (x0)/ f (x0)

x1 = x0 h

Therefore, x1 = x0 f (x0)/ f (x0)

Similarly, x2 = x1 f (x1)/ f (x1)

CSE 330: Numerical Methods

28

10/11/15

Newton-Raphson Method
Methodology
Let x0 be an approximate root of f(x) = 0 and
Let, x1 is the correct root such that x1 = x0 + h
and f(x1) = 0.
2
h
Expanding
series,
f ( x0 ) f(x
hf0+h)
( x0 ) by Taylors
f ( x0 ) ...
0 we obtain,
2!

f ( x0 ) hf ( x0 ) 0

Neglecting the second and higher order


derivatives, we have
f ( x0 )
h
f ( x0 )
Which gives
CSE 330: Numerical Methods

29

10/11/15

Newton-Raphson Method (Contd.)


A better approximation than x0 is therefore given by x1 where

f ( x0 )
x1 x0 h x0
f ( x0 )

Successive approximation are given by x2, x3, .., xn, xn+1


f ( xn )
where

xn 1 xn

f ( xn )

This formula is known as the Newton-Raphson formula.

CSE 330: Numerical Methods

30

10/11/15

Contoh 4:
Selesaikan x3+6x-3=0 dengan metode
Newton Rahpson

MENCARI AKAR UNTUK DUA


VARIABEL ATAU LEBIH
Dua metode diantaranya adalah:
Substitusi suksesif
Newton Raphson

Metode Newton-Raphson
untuk variabel lebih dari satu
f1 ( x1 , x2 , x3 ) 0
f 2 ( x1 , x2 , x3 ) 0

3 persamaan, 3 variabel

f 3 ( x1 , x2 , x3 ) 0
Langkah-langkah yang diperlukan adalah:
1. Berikan nilai trial: x1t x2t. x3t
2. Hitung nilai f1,f2 dan f3.
3. Hitung nilai turunan parsial pada x1t x2t. X3t
4. Gunakan ekspansi deret Taylor

Metode Newton-Raphson
f1 ( x1t , x2t , x3t ) f1 ( x1c , x2 c , x3c )

f1 ( x1t , x2t , x3t )


x1t x1c
x1

f1 ( x1t , x2t , x3t )


f1 ( x1t , x2t , x3t )
x2 t x2 c
x 2 t x2 c

x2
x3
f1 ( x1c , x2 c , x3c ) 0
Jika x1c, x2c x3c benar maka
Sehingga persamaan dapat ditulis sebagai
f1

x1
f1
x1
f
1
x1

f1
x2
f1
x2
f1
x2

f1

x3
f1
x3
f1
x3

x1t x1c f1
x x f
2c
2t
2
x3t x3c f 3

Matriks suku pertama ruas kiri disebut Jacobian


matriks atau J
5. Pecahkan matriks untuk mencari: (xit xic)

6. Koreksi nilai x dengan

x1new x1old x1t x1c

7. Ulangi sampai x /x mendekati nol

Contoh:
Jika sistem operasi kipas dan saluran:
SP=80+10.73Q1.8
Q=15-(73.5x10-6)SP2
Ket: SP = Tekanan statik (Pa) dan Q=debit (m3/s)

Karakteristik Teknik NewtonRaphson


Kemungkinan teknik ini untuk konvergen cukup
tinggi
Tidak perlu menyusun urutan persamaan seperti
pada substitusi suksesif
Apabila nilai duga cukup jauh dari nilai sebenarnya:
Dapat saja beda terhadap nilai yang sebenarnya
membesar terlebih dahulu, kemudian baru konvergen.
Dapat konvergen pada nilai yang tidak realistik secara
fisik
Pada beberapa persamaan dapat tidak konvergen, dan
perlu pengubahan bentuk persamaan

Contoh: Sistem pompa

Bak air
atas

w
40 m

Pompa1

Bak air
bawah

p 7.2 w 2 gh

Pompa1

p 810 25w1 3.75w1

Pompa2

p 900 65w2 30w2

Mass balance

w w1 w2

Pompa2

w1

w2

1kPa
1000 Pa

Elevasi dan
friksi oleh pipa