Chapter 2
Chapter 2
1
Introduction
• Equations need to be solved in all areas of science and engineering in the form of f (x) = 0 are said to be non-
linear where the degree of the equation is greater than one (variable change b/n two entities)
• The solutions (values of x) are known as the roots of the equation f (x) = 0, or the zeroes of the function f (x).
2
Fig: Illustration of equations with no, one, or several solutions.
Algebraic method
This method is solving the equations that are in the form of
ax2 +bx +c=0 or that can be reduced to this form easily.
To solve f ( x ) ax 2 bx c 0,
3
it is clear that we use quadratic equation soln method.
• There are many other functions for which the root cannot be
determined so easily. For this cases, the graphical or numerical
methods provide efficient to obtain the answer.
Graphical methods
A simple method for obtaining an estimate of the root of the
equation f (x)=0 is to make a plot of the function and observe
where it crosses the x-axis.
By plotting the graph f (x) Vs X on
Example: Obtain an initial
an Excel we can estimate the
approximation to a root of the
4
crossing point
Equation f(x)=cos x – x e =0
x
From the table we find that the function From the graph we can approximate
f (x)= 0 has at least one root in the the crossing point between 0.4 – 0.6
interval (0.5 -1). While the exact root is 0.517757363
Numerical methods
5
1. Bracketing methods: is based on the fact that a function
typically changes signs in the vicinity of a root. Require two
starting values of Xl and Xu values that necessarily bracket the root.
1. Bisection
2. False position.
6
f(a)*f(b) <0, then the equation f(x) =0; has at least one real
root or an odd number of roots in the interval [a,b].
i.e. Given the interval (a, b) in which solution exists:
Then : c = (a + b)/2,
if f(c)= 0, then c is an exact solution,
else if f(a)*f(c) < 0 then the root lies in the interval (a, c),
else the root lies in the interval (c, b).
Steps for Bisection Method
1. Choose xl and xu as two
guesses for the root such that
f(xl) f(xu) < 0
2. Estimate the root, xm of the
7
equation f (x) = 0 as the mid-
point between xl and xu as:
4. New estimate:
8
Approximate relative Error:
Advantages
• Always convergent.
• The root bracket gets halved with each iteration – error
9
minimization is guaranteed.
• Possible to estimate the number of iteration required.
If Δx(0)is the original interval; the number of
bisections (n) required to attain a prescribed absolute
error, e is:
Disadvantages of bisection method
10
2. If a function f(x) is such that it just
touches the x-axis it will be unable to
find the lower and upper guesses.
11
initial guesses values.
However, instead of simply dividing the region in two, a linear
interpolation is used to obtain a new point which is (hopefully, but
not necessarily) closer to the root than the equivalent estimate for
the bisection method.
12
• The fact that the replacement of the curve by a straight line gives a
“false position” of the root is the origin of the name.
The procedure is similar to the Bisection method; the only difference
is the method used for calculating the root (Xm)
13
2. Estimate the value of the root from the following formula given and
evaluate f(xr) ~~0
3. Use the new point to replace one of the original points,
keeping the two points on opposite sides of the x axis.
14
If f(xr)>0 then xu=xr == > fu=f(xr)
If f(xr)=0 then you have found the root and do not need to
go further!
4. See if the new xl and xu are close enough for convergence to
be declared. If they are not go back to step 2.
Eg1. f(x)=6x2+12x-30=0, Eg2. 2-x+lnx=0
find at least one root?
Why bracketing method?
– Always converges for a single root.
15
can miss-lead us.
• Generally In the bracketing method:
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.
3.2 Open Method
Basic Concepts in open methods
•Open methods:
are based on formulas that require only a single starting values of
16
X or two values that do not necessarily bracket the root.
As such, they sometimes diverge.
When the open methods converge, they usually do so much more
quickly than the bracketing methods.
•Types of the method:
Fixed-point
Newton-Raphson Method
The Secant Method
Fixed-point Iteration
Fixed-point iteration (one-point iteration or successive
substitution) rearrange the function f(x)=0 so that x is on the left-
hand side of the equation like:
x = g(x)
Algebraic manipulation or simply adding x to both sides of the
original equation.
Given an initial guess at the root xi, then x = g(x) can be used to
compute a new estimate xi+1 as expressed by the iterative formula
xi+1 = g(xi)
Solution: X0=0, f(0)=2
e.g solve f(x) =2-x+lnx=0, X1=2, f(2)=2.693
X2=2.693, f(2.693)=2.991
hint x=2+lnx X3=2.991, f(2.991)= 3.096
ᵋa= (3.096-2.991)*100/3.096 =3.4%
17
Newton-Raphson Method
18
functions whose derivatives can be evaluated analytically.
• Geometrically, Xi+1 can be interpreted as the value of X at which a
line, passing through the point (Xn,f(Xn)) and tangent to the curve f(x)
at that point, crosses the y axis.
• If we continue the process we get the following scheme
19
Cont’d
20
Initial guessed Root
Termination Criteria & Error Estimates
21
Is as small number as 10-3 or 10-6
Conclusion on N-R Method
22
• May not converge if the estimate is far off.
• May not converge if the derivative (slope) at an estimate is close to
zero.
Mistake (Pitfalls) of the Newton – Raphson Method
23
The Secant Method
24
finite divided difference.
• The first derivative of the function f can be approximated using the
finite difference method(FDM).
Substituting this approximation in the Newton – Raphson
formula, to yield the following iterative equation.
f ( xi ) xi xi 1
xi 1 xi ' xi f ( xi )( )
f ( xi ) f ( xi ) f ( xi 1 )
25
xi 2,3,4,...
26
Convergence of the root using the secant method to
exact root
27
applications.
• It requires only one function evaluation per iteration,
as compared with Newton’s method which requires two.
Disadvantages of secant method:
• It may not converge.
• There is no guaranteed error bound for the computed
iterates.
• It is likely to have difficulty if f ‘(α) = 0. This means the x-
axis is tangent to the graph of y = f (x) at x = α.
Example2: A mass balance for a pollutant in a well-mixed lake can
be written as:
V=3.14*h2(9-h)/3
30