Professional Documents
Culture Documents
1
GRAPHICAL METHODS Contoh Ilustratif:
Persamaan: f (x) = x2 – 5 x - 14 = 0
A simple method for obtaining an estimate of the root of the
equation f(x) = 0 is to:
Akar persamaannya: ….?
make a plot of the function, and Secara 15
observe where it crosses the x axis analitik: 10
(x value for which f(x) = 0)
ÆMudah…! 5
Advantages:
0
provides a rough approximation of the root → can be
Secara -3 -2 -1-5 0 1 2 3 4 5 6 7 8 9
employed as starting guesses for numerical methods grafik: -10
useful for understanding the properties of the functions
-15
useful for anticipating the pitfalls of the numerical methods
-20
Disadvantage:
-25
not precise
Secara Analitik:
Dengan menggunakan rumus abc untuk
(a)
menentukan akar-akar persamaan kuadrat,
diperoleh:
(d)
(e) −b± b −4 a c
2
x12 =
2a
Atau, dalam hal ini:
(b)
5 − (−5) 2 − 4 (1) (−14) 5 − 9
x1 = = = −2
2 (1) 2
(f) (g)
5 + ( −5) 2 − 4 (1) (−14) 5 + 9
Illustration of root location(s) x2 = = =7
(c)
2 (1) 2
2
Secara numerik: BRACKETING METHODS
f ( xi ) and INITIAL GUESSES
Misal, dipilih metode Newton-Raphson: xi +1 = xi −
f ' ( xi ) Two major classes of methods for finding the root of a
single nonlinear equation (distinguished by the type of
initial guess):
Nilai
tebakan 1. Bracketing methods
awal 2. Open methods
Bracketing Methods
(Incremental Search Methods)
1. Metode Bisection
2. Metode False Position
3
Consider: a function f(x) which is known to have
Incremental Search Method one and only one real root in the interval xl < x < xu
In general, if f(x) is real and continuous in the interval from xl f(x)
to xu and f(xl) and f(xu) have opposite signs, that is: f(xu)
f(xl).f(xu) < 0
then there is at least one real root between xl and xu.
4
FALSE POSITION METHOD Example #1:
= Linear Interpolation Method Use: (a) bisection method, and (b) false position
= Regula-Falsi Method method, to locate the root of: f(x) = e-x - x
It is very similar to bisection method, with the Use initial guesses of xl = 0 and xu = 0,8, and
exception that it uses a different strategy to come iterate until the approximate error falls below 1%
up with its new root estimate. 1,2
Graphically: 1
f ( xu ) ( xl − xu ) 0,4
xM = xu −
f(x)
0,2
f ( xl ) − f ( xu ) xM 0
-0,2 0 0,2 0,4 0,6 0,8
-0,4
-0,6
x
f ( xu ) (xl − xu )
Calculation Results:
xM = xu −
f ( xl ) − f ( xu )
Y Y
f(xM).f(xu) ≤ 0 ? f(xM).f(xu) = 0 ?
N N
xM → xu xM → xl
f ( xu ) ( xl − xu )
next xM = xu −
iteration f ( xl ) − f ( xu )
N xM , present − xM , previous
≤ tol ?
xM , present
FALSE POSITION
Y
METHOD FLOWCHART
x = xM END
5
Example #2: Calculation Results (by using MS Excel):
Use bisection method and false position method to deter-
mine the mass of the bungee jumper with a drag coeffi-cient
of 0,25 kg/m to have a velocity of 36 m/s after 4 s of free fall.
Note: The acceleration of gravity is 9,81 m/s2
Free-fall velocity as a function of time:
gm ⎛ g cd ⎞
v(t ) = tanh ⎜⎜ t ⎟⎟
cd ⎝ m ⎠
An alternative way to make the equation as a function of
mass:
gm ⎛ g cd ⎞
f ( m) = tanh ⎜⎜ t ⎟⎟ − v(t ) = 0
cd ⎝ m ⎠
Use initial guesses of ml = 50 kg and mu = 200 kg, and
iterate until the approximate error falls below 5% (εs =
stopping criterion = 5%)
6
Thus, given an initial guess at root xi, the equation
above can be used to compute a new estimate xi+1 as
expressed by the iterative formula:
Open Methods xi+1 = g(xi)
The approximate error can be determined by:
xi + 1 − xi
1.Metode Iterasi Satu Titik εa = . 100 %
xi + 1
– Metode Dua Kurva
Example:
2. Metode Newton-Raphson Use the simple fixed-point iteration to locate the
3. Metode Secant root of f(x) = e-x - x
Solution:
The function can be separated directly and then
− xi
expressed as: x
i +1 =e
7
Two Curves CONVERGENC
Graphical Method E OF SIMPLE
FIXED-POINT
By graphical method, ITERATION
there are two alternatives
for determining root of: (a) & (b)
−x
f(x)=e −x Æconvergent
(c) & (d)
(a) Root at the point Ædivergent
where it crosses the
x axis
Note that
(b) Root at the
convergence
intersection of the
component functions occurs when
׀g’(x) < ׀1
8
which can be rearranged to yield: START
f ( xi )
xi +1 = xi − An initial guess of x (xi = x0), tol
f ' ( xi )
Newton-Raphson formula xi + 1 = x i −
f ( xi )
Newton-Raphson formula
Example: f ' ( xi )
e − xi − xi NEWTON-RAPHSON
xi +1 = xi − METHOD flowchart
END
− e − xi − 1
Starting with an initial guess of x0 = 0, this iterative FOUR CASES OF POOR CONVERGENCE OF THIS
METHOD
equation can be applied to compute:
i xi εa, % ε t, %
0 0 - 100
1 0,5 100 11,83886
2 0,566311003 11,70929 0,146751
3 0,567143165 0,146729 2,2.10-5
4 0,567143290 2,21.10-5 7,23.10-8
Comment:
The approach rapidly converges on the true root.
There is no general convergence criterion for Newton-Raphson
Notice that the true percent relative error at each method. Its convergence depends on:
iteration decreases much faster than it does in simple á the nature of the function, and
fixed-point iteration (in previous example) á the accuracy of the initial guess
9
SECANT METHOD START
A potential problem in implementing the Newton- Two initial guesses of x (xi-1 & xi), tol
Raphson method is: the evaluation of the derivative
f ( xi ) ( xi −1 − xi )
There are certain functions whose derivatives may be xi +1 = xi − Secant formula
f ( xi −1 ) − f ( xi )
difficult or inconvenient to evaluate. For these cases,
the derivative can be approximated by a backward finite xi-1 = xi
divided difference: xi = xi+1 xi − xi +1
εa = .100% Approximate error
f ( xi − 1 ) − f ( xi ) xi +1
f ' ( xi ) ≅ next
xi − 1 − xi iteration
N
εa < tol ?
This approximation can be substituted into Newton-
Raphson formula to yield the following iterative Y
equation: xi
f ( xi ) ( xi −1 − xi ) Secant me- SECANT METHOD
xi +1 = xi − thod formula END
f ( xi −1 ) − f ( xi ) flowchart
10
START 10 −6 ( 50 )( −4 ,57938708 )
x1 = 50 − = 88 ,39931
An initial guess of x (xi = x0), δ, tol − 4 ,579381118 − ( −4 ,57938708 )
δ xi f ( xi )
׀εt = ׀38,07%: ׀εa = ׀43,44%
xi+1 = xi − Modified secant formula
f ( xi + δ xi ) − f ( xi )
Second iteration:
xi = xi+1 x −x
ε a = i i +1 .100% Approximate error x1 = 88,39931 f(x1) = -1,69220771
xi +1
next x1 + δ x1 = 88,39940 f(x1 + δ x1) = -1,692203516
iteration
N
εa < tol ?
10 −6 ( 88 ,39931 )( −1,69220771 )
x2 = 88 ,39931 − = 124 ,08970
Y − 1,692203516 − ( −1,69220771 )
xi
MODIFIED
SECANT
׀εt = ׀13,06%: ׀εa = ׀28,76%
END
METHOD
flowchart
11
Problem #2:
Using x =1 as the starting point, find a root of the
following equation to three significant figures:
PROBLEMS f ( x) = x 2 e x − 1 = 0
using:
a. successive substitution
b. Newton’s method
c. the secant method (use x = 1,01 as
your second point)
f ( x) = x e x + x − 5 e x − 5 = 0
(b) f ( x) = −11 − 22 x + 17 x 2 − 2,5 x 3 using:
a. Newton’s method
b. the secant method (use x = 4,1 as your
second point)
a. the regula falsi method
12
Problem #4: Problem #6:
In a chemical engineering process, water vapor (H2O) is
heated to sufficiently high temperatures that a significant
Consider the following nonlinear equation: portion of the water dissociates, or splits apart, to form
oxygen (O2) and hydrogen (H2):
f ( x) = x 2 − e x = 0 H2O Æ H2 + ½ O2
If it assumed that this is the only reaction involved, the mole
fraction x of H2O that dissociates can be represented by:
Show at least three cycles of search using a
starting point of x = 1 for: x 2 Pt
K=
a. Newton’s method 1− x 2+x
b. regula falsi method where K is the reaction’s equilibrium constant and Pt is the
total pressure of the mixture. If Pt = 3 atm and K = 0,05,
determine the value of x that satisfies the equation above.
13
2
pCO PT
Problem #8: The equilibrium relationship is given by: K =
2
pCO
2
pO2
Determine the equilibrium conversion for:
where PT is the total pressure and remembering that the
2 CO + O2 Æ 2 CO2
standard state fugacities of CO2, CO, and O2 are unity.
if stoichiometric amounts of CO and air are reacted at Substituting yields:
2000 K and 1 atmosphere pressure. At 2000 K the x 2 (6,76 − 0,5 x)
equilibrium constant for this reaction is 62,4 x 106 atm-1. = 62,4 . 106
As a basis, consider 2 gmoles of CO. Then there would (1 − 0,5 x) (2 − x) 2
be 1 gmole of O2 and 3,76 gmole of N2. Performing a Rearranging into a normalized form:
mole balance on each species and defining x as the
amount of CO that reacts yields: x 2 (6,76 − 0,5 x)
−1 = 0
NCO = 2 – x 62,4 . 106 (1 − 0,5 x) (2 − x) 2
NO2 = 1 – 0,5 x a. Solve for the equilibrium composition using Newton’s
NCO2 = x method with a starting point of x0 = 1,0 gmole.
NN2 = 3,76 b. Solve this problem using the regula falsi method.
pCO
N
= CO =
2− x ⎛ a ⎞
( )
⎜⎜ P + 2 ⎟⎟ V − b = R T
⎝ V ⎠
NT 6,76 − 0,5 x
where: P ≡ pressure (10 atm), T ≡ temperature (250 K)
R ≡ gas constant (0,082 liter.atm/gmole.K), V ≡ specific
N O2 1 − 0,5 x volume (liter/gmole)
pO2 = = Determine the specific volume for ammonia using:
NT 6,76 − 0,5 x a. successive substitution
b. Newton’s method
N CO2 x c. Secant method
pCO2 = = The Van der Waals constants for ammonia are:
NT 6,76 − 0,5 x a = 4,19 x 106 atm (cm3/gmole)2 and b = 37,2 cm3/gmole.
(Beware of the units!)
14