Nonlinear Equ
Nonlinear Equ
x −cos(x) = 0
ln(x −1) +cos(x −1) = 0
Figure 2 Figure 1
FIGURE 1 Illustration of a number of general ways that a root may occur in an
interval prescribed by a lower bound xl and an upper bound xu . Parts (a) and
(c) indicate that if both f (xl ) and f (xu ) have the same sign, either there will
be no roots or there will be an even number of roots within the interval. Parts
(b) and (d) indicate that if the function has different signs at the endpoints,
there will be an odd number of roots in the interval.
I) Bisection method
The bisection method is a variation of the incremental search method in which the interval is
always divided in half. If a function changes sign over an interval, the function value at the
midpoint is evaluated. The location of the root is then determined as lying within the
subinterval where the sign change occurs. The subinterval then becomes the interval for the
next iteration. The process is repeated until the root is known to the required precision. A
graphical depiction of the method is provided in Fig. 5.5. The following example goes through
the actual computations involved in the method.
Suppose a continuous function f(x) defined on interval [a, b] is given with f(a)
and f(b) are opposite sign. By the mean value theorem, there exists a < c < b
for which f(c) = 0.
Algorithm: Bisection method
𝑎+𝑏
Step 2: Compute c =
2
Step 5: Go to step 2
Example: Using Bisection method to find approximate solution to the following equation
𝑓 𝑥 = 3𝑥 2 − 𝑒 𝑥 , 0 ≤ 𝑥 ≤ 1
Solution: Since f(0)=-1 and f(1) =0.281718, that is f(a)f(b)<0 , then
Iteration 1:
𝑎+𝑏
C= =0.5 f(c) = - 0.898721
2
Second iteration:
1+0.5
C= = 0.75 f(c) = - 0.4295
2
Solution: Since f(1) = - 5 and f(2) =14, that is f(a) f(b)<0 , then
Iteration 1:
𝑎+𝑏 1+2
C= = =1.5 f(c) = 2.375
2 2
Second iteration:
1+1.5
C= =1.25 f(c) = - 1.79687
2
𝑦−𝑓(𝑎) 𝑓(𝑏)−𝑓(𝑎)
That is =
𝑥−𝑎 𝑏−𝑎
𝑎𝑓 𝑏 −𝑏𝑓(𝑎)
X=
𝑓 𝑏 −𝑓(𝑎)
Algorithm: False Position method
𝑎𝑓 𝑏 −𝑏𝑓(𝑎)
Step 2: Compute c=
𝑓 𝑏 −𝑓(𝑎)
Step 5: Go to step 2
Example: Using False Position method to find approximate solution to the following equation
𝑓 𝑥 = 3𝑥 2 − 𝑒 𝑥 , 0 ≤ 𝑥 ≤ 1
𝑎𝑓 𝑏 −𝑏𝑓(𝑎) 0(0.281718)−1(−1)
C= = = 0.780203 f(c) =- 0.355765
𝑓 𝑏 −𝑓(𝑎) 1.281718
Since f(c) f(a) > 0, then a=c= 0.780203 and b=1
𝑎𝑓 𝑏 −𝑏𝑓(𝑎)
C= =0.902866 f(c) = - 0.021159
𝑓 𝑏 −𝑓(𝑎)
Solution: Since f(1) = - 5 and f(2) =14, that is f(a) f(b)<0 , then
Iteration 1:
𝑎𝑓 𝑏 −𝑏𝑓(𝑎) 14−2(−5)
C= = = 1.2631579 f(c) = -1.602274
𝑓 𝑏 −𝑓(𝑎) 14+5
Second iteration:
1.2631579(14)−2(−1.602274)
C= =1.3388278 f(c) = - 0.430365
14+1.602274
1] x−cos(x) =0 ;[0, ]
2
2]ln(x−1) +cos(x−1) =0 ; 1.2 x 2
3]3x −e =0
2 x
; 0 x 1 and [3,5]
4]e +2 +2cos(x) −6 =0
x −x
; [1,2]
5]x −x−1=0
3
; [1,2]
2] Open Methods: Newton’s method and Secant method
I) Newton’s Method: It is one of the most popular and widely used root estimation
algorithms . It is a simple technique to obtain faster convergence. We can introduce it from
Taylor’s expansion.
Suppose that f(x) is twice continuously differentiable function on the interval [a, b].
Let 𝑥0 ∈ 𝑎, 𝑏 be an approximation to 𝑥1 such that 𝑓 ′ (𝑥0 ) ≠ 0 and 𝑥1 − 𝑥0 ≤ 𝜖 .
Consider the first order Taylor polynomial about 𝑥0
In general
xk+1 = xk − f (xk ) (1)
f (xk )
𝑥+1
Example: Find approximate root for the equation sin 𝑥 − =0 if one of the equation
𝑥−1
roots near x= - 0.4
𝑥+1 2
𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛: Since f x = sin 𝑥 − and 𝑓 ′ 𝑥 = cos 𝑥 + , then
𝑥−1 (𝑥−1)2
f(-0.4)=0.039153 & 𝑓 ′ −0.4 =1.94147
Iteration 1: at k=0 in equation (1), then
x1 = x0 − f (x0) =−0.4− 0.039153 =−0.4201
f (x0) 1.94147
f (x1) = 0.0005 & f ( x1) =1.90478
. . = x1 − x0 100 = 4.7%
RPE
x1
This is exact value for the solution where f(x) is very small
Example: Use Newton’s method to find an approximate value for the
given number 1+ √5
𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛: let
Exercises: Use Newton’s methods to find approximation to all real roots of the given equation
1] x3 − x2 +1= 0 x0 = 2
2] x4 + x2 −3 = 0 x0 =1
3]ex −3x = 0 x0 = 0
4] xsec x −1= 0 x0 = 0
5]tanx −6 = 0 x0 = 0
3
7] Using Newton’s method to find approximate value for 3 and 25 accurate within 10−4
II] Secant methods:
There are certain functions whose derivatives may be difficult or inconvenient to evaluate. For
these cases, the derivative can be approximated by a backward finite divided difference:
This approximation can be substituted into Eq. (1 ) to yield the following iterative equation:
𝑓 𝑥1 (𝑥1 −𝑥0 )
Step 3: Compute 𝑥2 = 𝑥1 −
𝑓 𝑥1 −𝑓(𝑥0 )
Step 6: Go to step 3
Example : Find approximate root for the equation 𝑥 2 𝑒 𝑥 -1=0 if one of the equation roots in [ 0, 1]
x2 = x1 − f (x1)( x1 − x0 ) = 0.367879
Using Equ.( 3), then at k=1 we have
f (x1) − f (x0)
f (0.367879) =−0.804485
x2 = x1 − f (x1)( x1 − x0 ) = 0.569456
f (x1) − f (x0)
f (0.569456) =−0.426898
And so on
Exercises: Use Secant methods to find approximation to all real roots of the given equation
K = x 2Pt
1−x 2+ x
where K is the reaction’s equilibrium constant and 𝑃𝑡 is the total pressure of the mixture.
If pt = 3 atm and K = 0.05, determine the value of x that satisfies the above equation
2]The volume of liquid V in a hollow horizontal cylinder of radius r and length L is related
to the depth of the liquid h by
V = r2 cos−1(r −h) −(r−h) 2rh−h2
r
Determine h given r = 2 m, L = 5 𝑚3 , and V = 8 𝑚3 .