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

Numerical Computation April 2023 Miss.T.Selvaratnam: Lecture - 3,4

This document discusses numerical methods for finding the roots or zeros of nonlinear equations. It begins by introducing the problem and defining approximate solutions. Then it describes two classes of root-finding methods: bracketing methods and open methods. Bracketing methods like bisection and false position require initially bracketing or bounding the root, then narrowing the interval until the root is found. Open methods like Newton-Raphson do not require an initial bracket and instead generate a sequence of approximations starting from an initial guess. The document focuses on bisection and false position, providing algorithms, examples, and comparing their approaches. It aims to find roots of equations numerically when exact solutions are not possible.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Numerical Computation April 2023 Miss.T.Selvaratnam: Lecture - 3,4

This document discusses numerical methods for finding the roots or zeros of nonlinear equations. It begins by introducing the problem and defining approximate solutions. Then it describes two classes of root-finding methods: bracketing methods and open methods. Bracketing methods like bisection and false position require initially bracketing or bounding the root, then narrowing the interval until the root is found. Open methods like Newton-Raphson do not require an initial bracket and instead generate a sequence of approximations starting from an initial guess. The document focuses on bisection and false position, providing algorithms, examples, and comparing their approaches. It aims to find roots of equations numerically when exact solutions are not possible.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Numerical Computation

April 2023
Miss.T.Selvaratnam

Lecture - 3,4
Chapter 2

Find the roots of Non-Linear


Equations

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Introduction
 Objective is to find a solution of F(x) = 0
Where F is a polynomial or a transcendental function, given
explicitly.
 Exact solutions are not possible for most equations.
 A number x ± e, ( e > 0 ) is an approximate solution of the equation if
there is a solution in the interval [x-e,x+e]. e is the maximum
possible error in the approximate solution.
 With unlimited resources, it is possible to find an approximate
solution with arbitrarily small e.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Solution for Single variable Equations
The focus of this chapter is Numerical Solution of equations in the
general form
𝑓(𝑥) = 0
Graphically, a solution, or a root of above equation refer to the point
of intersection of 𝑓 𝑥 and the x-axis. Therefore, depending on the
nature of the curve of 𝑓(𝑥) in relation to the x-axis. Equation may
have a unique solution, multiple solutions, or no solution. A root of
an equation can sometimes be determined analytically resulting in
an exact solution.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Classification of methods to solve an Equation
of one variable

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


1. Bracketing Methods
Bracketing methods involve finding a bracket or an interval
containing the root.
The root is assumed to be located within this interval, and the
algorithm proceeds to narrow down the interval until the root is
found.
Examples of bracketing methods include the bisection method, and
the method of false position. Bracketing methods are generally
slower than the open methods, but they guarantee convergence to a
root if the function is continuous and changes sign within the
interval.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Philosophy of bracketing methods
• Sdfg

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


1.1 Bisection Methods
• It is a simplest bracketing method to find a root of f(x) = 0.
• The bisection method involves first selecting two initial values of
the independent variable (usually x) such that the function
changes sign between the two values. These two values are
referred to as the "bracketing values" or the "bracket". Then, the
method repeatedly divides the interval defined by the bracketing
values in half, and checks which half contains a root. The process is
repeated until the desired level of accuracy is achieved.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Bisection Method - Three iterations shown

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Finding roots by interval halving- Bisection
• The idea is to first bracket the root, and
then successively narrow the interval
size containing the root 𝛼 until the root
is known to within some pre-specified
tolerance.
• The bracket condition means that we
must know two points 𝑎, 𝑏 where the
function has different signs, or
𝑓 𝑎 𝑓 𝑏 < 0.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Algorithm for the Bisection Method

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Solving f(x) = 0 using Bisection (MATLAB)

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Example - 01
Use the bisection method to find the root of the equation
𝑓 𝑥 = 𝑥 3 − 2𝑥 − 5 in the interval [2, 3]. Find the root to within an
absolute error tolerance of 0.01.

Solution
First, we need to check if the function f(x) is continuous in the
interval [2, 3] and if it changes sign. We can verify that f(2) = -1 and
f(3) = 16, so the function does change sign.
Next, we can start the bisection method by setting the interval [a, b]
to [2, 3] and the tolerance to 0.01.
Then we can find the midpoint c = (a+b)/2 = 2.5 and calculate f(c) =
3.375
Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Since f(c) is positive, the root must be in the interval [2, 2.5].
Then update the interval to [a, b] = [2, 2.5] and repeat the process,
finding the midpoint c = (a+b)/2 = 2.25 and calculating
f(c) = -0.796875. Since f(c) is negative, the root must be in the
interval [2.25, 2.5].
Continue this process, halving the interval each time until the
absolute error is less than or equal to 0.01.
After five iterations, we obtain the interval [2.390625, 2.40625] with
an absolute error of 0.0078125.
Thus, we can conclude that the root of the equation 𝑓 𝑥 = 𝑥 3 −
2𝑥 − 5 in the interval [2, 3] to within an absolute error tolerance of
0.01 is approximately x = 2.3984375.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


1.2 Regula-Falsi or False Position

Regula-Falsi method is a numerical algorithm used to solve


equations numerically. The method is used to find the root of an
equation by creating a linear interpolation between two initial
points and evaluating the function at the midpoint of these points.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Algorithm for False Position method

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Example - 03

Use the Regula - Falsi method to find the root of the equation
𝑓 𝑥 = 𝑥 3 − 2𝑥 − 5 in the interval [2, 3]. Find the root to within an
absolute error tolerance of 0.01.

Solution:
Start the Regula-Falsi method by setting the interval [a, b] to [2, 3] and
the tolerance to 0.01. Then we can calculate the value of the function
at the endpoints of the interval:
f(a) = -1 f(b) = 16

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


We then find the point c where the line connecting (a, f(a)) and (b,
f(b)) intersects the x-axis. This point is given by:
c = a - (f(a) * (b - a)) / (f(b) - f(a))
c = 2 - (-1 * (3 - 2)) / (16 - (-1))
c = 2.125
Then calculate f(c) = 1.736328125. Since f(c) is positive, the root
must be in the interval [2.125, 3].
Next, update the interval by replacing the endpoint with the same
sign as f(c) with c. In this case, f(c) is positive, so we replace b with c:
f(a) = -1 f(c) = 1.736328125
Then repeat the process by finding the new point where the line
connecting (a, f(a)) and (c, f(c)) intersects the x-axis:

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


d = a - (f(a) * (c - a)) / (f(c) - f(a))
d = 2 - (-1 * (2.125 - 2)) / (1.736328125 - (-1))
d = 2.295508274
Then calculate f(d) = -0.077013563. Since f(d) is negative, the root
must be in the interval [d, c].
Continue this process, updating the interval each time by replacing
the endpoint with the same sign as f(c) with the new point. After six
iterations, we obtain the interval [2.394408007, 2.395586584] with
an absolute error of 0.004408007.
Thus, we can conclude that the root of the equation
𝑓 𝑥 = 𝑥 3 − 2𝑥 − 5 in the interval [2, 3] to within an absolute
error tolerance of 0.01 is approximately x = 2.394997295.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Difference between Bisection method and False
Position Method
1.Approach: The bisection method repeatedly divides the interval
containing the root in half and selects the subinterval that still
contains the root. The process is repeated until the desired level of
accuracy is achieved. In contrast, the false position method involves
calculating the intersection of a line segment between the function
values at the bracketing endpoints with the x-axis, and using this
intersection point as the next estimate of the root.
2.Convergence: The bisection method guarantees convergence to a
root, but it can be slow. The false position method generally
converges faster than the bisection method.
Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
3.Accuracy: The bisection method produces a result that is accurate
to within a specified tolerance level, whereas the false position
method may produce an estimate that is less accurate than the
specified tolerance level, depending on the function and initial
bracketing interval.
4.Ease of implementation: The bisection method is relatively easy to
implement and requires only knowledge of the function values at the
endpoints of the bracketing interval. The false position method
requires an additional calculation of the function value at the
intersection point of the line segment and x-axis.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


2. Open method
Open methods do not require a bracket or interval to be specified.
These methods start with an initial guess and then use some
iterative formula to generate a sequence of approximations to the
root.
Examples of open methods include the Newton-Raphson method,
the secant method, and the fixed-point iteration method. Open
methods are generally faster than bracketing methods, but they may
not converge if the initial guess is not sufficiently close to the root.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Philosophy of Open methods

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


2.1 Newton Method
• The diagram shows part of the curve 𝑦 = 𝑓 𝑥 , where the equation to be solved
is 𝑓 𝑥 = 0. It also approximate solution 𝑥𝑛 the tangent to the curve at the
point 𝑥𝑛 , 𝑦𝑛 . If the tangent cuts the x-axis at the point 𝑥𝑛+1 , 0 , then it is
clear that 𝑥𝑛+1 is a better approximation than 𝑥𝑛 to the true root 𝛌.
𝐵𝐴 𝑦𝑛
• The gradient of BC is , which is .
𝐴𝐶 (𝑥𝑛 −𝑥𝑛+1 )

• But 𝑦𝑛 = 𝑓 𝑥𝑛 , and the gradient of the tangent is 𝑓 ′ ,


𝑓 𝑥𝑛
𝑓′ 𝑥𝑛 =
(𝑥𝑛 −𝑥𝑛+1 )

• Re-arranging this gives Newton’s iteration formula


𝑓 𝑥𝑛
𝑥𝑛+1 = 𝑥𝑛 −
𝑓′ 𝑥𝑛

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Algorithm for Newton’s Method
1. Choose a point 𝑥1 as an initial guess of the solution.
2. For 𝑖 = 1, 2, … … until the error is smaller than a specified value,
𝑓 𝑥𝑛
calculate 𝑥𝑖+1 by using 𝑥𝑛+1 = 𝑥𝑛 − .
𝑓′ 𝑥𝑛

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Solution of Equation using Newton’s Method

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Example - 04

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Example - 05
Solve the equation 𝑥 3 + 3𝑥 2 − 12 = 0, correct to two decimal places.

Solution

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Example - 06
Solve the equation 𝑥 5 = 5𝑥 2 − 2, correct to three decimal places

Solution

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Example - 07
A company produces solar panels that generate electricity based on
the amount of sunlight they receive. The amount of electricity
produced can be modeled by the following non-linear equation:
P = 0.5 * A * G * (1 - e^(-0.005 * D))
where P is the power output in watts, A is the area of the solar panel
in square meters, G is the solar radiation in watts per square meter,
and D is the thickness of the panel in millimeters.
The company wants to design a solar panel that can produce a
power output of 300 watts under standard test conditions (G =
1000 W/m^2). Using Newton's method, determine the minimum
thickness of the panel required to achieve this power output.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Solution:
We can solve this problem by setting the equation equal to 300 and
solving for D using Newton's method. Here are the steps:
1.Define the function f(D) = 0.5 * A * G * (1 - e^(-0.005 * D)) - 300
2.Find the derivative of f(D) with respect to D:
f'(D) = 0.5 * A * G * 0.005 * e^(-0.005 * D)
3.Choose an initial guess for D, let's say D = 5 mm.
4.Use the Newton's method formula to iterate until the solution
converges within the desired tolerance level:
D_(n+1) = D_n - f(D_n) / f'(D_n)

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


5.Repeat step 4 until the solution converges to within the desired
tolerance level. Let's say we stop iterating when the absolute error is
less than 0.01 mm.

Using these steps, we can write a program or use a calculator to


perform the iterations. After a few iterations, we can find that the
minimum thickness of the panel required to achieve a power output
of 300 watts is approximately 10.4 mm.
In conclusion, Newton's method is a powerful numerical algorithm
that can be used to solve non-linear equations in engineering and
science. It is particularly useful in optimization and control theory
applications where non-linear equations arise frequently.
Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
2.2 Fixed point Method

The fixed point method is particularly useful when other numerical


methods such as Newton's method or the bisection method are not
applicable.
It can be used to solve a wide range of non-linear equations,
including transcendental equations, algebraic equations, and
differential equations.
Fixed point method is a simple and easy-to-use numerical algorithm
used to solve non-linear equations.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Algorithm for Fixed Point Method
1.Rewrite the original equation 𝑓 𝑥 = 0 in the form 𝑥 = 𝑔(𝑥)
2.Choose an initial guess 𝑥0 .
3.Use the iterative formula 𝑥𝑛+1 = g(𝑥𝑛 ) to generate a sequence of
successive approximations to the solution.
4.Repeat step 3 until the sequence converges to the desired
accuracy or until a maximum number of iterations is reached.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Solution of Equation using Fixed Point Method

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Example - 08

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
2.3 Secant Method
It is similar to the more well-known Newton-Raphson method, but
instead of using the derivative of the function, it approximates the
derivative using a secant line between two points.
The secant method is generally faster than the bisection method and
simpler than the Newton-Raphson method. However, it may
converge more slowly or even diverge if the initial points are not
chosen carefully.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Solution of Equation using Secant Method

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Example - 09

Find the positive solution of 𝑓 𝑥 = 𝑥 − 2𝑠𝑖𝑛𝑥 = 0 by the Secant


method, starting from 𝑥0 = 2, 𝑥1 = 1.9

Solution

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Order of an Iteration Method (Speed of
Convergence)

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka
Exercises

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


6.

7.

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka


9

Department of Interdisciplinary Studies, Faculty of Engineering, University of Jaffna, Sri Lanka

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy