You are on page 1of 23

Akar-akar Bilangan dan Persamaan

KOMPUTASI NUMERI K
SLI DE #2
Akar Persamaan

Pencarian akar 1-D
Diberikan sebuah fungsi, tentukan lokasi dimana f(x)=0
Dibutuhkan:
Posisi awal x
0
, diharapkan dekat dengan solusi
Idealnya, titik-titik tersebut akan mengurung akar
Well-behaved function

f(x
+
) > 0
f(x

) < 0
Apa yang salah?
Titik Tangent:
Sangat sulit dicari
Singularity:
Titik-titik perkiraan
tidak mengurung akar
Kasus Pathological:
Jumlah akar tak terbatas
e.g. sin(1/x)
Metode Bisection
Diberikan dua titik x
+
dan x

yang mengurung sebuah akar, tentukan


x
half
= (x
+
+ x

)
dan evaluasi f(x
half
)
Jika positif, x
+
x
half
lainnya

x

x
half

Berhenti jika x
+
dan x

cukup dekat
Jika fungsi adalah kontinyu, cara ini akan berhasil mendapatkan
beberapa akar.
Bisection
Metode yang sangat bagus
Laju konvergensi:
Error akan berada pada besarnya interval [x
+
x

]
Interval akan menyusut separuh pada setiap iterasi
Maka, error akan menurun separuh pada setiap iterasi:
|c
n+1
| = |c
n
|
Hal ini disebut konvergensi linier
Satu bit akurasi pada x pada setiap iterasi
Pencarian Akar yg Lebih Cepat
Metode Fancier memberikan hasil konvergensi yang super linier
Pendekatan tipikal: memodelkan fungsi secara local oleh sesuatu yang dapat
menentukan akar secara tepat
Model tidak sesuai persis dengan fungsi, sehingga perlu iterasi
Dalam banyak kasus, metode ini lebih buruk daripada bisection
Metode Secant
Pengembangan sederhana dari bisection: interpolasi atau extrapolasi
melalui dua poin terakhir.
1
2
3
4
Metode Scant
Diberikan sebuah kurva, sebuah garis secant atau secant adalah sebuah
garis yang yang memotong kurva tersebut pada dua titik.
Metode secant adalah sebuh teknik untuk mencari akar dari fungsi
bernilai skalar f(x) dari variabel tunggal x dan tidak informasi mengenai
turunannya. Metode ini mirip dengan false position tetapi dapat
mengatasi kemungkinan tidak konvergen dengan konvergensi yang
cepat.
Secant Method
Lebih cepat daripada bisection:
|c
n+1
| = const. |c
n
|
1.6

Lebih cepat dari linier: jumlah bit benar dikalikan 1,6
Kekurangannya: rumus diatas hanya benar jika sangat dekat dengan
akar dari fungsi yang sangat halus.
Tidak menjamin akar akan dapat dikurung

Metode False Position
Mirip dengan secant, tetapi menjamin pengurungan





Stabil, tetapi linier pada kasus yang buruk
1
2
3
4
Newton-Raphson
Best-known algorithm for getting quadratic
convergence when derivative is easy to evaluate
Another variant on the extrapolation theme
) (
) (
1
n
n
n n
x f
x f
x x
'
=
+
1
2
3
4
Slope = derivative at 1
Newton-Raphson
Begin with Taylor series

Divide by derivative (cant be zero!)
0 ...
2
) (
) ( ) ( ) (
2
want
n
n n n
x f
x f x f x f = +
' '
+
'
+ = + o o o
2
1
2
2
2
~
) ( 2
) (
0
) ( 2
) (
0
) ( 2
) (
) (
) (
n n
n
n
Newton
n
n
Newton
n
n
n
n
x f
x f
x f
x f
x f
x f
x f
x f
c c o o o
o o o
o o
+

'
' '
=
=
'
' '
+ +
=
'
' '
+ +
'
Newton-Raphson
Method fragile: can easily get confused




Good starting point critical
Newton popular for polishing off a root found approximately using a more
robust method
Newton-Raphson
Convergence
Can talk about basin of convergence:
range of x
0
for which method finds a root
Can be extremely complex:
heres an example
in 2-D with 4 roots
Popular Example of Newton:
Square Root
Let f(x) = x
2
a: zero of this is square root of a
f(x) = 2x, so Newton iteration is


Divide and average method
( )
n
x
a
n
n
n
n n
x
x
a x
x x + =

=
+ 2
1
2
1
2
Reciprocal via Newton
Division is slowest of basic operations
On some computers, hardware divide not available (!): simulate in
software




Need only subtract and multiply
( )
n n
x
x
n n
x
x
b b
a
bx x
b
x x
x f
b x f
a
=

=
=
'
= =
=
+
2
) (
0 ) (
*
2
2
1
1
1
1
1
1
Rootfinding in >1D
Behavior can be complex: e.g. in 2D
0 ) , (
want
y x g =
0 ) , (
want
y x f =
Rootfinding in >1D
Cant bracket and bisect






Result: few general methods
Newton in Higher Dimensions
Start with


Write as vector-valued function
0 ) , (
0 ) , (
want
want
y x g
y x f
=
=
|
|
.
|

\
|
=
) , (
) , (
) (
y x g
y x f
n
x f
Newton in Higher Dimensions
Expand in terms of Taylor series


f is a Jacobian
0 ... ) ( ) ( ) (
want
n n n
= +
'
+ = + x f x f x f
( )
y x n c
c
c
c
= =
'
f f
J x f ) (
Newton in Higher Dimensions
Solve for o


Requires matrix inversion (well see this later)
Often fragile, must be careful
Keep track of whether error decreases
If not, try a smaller step in direction o
) ( ) (
1
n n
x f x J

=

You might also like