0% found this document useful (0 votes)
60 views18 pages

Nonlinear Equations & Bisection Method

Uploaded by

paneyip820
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views18 pages

Nonlinear Equations & Bisection Method

Uploaded by

paneyip820
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Fall 2024-2025

Numerical Methods of Engineering


Lecture Note 3
Nonlinear Equations in One Variable

3.1 Introduction

Many physical and engineering problems can be governed by nonlinear equation f (x)=0.
These equations involve circular function, hyperbolic function, exponential and other
transcendental functions, and their combinations. The solution (values of x) of the
nonlinear equation f (x)=0 is challenging. In fact, most equations cannot be solved
analytically and so we have to solve them numerically. In this chapter, we shall consider
some of the important approximate methods in finding the roots of the equations in one
variable.

3.2 Number of Real Roots

3.2.1 Number of Real Roots by Graphical Method

A polynomial equation a 0+ a1 x+ a2 x 2 +⋅⋅⋅+ an x n=0 of degree n has exactly n roots.


Some of them are real and others are complex. For a non-polynomial equation f (x)=0,
there is no such rule of finding the number of roots. Geometrically, if the graph of
y=f (x ) crosses the x-axis at x=a , then x=a is a real root of f (x)=0. Now we shall
consider graphically to find the number of real roots and its location.

Rewrite the equation f (x)=0 as f 1 ( x)=f 2 (x) . At the point of intersection x=x 1 (say) of
the graphs
y=f 1 (x ) and y=f 2 (x )
that is
f 1 ( x1 )=f 2 (x 1)
and hence, x=x 1is a root of the equation.

Thus, the number of intersections of the two graphs will be the number of real roots.

Example 3.1
(a) Find the number of real roots of x 3 +4 x−3=0 by graphical method.
(b) Find the number of complex roots, if any.
(c) Use MATLAB function “roots” to find all the roots including complex roots.

( a ) x 3 +4 x−3=0
3
⟹ x =3−4 x
3
f 1 ( x )=x
f 2 ( x )=3−4 x

There is one point of intersection here in the


plot. So, the number of real roots = 1.
(b) It is a polynomial equation of degree three and hence the total number of roots is
three. So, number of complex roots = Total number of roots - Number of real roots

1
Fall 2024-2025

¿ 3−1=2.
(c) >> p= [1 0 4 -3] % entry of cubic polynomial
p = 1 0 4 -3
>> Roots = roots(p)

Roots =
-0.3368 + 2.0833i
-0.3368 - 2.0833i
0.6736 + 0.0000i

Example 3.2: Find the number of real roots of sin x−x +1=0 by graphical method.
sin x−x +1=0
⟹ sin x=x−1
f 1 ( x )=sin x
f 2 ( x )=x−1

There is one point of intersection here in


the plot. So, the number of real root is 1.

Example 3.3: Find the number of real roots of 1−x−cos 3 x=0 by graphical method.
1−x−cos 3 x=0
1−x=cos 3 x
f 1 ( x )=1−x
f 2 ( x )=cos 3 x

There are three points of intersection here


in the plot. So, the number of real roots are
3.

3.2.2 Location of Roots

To locate the roots of f (x)=0, first study the graph of y=f (x ) as shown below. If we
can find two values of x, one for which f (x) is positive, and one for which f (x) is
negative, then the curve must have crossed the x-axis and so must have passed through a
root of the equation f (x)=0.

2
Fall 2024-2025

In general, if f (x) is continuous in [a , b] and y


f (a) and f (b) are opposite in signs i.e.,
f (a)f (b)< 0, then there exists odd number of real +
+
roots (at least one root) of f (x)=0 in (a ,b) . x
O
But the only exception where it does not work is
when curve touches the x-axis. For this case, the
existence of a root can be determined by the sign Fig 4.1
of f ' ( x) in the interval (a ,b) containing the root
and it will satisfy the condition f ' ( a) f ' (b)<0.

Example 3.4 The equation ( x−1 ) e x =x has two real roots. For each root, find an interval
where it lies.
Consider the values of function f ( x )= ( x −1 ) e x −x for different values of x:
x f(x)
-2 1.59
-1 0.26
0 -1
1 -1
2 5.39

From the above table, we see that f (−1 ) f ( 0 )=−0.26 <0, a root lies in (−1 , 0 ) ,
and f ( 1 ) f ( 2 ) =−5.39<0, a root lies in (1 , 2)

3.3 Techniques to find real roots

3.3.1 Method of Bisection


Let f ( x ) be continuous in [ a , b ] and f ( a ) f ( b )<0 , then there exists a real root of
f ( x )=0 in (a , b ) . In this method we assume the mid-pointc=( a+b )/ 2 is the
approximation to the root.
If f (c )=0 , we conclude that c is a root of f ( x )=0 . If f (c )≠0 and
(i) if f (a )f (c )<0 , the root is in (a , c ) or y

(ii) if f (c )f (b )<0 , the root is in (c , b ) .


By designating the new interval of root as 1 b1 ] , [ a ,

we can calculate the next iterate x 1 by the formula c b


a x
a n +b n O
x n+1=
2 , n = 1, 2, 3, . . . Fig 4.2Bisection Method

Repeat the process until


|x n+1 −x n|≤ε , where ε is the specified accuracy.

Advantages of Bisection Method


• Guaranteed convergence. The bracketing approach is known as the bisection method,
and it is always convergent.

3
Fall 2024-2025

• Errors can be managed. Increasing the number of iterations in the bisection method
always results in a more accurate root.
• Doesn't demand complicated calculations. There are no complicated calculations
required when using the bisection method. To use the bisection method, we only
need to take the average of two values.
• Error bound is guaranteed. There is a guaranteed error bound in this technique, and it
reduces with each repetition. Each cycle reduces the error bound by 12 per cent.
• The bisection method is simple and straightforward to program on a computer.
• In the case of several roots, the bisection procedure is quick.

Disadvantages of Bisection Method


• Although the Bisection method's convergence is guaranteed, it is often slow.
• Choosing a guess that is close to the root may necessitate numerous iterations to
converge.

𝑓(𝑥) = 𝑥².
• Some equations' roots cannot be found. Because there are no bracketing values, like

• Its rate of convergence is linear.


• It is incapable of determining complex roots.
• If the guess interval contains discontinuities, it cannot be used.
• It cannot be applied over an interval where the function returns values of the same
sign

Theorem: Suppose that f ∈ C [a ,b ] and f (a)∙ f (b)<0 . The Bisection method


generates a sequence { pn } n=1 approximately a zero 𝑝 of 𝑓 with | pn −p|≤ n , where
∞ b−a
2
n ≥ 1 the required number of iterations.

Example 3.5 For the given equation x 3−4 x+ 3=0 , a real root lies in between the
interval [−3 ,−2]. Find the minimum number of iterations required to find the root up to
the accuracy of three decimal points.

Solution: Given equation, f ( x )=x 3−4 x +3.


Since we have to find the root up to accuracy level of 3 decimal points, we have:
the tolerance, ε =0.001
Now, the accuracy of bisection method,
b−a
ε≥ n
2
−2+3
or, 0.001 ≥ n
2
1
or, 0.001 ≥ n
2
n 1
or, 2 ≥ 0.001
or, 2n ≥10 3
or, n log 10 2≥ 3 log 10 10
or, n log 10 2≥ 3
3
or, n ≥ log 2
10

4
Fall 2024-2025

or, n ≥ 9.96 ≈ 10

Therefore, minimum n=10 iterations are required.


2
Example 3.6 Find the ro0ot of f (x)=x – 3 using bisection method with accuracy
ε =0.01 in the interval [1, 2].

(a+b) Updat Updated


a c= b f (a) f (c ) f (b) ε
2 e Interval
1 1.5 2 −2 −0.75 1 a=c [1.5 ,2] 0.5
1.5 1.75 2 −0.75 0.062 1 b=c [1.5 ,1.75] 0.25
1.5 1.625 1.75 −0.75 −0.359 0.0625 a=c [1.625 ,1.75] 0.125
1.625 1.6875 1.75 −0.3594 −0.1523 0.0625 a=c [1.6875 ,1.75] 0.0625
1.6875 1.7188 1.75 −0.1523 −0.0457 0.0625 a=c [1.7188 ,1.75] 0.0313
1.7188 1.7344 1.75 −0.0457 0.0081 0.0625 b=c [1.7188 ,1.7344 ]0.0156
1.7188 1.7266 1.7344 −0.0457 −0.0189 0.0081 a=c [1.7266 ,1.7344 ]0.0078

Therefore, the root is x=1.7266

MATLAB Code:

function [a,b,c]=bisectionMethod()
a=1;b=2;tol=0.01;

while abs((b-a))>tol
c=(a+b)/2;

if f(a)*f(c)<0
b=c;
else
a=c;
end
end
end
function f=f(x)
f=x*x-3;
end

Example 3.7 Given the equation x e x =1. Use the bisection method THREE
times in the interval [0 ,1] to get a new smaller interval, giving your answer
up to 3 d.p.

Solution: We have, f ( x )=x e x −1

a c b f (a) f (c ) f (b) Update Updated interval

5
Fall 2024-2025

0 0.5 1 −1 −0.1756 1.718 a=c [0.5 ,1]


0.5 0.75 1 −0.1756 0.5877 1.718 b=c [0.5 , 0.75]
0.5 0.625 0.75 −0.1756 0.8682 0.5877 b=c [0.5 , 0.625]

3.3.2 Order of Convergence

There are different iterative methods in finding the roots of an equation. To compare the
methods, order of convergence is used.
Let ε n be the error in the nth iteration for a root  of f (x)=0, then:
ε n=|x n−α|
If
lim ε n−1
n →∞
R
=A (const)
εn
then the order of convergence of the sequence {x n } is R.
In special case,
If R=1, the convergence is called linear.
If R=2, the convergence is called quadratic.
If 1< R<2, the convergence is superlinear.

More problems related to Bisection method:


1. Use Bisection method to find solutions accurate to within 10−2 for
3 2
x −7 x + 14 x−6=0,
on each interval: (a) [0 ,1] , b. [1, 3.2], c. [3.2, 4]
2. Use Bisection method to find solutions accurate to within 10−3 for the following
problems.
a. x−2−x =0 for 0 ≤ x ≤1 .
b. e x −x 2 +3 x−2=0 for 0 ≤ x ≤ 1.
c. 2 x cos 2 x−( x +1 )2=0 for−3 ≤ x ≤−2.

3.3.3 The Secant Method

In Secant method two values of x near the root is used and the root is approximated by
the x-intercept of the secant line (chord) joining the two points. The straight line through
f (x 2 )−f (x1 )
the two points (x 1 , f (x 1)) and(x 2 , f (x 2)) is y−f (x 2 )= ( x−x 2)
x 2−x 1
On the x-axis y=0 and let x=x 3, then
f (x 2)−f (x 1 ) y
−f (x 2)=
x 2−x 1
(x 3−x 2 ) ( x1 , f ( x1 ))
(x 2−x 1)
Solving for x 3, x 3=x 2− f ( x 2) .
f ( x 2 )−f ( x 1)
2 ( x , f ( x ))
2

The estimated value will be closer to the root than either of the O x3 x x x
two initial points. We continue the process to get better 2 1
approximation of the root by using the last two computed Fig.4.3 The Secant Method
points using the iteration formula,

6
Fall 2024-2025

(x n+1−x n )
x n+2=x n +1− f ( x n+1) , n ≥ 1.
f (x n +1)−f (x n )

Here it is not necessary that the interval [ xn +1 , x n ] should contain the root i.e.
f (x n+1 )f (x n)< 0. In selecting, x 1 and x 2 care should be taken so that x 2 is closer to the
root than x 1 to get rapid convergence. This can be achieved by selecting x 1 and x 2 such
that |f ( x 2)|<|f ( x1 )|

Convergence of Secant Method

If the initial values x 0 and x 1 are close enough to the root, the secant method iterates x n
and converges to a root of function f . The order of convergence is given by φ , where
1+ √ 5
φ= ≈ 1.618. Which is the golden ratio.
2

The convergence is particularly superliner, but not quadratic. This solution is only valid
under certain technical requirements, such as f being two times continuously
differentiable and the root being simple in the question (i.e., having multiplicity 1).

There is no certainty that the secant method will converge if the beginning values are not
close enough to the root. For instance, if the function f is differentiable on the interval
[ x0 , x 1] , and there is a point on the interval where f ' =0, the algorithm may not converge.

Secant Method’s Advantages and Disadvantages

The secant method has the following advantages:


• It converges quicker than a linear rate, making it more convergent than the bisection
method.
• It does not necessitate the usage of the function’s derivative, which is not available in
several applications.
• Unlike Newton’s technique, which requires two function evaluations in every
iteration, it only requires one.

The secant method has the following drawbacks:


• The secant method may not converge.
• The computed iterates have no guaranteed error bounds.
• If f ( α )=0, it is likely to be challenging. This means that when x=α , the x - axis is
tangent to the graph of y=f (x ).
• Newton’s approach is more easily generalized to new ways for solving nonlinear
simultaneous systems of equations.

Secant Method in MATLAB


a=input('Enter function:','s');
f=inline(a)
x(1)=input('Enter first point of guess interval: ');
x(2)=input('Enter second point of guess interval: ');

7
Fall 2024-2025

n=input('Enter allowed Error in calculation: ');


iteration=0;
for i=3:100
x(i) = x(i-1) - (f(x(i-1)))*((x(i-1) - x(i-2))/(f(x(i-1)) - f(x(i-2))));
iteration=iteration+1;
if abs((x(i)-x(i-1))/x(i))*100<n
root=x(i)
iteration=iteration
break
end
end
Example 3.8: Find the root of f ( x )=cos x+ 2sin x + x 2 using secant method initiating with
x 1=0∧x 2=−0.1 with tolerancy/accuracyε =0.001

n x n+2 f (x n+2 ) |x n+ 2−x n+1|


1 -0.5136 0.1522 0.4136
2 -0.6100 0.0457 0.0964
3 -0.6514 0.0065 0.0414
4 -0.6582 0.0013 0.0068
5 -0.6598 0.0006 0.0016
6 0.6595 0.0002 0.0003

1. Compute two iterations for the function 𝑓(x )=x 3 – 5 x +1 using the secant method, in which
Related problems of Secant Method:

the real roots of the equation f ( x )=0 lies in the interval (0 , 1).
2. Compute the root of the equation x 2 e−x/ 2=1 in the interval [0 ,2 ] using the secant method.
The root should be correct to three decimal places.

3.3.4 Newton-Raphson Method


The procedure known as Newton’s method is also called Newton-Raphson method. In
this method, the root of the equation f (x)=0 is approximated by the x-intercept of the
tangent line through a guess value x 0 near the root.
The equation of the tangent through (x 0 , f (x 0 )) is
'
y−f (x 0 )=f ( x0 )(x−x 0 )
On the x-axis y=0 and let
x=x 1 , then
'
−f (x 0)=f (x 0 )( x1 −x 0)
f (x 0)
Solving for x 1, x 1=x 0− '
f (x 0 )
The process can be repeated with the new estimate of x until we reach the required
degree of accuracy.
In general, the iterative formula for the process can be expressed as
f ( xn )
x n+1=x n − ' ,n=0 , 1 ,2 , 3 ,⋅⋅ ⋅
f (x n)
Or for a simple root the convergence of the Newton-Raphson method is of order two.

y
( x0 , f ( x0 )) 8

O x2 x1 x0 x
Fall 2024-2025

Advantages of the Method


• This root-finding method is the best method to solve non-linear equations.
• The method can also be used to solve non-linear differential and non-linear integral
equations.
• The order of convergence is quadratic, faster compared to other methods.
• It is a simple method that can be easily implemented on a computer.

Disadvantages of the Method


• This method gets complicated if the derivative is not simple.
• The approximation must be chosen with great and sensitive attention.
• Sometimes, due to the assumptions made, the method may not converge.
• If the first derivative of the given function is not well-behaved in the neighborhood
of a particular root, the method may overshoot and diverge from the root.
• If the method encounters a stationary point of the function, the derivative becomes 0,
and the method will terminate.

Applications
• This method is used to find a minimum or maximum of a function.
• The method also finds application in finding multiplicative inverses of numbers and
power series.
• It is used in solving transcendental equations, obtaining zeros of special functions
such as Bessel functions.
• The method is used for the numerical verification for solutions of non-linear
equations.

MATLAB code for Newton-Raphson method:


syms x;
fprintf('Newton Raphson Method\n');
Fun=input('\nType a function \n');
xi=input('\nType initial value\n');
F = sym(Fun); % reduce function to symbolic form
dF = diff(F); % evaluate derivative in symbolic form
tol=1.0e-5;
for k=1:10
Fxi = subs(F, 'x', xi); % caalculate value of the function
dFxi = subs(dF, 'x', xi); % calculaate value of derivative
xi2=xi-Fxi/dFxi; % iteration using Newton-Raphson formula
xn=vpa(xi2,3); % reduce vaues to 7 d.p.
IX=[k xn];
disp(IX)
tol2=abs(xn-xi);
if(tol2<tol)

9
Fall 2024-2025

break;
end
xi=xn;
end

Example 3.9: Find the root of the equation √ x+ x2=7 using Newton-Raphson method.
Start at x=3 and carry out the first three iterations. Also, write MATLAB syntax for finding the
root in the interval [2.5, 3.5] using MATLAB function “fzero”.
f ( x )= √ x + x −7
2
Solution: i.
' 1
f ( x )= +2x
2 √x
Newton-Raphson iterative formula for double root is
f (x n )
x n+1=x n −
f ' (x n )

n xn f (x n) f ' (x n)
0 3 3.7321 6.2887
1 2.4065 0.3428 5.1354
2 2.3398 0.0043 5.0065
3 2.3389 0.0000007 5.0048

ii. MATLAB code:

>> F=@(x) sqrt(x)+x^2-7; % entered as function handle


>> Sol = fzero(F, [2.5, 3.5])

Sol =
2.3389

3.3.5 Starting Value for Iteration

If the starting value is reasonably close to the root, the number of iterations needed will
be less and calculation time will be saved. Use specified starting value, if stated.
Otherwise, first find an interval in which a root lies and then choose as a starting value,
x 0, either
(i) one of the endpoints of the interval where the magnitudes of the value of the
function is small, or
(ii) guess an internal point of the interval closer to the root.

3.3.6 Multiple Roots

Equal (repeated) roots are known as multiple roots. If the root  of f (x)=0 is a repeated
root, then we may write
f (x)=¿

10
Fall 2024-2025

where g(x ) is bounded and g(α)≠ 0.


The root  is called a multiple root of multiplicity m. We obtain from the above equation
' (m−1) (m)
f (α )=f (α )=⋅⋅⋅=f (α )=0, f (α )≠0
For a multiple root, the order of convergence is reduced, but the order may be increased
by modifying the methods discussed. If the multiplicity m of the root is known in
advance, then some of the methods can be modified so that they have the same rate of
convergence as that for simple roots.

3.3.7 Modified Newton-Raphson Method

For a multiple root the order of convergence of the Newton-Raphson formula is linear.
The order can be increased by the modified formula,
f (x n)
x n+1=x n −m ' , n=0 ,1 , 2 ,3 , ⋅⋅⋅
f (x n )
where m is the multiplicity of the root.
The order of convergence of the above is two as that of the simple root.
When the multiplicity of the root is not known in advance, we may proceed as follows;
The function
f (x)
u(x )= '
f (x )
has a simple root  regardless of the multiplicity of the root of f (x)=0.
When the Newton-Raphson method is applied to the simple root of u(x )=0 , we have
u(x n)
x n+1=x n − '
u (x n )
or
'
f (x n) f ( xn ) .
x n+1=x n −
¿¿

Example 3.10 The equation 686 x 3−735 x 2+ 125=0 has a double root near x=0.5 .
Compute the iterative results using modified Newton-Raphson formula.
Here we may take
3 2
f ( x )=686 x −735 x +125
and
' 2
f ( x )=2058 x −1470 x .
Newton-Raphson iterative formula for double root is
f (x n)
x n+1=x n −2
f ' (x n)
3 2
2(686 xn −735 xn +125)
¿ xn + 2
2058 x n−1470 x n

n xn f (x n) f ' (x n)
0 0.5 27 -220.5
1 0.7449 0.70855 46.93183
2 0.7147 0.00013 0.609353

11
Fall 2024-2025

3 0.7143 1.5E-07 0.021


4 0.7143 1.5E-07 0.021

3.3.8 Fixed Point Iteration Method

A fixed point of a function g(x ) is a real number  such that α =g(α ). This means  is a
root of the equation x=g(x ). To find a root of the equation f (x)=0 by an iterative
method, first rearrange the equation into a form x=g(x ). The function g(x ) is called the
iteration function. Note that there is no unique form x=g(x ) into which the equation can
be rearranged.
An iteration formula is then x n+1=g (x n), n=0 ,1 , 2 ,3 , ⋅⋅⋅
If x 0 is an approximation close to a root of f (x)=0 and x n+1=g ( x n) is an iterative
formula used to find the root of the equation near x0, then
(i) if |g (x 0 )|<1, the sequence x 1 , x 2 , x 3 , x 4 , ⋅⋅⋅ will converge to the root. In particular,
'

(a)if −1< g' (x 0 )< 0, the sequence will oscillate and converge to the root
(b)if 0< g ' (x 0 )<1, the sequence will converge to the root without oscillating.
(ii) if |g (x 0 )|≥ 1, the sequence x 1 , x 2 , x 3 , x 4 , ⋅⋅⋅ will diverge.
'

1
Example 3.11: The equation x 2−5 x 3 +1=0 has a root near x=2. Using following
iteration formulae, perform few iterations and comment on the results.

√ −1
1 2 3
(a) x = 5 x 3 −1
n+1 n
(b) x n+1=
125
( 1+ x n )
The calculation using the three iteration formulae are as follows:

Iterations (n) Formula (a) Formula (b)


0 2.3021 -1
1 2.3669 -0.064
2 2.3798 -0.0081
3 2.3823 -0.0081
4 2.3828
5 2.3829
−2
3


1 ' 5x
The iteration function in (a) is g (x )= 5 x −1 and g (x )= ,

3 a 1
a
3
6 5 x −1
x =2 '
with 0 , ga (2)=0.228.
So |g'a (2)|< 1and the sequence will converge to the root as shown in the above table.
−1
( 1+ x 2 ) and g'b (x )= −6 x ( 1+ x 2 )
3 2
The iteration function in (b) is gb (x )=
125 125
=2 '
with 0 , gb ( 2 )=−12
x
Since |gb (2)|> 1, larger than 1 so the sequence is not convergent to the root.
'

Example 3.12 : Given that f ( x )=cos x−0.8 x 2. [Ref. Page# 89 Ex- 3.12]
a. i. Find the number of real roots of the equation f (x)=0.
ii. For each root, find an interval where it lies.
b. i. Show that the equation f (x)=0 has a root in [0 ,1] .

12
Fall 2024-2025

[Link] Bisection method twice to find the new smaller interval where the root
lies.
c. Apply Secant method twice to find the root to 2 d.p in the last interval
obtained by using Bisection method.
d. i. Write down an iteration formula based on Newton-Raphson method.
ii. Perform three iterations starting with the value x 0=0.5 and write the root to 2
d.p.
iii. Write down MATLAB commands to execute the iteration four times.

e. Two iterative formulae of the given problem can be written as (a)

x n+1=
f (x)=0
√ cos x n
0.8
and (b) x n+1=cos−1( 0.8 x 2 ) can be used to estimate the root of

i. State with reason whether the iterative formulas will converge to the root near
x 0=0 .9.
ii. If the iterative formula converges to the root do the iteration two times to
estimate the root to 3 decimal places
iii. Write down MATLAB commands to execute the iterations five times.

a. i. The equation f (x)=0 i.e.


2
cos x−0.8 x =0 can be written as
2
cos x=0.8 x .
Consider the graphs of y=cos x and
2
y=0.8 x .The two curves intersect at
two points and hence the number of
real roots is 2.

ii. Consider the values of f(x) for x f(x)


different values of x: -1 -0.2597
-0.5 0.6776
0 1.000
0.5 0.6776
1 -0.2597
From the above table we see that f(-1)f(-0.5) = - 0.176 <0, a root lies in (-1, -
0.5)
f(0.5)f(1) = - 0.176 <0, a root lies in (0.5, 1)

b. i. It can be seen that f (0)=1.000 and f (1)=−0.2597


Here f (0)f (1)<0. Thus, a root lies in (0 , 1).
ii. Applying Bisection method on (0 , 1), we have

a c = (a + b)/2 b f(a) f(c) f(b) Update b−a


0.0 0.5 1.0 1.000 0.6776 -0.2597 a=c 0.5

13
Fall 2024-2025

0.5 0.75 1.0 0.6776 0.2817 -0.2597 a=c 0.25


0.75 0.875 1.0 0.2817 0.0285 -0.2597 a=c 0.125

c. Let us use starting values for Secant method as x 1=0.875 and x 2=1.0
n xn f (x n)
1 0.875 0.0285
2 1.0 -0.2597
3 0.887 0.00145
4
4 0.888 0.00013
0
x
Root to 2 d.p. is 4 =0.89 .
d. i. We have
2
f (x)=cos x−0.8 x
'
f ( x )=−sin x−1.6 x .
Newton-Raphson iterative formula is
f ( xn )
x n+1=x n − ' .
f (x n)
ii. Using the starting value x 0=0.5 from (c), we may proceed as follows:

n xn f (x n) '
f ( xn )
0 0.5 0.6776 −1.2794
1 1.0296 -0.3329 −2.50445
2 0.8967 -0.0190 −2.2159
3 0.8881 -0.0001 −2.1968
The root to 2 d.p. is 0.89.
iii. f=@(x) cos(x)-0.8*x^2;
fd=@(x) -sin(x)-1.6*x;
x(1)=0.5;
for n=1:4
x(n+1)=x(n)-f(x(n))/fd(x(n));
end
Output: >> Solution = x
0.5000 1.0296 0.8967 0.8881 0.8881

e. i. (a) In this case the iterative function g(x ) is given by


g ( x )=
cos x √ 5
0.8
= √ cos x
2
− √5 sin x
g' ( x ) =
4 √cos x
'
and g ( 0.9 )=0.7044
The iterative formula will converge to the root near 0 since |g ' (0.9)|=0.7044 <1
(b) In this case the iterative function g(x ) is given by
−1 2
g ( x )=cos (0.8 x )

14
Fall 2024-2025

' −1.6 x
g (x )=
√ 1−0.8 x 2
and g' ( 0.9 )=−1.8906
The iterative formula will not converge to the root near 0 since |g ' (0.9)|=−1.8906> 1.

ii. With x 1=0.9, the successive iterations are given below:


n xn |x n+ 1−x n|
1 0.9
2 0.8815 0.0185
3 0.8916 0.0101

iii. f=@(x) sqrt(cos(x)/0.8);


x(1)=0.9;
for n=1:5
x(n+1)=f(x(n));
end
Output: Solution = x
0.9000 0.8815 0.8916 0.8861 0.8891 0.8875

Exercise 3
1. Given the following polynomial equations and an interval.
a. x 3−5 x+ 1=0 ; [ 2 ,3 ] , c. x 4 −2 x−5=0 ; [ 0 , 2 ] ,
b. x 3 + x 2−2 x−5=0 ; [ 1 ,2 ] , d. x 4 + x 2−80=0 ; [ 2.90 ,2.92 ] .
i. Find the number of real roots of the equation by graphical method. Find also
the number of complex roots, if any.
ii. Apply bisection method two times in the given interval to find the new
smaller interval of this root.
iii. Apply secant method to estimate the root correct to 2 d.p. in the last interval
acquired by using bisection method.
iv. Write down an iteration formula based on Newton-Raphson method.
v. Perform one iteration starting using the above formula (iv.) with a suitable
value in the given interval to estimate the root to 2 d.p.
vi. Write down MATLAB codes to execute the iteration four times.
vii. Write MATLAB commands “roots” to find all the roots including complex
roots.
2. Given the following nonlinear equations.

a. 2 sin() x
2
−x 2 +1=0 ,
i. sin−1 x + x 2−1=0.

b. cos 2 x +4−x=0 , j. √ x−cos ( x )=0


sin x − x k. x 3−7 x 2+ 14 x−6=0
c. +e =0
x

15
Fall 2024-2025

d. x¿ l. x−2−x =0
x 2
e. 2 e −x −7=0 , m. sin ( x )−e x =0
2
f. x + ln x−2=0. n. 2 x cos ( 2 x )−( x−2 )2=0
g. ln ( x )−2 x +7=0 , o. 2 x+3 cos ( x )−e x =0
h. cosh ( x )−x 2=0 ,
i. For each function, find a suitable interval for which the root lies.
ii. Use the bisection method two times to find the new smaller interval in one
of the intervals obtained in(ii).
iii. Use secant method in the interval obtained in (iii) to find the root of the
equation correct to 2 decimal places.
iv. Write an iterative formula based on Newton-Raphson method and iterate 2
times with a suitable value.
v. Write MATLAB codes to execute the iterative formula five times in part (v).
vi. Use MATLAB builtin function “fzero” to find all the roots of each equation
using an interval or a guess value.
3.

Given the equation 5 x+ sinhx−e x −6=0 .


i. Apply Newton-Raphson method in the interval [1, 2] to estimate the root
correct to 3 d.p.
ii. The following iterative formulae are suggested to estimate the root of the
above equation.
1 x 1 x
a. x n+1= (e −sinhx+ 6) b. x n+1= ( e −sinhx +6)¿
5 6
State with reason which iterative formula will converge faster to the root
near x=1.
iii. Use the suitable iterative formula from the above two (a) and (b) to find the
root correct to 2 decimal places.
iv. Write MATLAB codes to execute the iterative formula in (iii) five times.

4.
Given the equation 4 cos ( x2 )−3 x =0
i. Apply bisection method two times in the interval [1.0 ,1.2] to find the new
smaller interval where the root lies.
ii. The following iterative formulae are suggested to estimate the root of the
above equation
1
( i ) x n +1= ¿
4
State with reason which iterative formula will converge faster to the root
near x=1.1.
iii. Use the suitable iterative formula from the above two ((i) and (ii)) to find the
root correct to 2 decimal places.
iv. Use MATLAB built-in function “fzero(fun,x0)” to find all the roots of the

16
Fall 2024-2025

given equation in the interval [0 ,2 ].


5.

Given the equation x e x −x−3=0.


i. The following iterative formulae are suggested to estimate the root of the above
equation.
1 1
a . x n+1= [ 9 x n−x n e +3 ] ,b . x n+1 = [ 11 x n−x n e +3 ] .
n x n x
8 10
State with reason which iterative formula will converge faster to the root near x=1.2.
ii. Use the suitable iterative formula from the above two (a) and (b) to find the root
correct to 2 decimal places.
iii. Write MATLAB codes to execute the iterative formula used in (ii) five times.

6. Consider the polynomial equation x 4 + x 2−2 x−5=0.


a. Find the number of real roots of the equation by graphical method. Find also
the number of complex roots, if any.
b. Show that the equation has a root in [1, 2].
c. An iterative formula x =( 5+2 x −x 2 )1 /4 may be used to estimate the root.
n+1 n n

Verify whether the iterative formula will converge to the root near x 0=1.7 .
d. If the iterative formula converges to the root do the iteration two times to
estimate the root to 3 decimal places.
e. Write MATLAB commands “roots(p)” to find all the roots including complex
roots.
7. You are designing a spherical tank to hold water for a small village in a developing
π h [ 3 R−h ]
2
country. The volume of liquid it can hold can be computed as V =
3
Where V = volume [m3 ], h = depth of water in tank [m], and R = the tank radius [m]
If R = 3 m, to what depth must the tank be filled so that it holds 30 m3 ?
Use N-R method to calculate the depth.

8. The lateral surface area, S, of a cone is given by: S=πr √ r 2 +h2,


where r is the radius of the base and h is the height. Determine the
radius of a cone that has a surface area of 1800 m2 and a height of
25 m. Solve by using the fixed-point iteration method with

17
Fall 2024-2025

r =S /(π √ r 2+ h2) as the iteration function. Start with r =17 m and calculate the first four
iterations.
[Ref. Numerical methods for Engineers and Scientists – Amos Gilat, Vish
Subramaniam, Page 89 ex-3.4]

18

You might also like