Slide TSP303 Analisis Numerik Pemrograman TSP 303 P3

a home base to excellence
Mata Kuliah
Kode
SKS

: Analisis Numerik dan Pemrograman
: TSP – 303
: 3 SKS

Metode Terbuka
(Open Methods)
Pertemuan - 3

a home base to excellence
• TIU :

 Mahasiswa dapat mencari akar-akar suatu persamaan, menyelesaikan
persamaan aljabar linear, pencocokan kurva, dan membuat program
aplikasi analisis numeriknya

• TIK :


 Mahasiswa dapat menjelaskan Metode Terbuka (Open Methods)
untuk menyelesaikan permasalahan akar-akar persamaan

a home base to excellence
• Sub Pokok Bahasan :
 Simple Fixed-Point Iteration
 Metode Newton-Raphson
 Metode Secant
 Kelemahan dan Kelebihan dari metode tersebut

a home base to excellence
• For the bracketing methods, the root is located within
an interval prescribed by a lower and an upper bound.
• Repeated application of these methods always results
in closer estimates of the true value of the root.
• Such methods are said to be convergent because they
move closer to the truth as the computation
progresses
• In contrast, the open methods are based on formulas

that require only a single starting value of x or two
starting values that do not necessarily bracket the root

a home base to excellence
• As
such,
they
sometimes diverge or
move away from the
true root as the
computation
progresses (Fig. b).
• However, when the
open
methods
converge (Fig. c), they
usually do so much
more quickly than the
bracketing methods.


a home base to excellence
Simple Fixed-Point Iteration
• Open methods employ a formula to predict
the root.
• Such a formula can be developed for simple
fixed-point iteration (or, as it is also called,
one-point iteration or successive substitution)
by rearranging the function f(x)=0 so that x is
on the left-hand side of the equation:

x=g(x)

(1)

a home base to excellence
• This transformation can be accomplished
either by algebraic manipulation or by simply
adding x to both sides of the original
equation.
• For example,

x  2x  3  0

x2  3
x
2

sin x  0

x  sin x  x

2

a home base to excellence
• The utility of Eq. (1) is that it provides a formula to predict a
new value of x as a function of an old value of x.
• Thus, given an initial guess at the root xi, Eq. (1) can be used
to compute a new estimate xi+1 as expressed by the iterative
formula

xi+1= g(xi)


(2)

• the approximate error for this equation can be determined
using the error estimator
a 

xi 1  xi
 100%
xi 1

a home base to excellence
Example 1 :
Use simple fixed-point iteration to locate the
root of f(x)=e−x− x
The function can be separated directly and expressed
in the form

xi+1=e−xi


a home base to excellence
• Starting with an initial guess of x0=0, this
iterative equation can be applied to compute
Iteration
0
1
2
3
4
5
6
7
8
9
10

xi
0
1


g(xi)
1
0,36788

 a (%)

 t (%)

100

the true value of
the root: 0.56714329.

a home base to excellence
The Newton-Raphson Method
• Perhaps the most widely
used of all root-locating
formulas is the NewtonRaphson equation.
• If the initial guess at the
root is xi, a tangent can be

extended from the point
[xi, f(xi)].
• The point where this
tangent crosses the x axis
usually
represents
an
improved estimate of the
root.

a home base to excellence
• the first derivative at x is equivalent to the
slope
f  xi   0

f  xi  
xi  xi 1

• Which can be rearranged to yield NewtonRaphson formula :
xi 1


f  xi 
 xi 
f xi 

(3)

a home base to excellence
Example 2 :
Use the Newton-Raphson method to estimate
the root of f(x)=e−x− x, employing an initial
guess of x0 = 0
The first derivative of the function can be evaluated as
f(x = −e− − , hi h can be substituted along with the
original function into Eq. (3) to give
xi 1  xi 

e  xi  xi

e


 xi

1

a home base to excellence
• Starting with an initial guess of x0=0, this iterative
equation can be applied to compute
Iterasi
1
2
3
4
5

xi
f(x i )
0
1
0,5

0,1065
0,5663 0,0013

/

f (x i )
-2
-1,607
-1,568

 a (%)

the true value of
the root: 0.56714329.

 t (%)

a home base to excellence
• Although the Newton-Raphson method is
often very efficient, there are situations
where it performs poorly.
• Fig. a depicts the case where an inflection
point [that is, f’’ = ] o urs in the i init
of a root.
• Fig. b illustrates the tendency of the
Newton-Raphson technique to oscillate
around a local maximum or minimum.
• Fig. c shows how an initial guess that is
close to one root can jump to a location
several roots away.
• O iousl , a zero slope [f’ = ] is trul a
disaster because it causes division by zero
in the Newton-Raphson formula (see Fig d)

a home base to excellence
The Secant Method
• A potential problem in implementing the
Newton-Raphson method is the evaluation of
the derivative.
• Although this is not inconvenient for polynomials
and many other functions, there are certain
functions whose derivatives may be extremely
difficult or inconvenient to evaluate.
• For these cases, the derivative can be
approximated by a backward finite divided
difference, as in the following figure

a home base to excellence
f xi 1   f xi 
f xi  
xi 1  xi
This approximation can be
substituted into Eq. (3) to
yield the following iterative
equation:
xi 1

f xi   xi 1  xi 
 xi 
f xi 1   f xi 

(4)

a home base to excellence
• Equation (4) is the formula for the secant
method.
• Notice that the approach requires two initial
estimates of x.
• However, because f(x) is not required to
change signs between the estimates, it is not
classified as a bracketing method.

a home base to excellence
Example 3 :
Use the Secant method to estimate the root of
f(x)=e−x− x, employing an initial guess of x0 = 0
Start with initial estimates of x−1 =0 and x0= 1.0.
Iteration

x i-1

0
1
2
3
4
5

0
1

xi

x i+1

1
0,6127
0,6127 0,5638

f(x i-1 )

f(x i )

 a (%)

1
-0,632

-0,632
-0,071

-8,666

a home base to excellence
The Difference Between the Secant and False-Position
Methods
f xu xl  xu 
xr  xu 
f xl   f xu 
False-Position Formula

f xi   xi 1  xi 
xi 1  xi 
f xi 1   f xi 
Secant Formula

• The Eqs. Above are identical on a term-by-term basis.
• Both use two initial estimates to compute an
approximation of the slope of the function that is used to
project to the x axis for a new estimate of the root.
• However, a critical difference between the methods is how
one of the initial values is replaced by the new estimate.

a home base to excellence
• Recall that in the false-position method the
latest estimate of the root replaces
whichever of the original values yielded a
function value with the same sign as f(xr).
• Consequently, the two estimates always
bracket the root.
• Therefore, the method always converges
• In contrast, the secant method replaces the
values in strict sequence, with the new
value xi+1 replacing xi and xi replacing xi− .
• As a result, the two values can sometimes
lie on the same side of the root.
• For certain cases, this can lead to
divergence.

a home base to excellence
Homework

Use : Simple Fixed-Point Iteration Method (x = g(x))

a home base to excellence
Homework

Use Secant Method

a home base to excellence
Homework
Use Newton Raphson Method