0% found this document useful (0 votes)
15 views

Nonlinear Equ

The document discusses methods for solving nonlinear equations in one variable, focusing on the Bisection and False Position methods, as well as Newton's and Secant methods. It provides algorithms and examples for each method, illustrating how to find roots of various equations. Additionally, it includes exercises for practice with these numerical methods.

Uploaded by

ewalypop12
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Nonlinear Equ

The document discusses methods for solving nonlinear equations in one variable, focusing on the Bisection and False Position methods, as well as Newton's and Secant methods. It provides algorithms and examples for each method, illustrating how to find roots of various equations. Additionally, it includes exercises for practice with these numerical methods.

Uploaded by

ewalypop12
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Nonlinear Equation in One Variable

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.

FIGURE 2 Illustration of some exceptions to the general cases depicted in


Fig.1.
(a) Multiple roots that occur when the function is tangential to the x-axis. In
this case, although the endpoints are of opposite signs, there is an even
number of axis interceptions for the interval.
(b) Discontinuous functions where endpoints of opposite signs bracket an
even number of roots. Special strategies are required for determining the
roots of these cases.
1] Closed Methods: Bisection method and False position

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 1: Input a, b,& 𝜀

𝑎+𝑏
Step 2: Compute c =
2

Step 3: If 𝑓(𝑐) < 𝜀, then stop

Step 4 : If f(a) f(c) < 0, then set b=c


else, a = c

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

Since f(c) f(a) > 0, then a=c=0.5 and b=1

Second iteration:
1+0.5
C= = 0.75 f(c) = - 0.4295
2

Since f(c) f(a) > 0, then a=c=0.75 and b=1

And so on. We find the root is 0.909667


Example: Using Bisection method to find approximate solution to the following equation
𝑓 𝑥 = 𝑥 3 + 4𝑥 2 -10 , 1 ≤ 𝑥 ≤ 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

Since f(c) f(a) < 0, then b=c=1.5 and a=1

Second iteration:
1+1.5
C= =1.25 f(c) = - 1.79687
2

Since f(c) f(a) > 0, then a=c=1.25 and b=1.5

And so on. We find the root is 1.36523 after 13 iteration


II] False position method

If r is a simple root in [a,b] where f(a) f(b)<0

Then the straight line passing through the


point (a , f(a)), (b , f(b)) intersect x-axis at
the point c which is near from r

𝑦−𝑓(𝑎) 𝑓(𝑏)−𝑓(𝑎)
That is =
𝑥−𝑎 𝑏−𝑎

Since y=0 on x-axis then we have

𝑎𝑓 𝑏 −𝑏𝑓(𝑎)
X=
𝑓 𝑏 −𝑓(𝑎)
Algorithm: False Position method

Step 1: Input a, b,& 𝜀

𝑎𝑓 𝑏 −𝑏𝑓(𝑎)
Step 2: Compute c=
𝑓 𝑏 −𝑓(𝑎)

Step 3: If 𝑓(𝑐) < 𝜀 , then stop

Step 4 : If f(a) f(c) < 0, then set b=c


else, a = c

Step 5: Go to step 2
Example: Using False Position 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:

𝑎𝑓 𝑏 −𝑏𝑓(𝑎) 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

Second iteration: a=c= 0.780203 and b=1


f(a) = - 0.355765 & f(b) =0.281718

𝑎𝑓 𝑏 −𝑏𝑓(𝑎)
C= =0.902866 f(c) = - 0.021159
𝑓 𝑏 −𝑓(𝑎)

Since f(c) f(a) > 0, then a=c= 0.902866 and b=1

And so on. We find the root is 0.90999


Example: Using False position method to find approximate solution to the following equation
𝑓 𝑥 = 𝑥 3 + 4𝑥 2 -10 , 1 ≤ 𝑥 ≤ 2

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

Since f(c) f(a) > 0, then a = c = 1.2631579 and b=2

Second iteration:
1.2631579(14)−2(−1.602274)
C= =1.3388278 f(c) = - 0.430365
14+1.602274

Since f(c) f(a) > 0, then a = c = 1.3388278 and b=2

And so on. We find the root is 1.3652 after 7 iteration


Exercises: Use Bisection and False position methods to find approximation to all real roots of
the given equation


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

f (x) = f (x0) + f (x0)(x −x0) + (x − x0 )2


f (),  [x, x0]
2!
Assume 𝑓(𝑥1 ) =0, then (x − x )2
f (x1) =0 = f (x0) + f (x0)(x1 −x0) + 1 0 f (),
2!
Since 𝑥1 − 𝑥0 ≤ 𝜖 , that is (𝑥1 − 𝑥0 )2 → 0 . Hence
− f (x0)  f (x0)(x1 − x0) → x1 = x0 − f (x0)
f (x0)

In general
xk+1 = xk − f (xk ) (1)
f (xk )

If 𝑓(𝑥𝑘 ) ≤ 𝜖, Then 𝑥𝑘 is the solution

𝑥+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

Iteration 2: k=1 in (1), then we have

x2 = x1 − f (x1) =−0.4201− 0.0005 =−0.42036


f (x1) 1.90478
f (−0.42036) =−4.58407008110−6
. . = x2 − x1 100 = 0.06%
RPE
x2

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

x =1+ 5 → x −1= 5 → x2 −2x +1=5


then

f (x) = x2 −2x −4 & f (x) = 2x −2 at x0 =3


x1 = x0 − f (x0 ) =3− −1 = 3.25
f (x0) 4
x2  3.2361 x3  3.2361
1+ 5  3.2361
Example: Find approximate root for the equation 3𝑥 2 -𝑒 𝑥 =0 if one of the equation roots near
x= 1

𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛: Since f x = 3𝑥 2 −𝑒 𝑥 and 𝑓 ′ 𝑥 = 6𝑥 − 𝑒 𝑥 , then


f(1)=0.281718 & 𝑓 ′ 1 = 3.281718

Iteration 1: at k=0 in equation (1), then

x1 = x0 − f (x 0 ) = 0.914155 , f (x1) = 0.0123717


f (x0)
. . = x1 − x0 100 =9.39%
RPE
x1 where R.P.E is relative percent error

Iteration 2: at k=1 in equation (1), then


x2 = x1 − f (x1) = 0.910017, f (x2) = 2.80536410−5
f (x1)
. . = x2 − x1 100 = 0.45%
RPE
x2

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]tanx −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:

f (xk )  f (xk ) − f (xk−1) (2)


xk − xk−1

This approximation can be substituted into Eq. (1 ) to yield the following iterative equation:

xk+1 = xk − f ( xk )( xk − xk−1 ) (3)


f (xk ) − f (xk−1)

The relative percent error is given by


. . =
RPE xk+1 − xk 100
xk+1
If 𝑓(𝑥𝑘 ) ≤ 𝜖, Then 𝑥𝑘 is the solution
Algorithm: Secant method

Step 1: Input a, b,& 𝜀

Step2: Set 𝑥0 =a and 𝑥1 =b

𝑓 𝑥1 (𝑥1 −𝑥0 )
Step 3: Compute 𝑥2 = 𝑥1 −
𝑓 𝑥1 −𝑓(𝑥0 )

Step 4: If 𝑓(𝑥2 ) <𝜀 , then stop

Step 5 : Else, set 𝑥0 = 𝑥1 and 𝑥1 = 𝑥2

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]

Solution: Set 𝑥0 =0 and 𝑥1 =1, then f(0)=-1 and f(1) =1.7182818

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

𝑆𝑖𝑛𝑐𝑒 𝑓(𝑥2 ) > 𝜖 , 𝑡ℎ𝑒𝑛 𝑠𝑒𝑡 𝑥0 =1 and 𝑥1 = 𝑥2 =0.367879,

then f(1)= 1.7182818 and 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

1]x3 −2x2 −5 = 0 x0 =1, x1 = 4


2]x4 + x2 −3= 0 x0 =1, x1 =1.1413
3]x −cos x = 0 x0 = 0, x1 = 
2
4]4xcos2x −(x −2)2 = 0 x0 = 0, x1 =8
5]tanx −6 = 0 x0 = 0, x1 = 0.48
Applications
1] In a chemical engineering process, water vapor (𝐻2 O) is heated to sufficiently high temperatures that a
significant portion of the water dissociates, or splits apart, to form oxygen (𝑂2 ) and hydrogen (𝐻2 ):
𝐻2 𝑂 ⇆ 𝐻2 +0.5 𝑂2 . If it is assumed that this is the only reaction involved, the mole fraction x
of 𝐻2 𝑂 that dissociates can be represented by

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 .

You might also like