Numerical Solution of Equations of A Single Variable
Numerical Solution of Equations of A Single Variable
( )
Graphically, a solution (or root) of f(x) = 0 refers to the point of intersection of f(x)
and the x-axis. Therefore, depending on the nature of the graph of f(x) in relation to the
x-axis, the equation above may have a unique solution, multiple solutions, or no
solution.
Numerical methods for solving an equation are divided into two main categories:
It is assumed that f(x) is continuous on an interval [a, b] and has a root there so that
f(a) and f(b) have opposite signs, hence f(a)f(b) < 0.
Locate the midpoint of [a, b], that is, . If f(a) and f(c1) have opposite
signs, the interval [a, c1] contains the root and will be retained for further
analysis; that is, the left end is retained while the right end is adjusted. If f(b) and
f(c1) have opposite signs, we continue with [c1, b]; that is, the right end is kept
while the left end is adjusted.
The process is repeated until the length of the most recent interval [a, b] satisfies
the desired accuracy.
The initial interval [a, b] has length (b – a). Beyond that, the first generated
interval has length ( ) , the next interval ( ), and so on. Thus, the
nth interval constructed in this manner has length (b − a)/2n− 1, and because it
brackets the root, the absolute error associated with the nth iteration satisfies:
| | (b>a)
it can be shown that the number N of iterations needed to meet the tolerance
condition satisfies:
( ) ( )
Example1: Use bisection method to find the root of f(x) = x3 − 10x2 + 5 = 0 that
lies in the interval (0.6, 0.8).
Newton’s method is the most commonly used open method to solve f(x) = 0, where f’
is continuous.
Consider the graph of f(x) in Fig.3.
Start with an initial point x1 and locate the point (x1, f(x1)) on the curve.
Draw the tangent line to the curve at that point, and let its x-intercept be x2. The
equation of this tangent line is:
( ) ( )( )
Therefore, its x-intercept is found by setting y = 0 and solving for x:
( )
( )
Once x2 is available, locate the point (x2, f(x2)), draw the tangent line to the curve
at that point, and let x3 be its x-intercept, which is found as:
( )
( )
Continue this process until the sequence {xn} converges to the intended root r.
Fig.3. Geometry of Newton’s method.
Example3: Use the Newton’s method to find a root of the polynomial equation
f(x). For the initial point use x1=0.7:
Solution:
The derivative of the function is : ( ) , so that:
x f(x) f’(x) ( )
( )
Example4: Use the Newton’s method to find a root of the polynomial equation
f(x) with MATLAB. For the initial point use x1=0.7:
Solution:
>> f=@(x)(x^3-10*x^2+5);
>> fzero(f,[0.6,0.8])
roots(C) computes the roots of the polynomial whose coefficients are the
elements of the vector C.
>> C=[1,-10,0,5];
>> x=roots(C)
solve seeks zeros of the expressions or solutions of the equations.
>> x=solve('x^3-10*x^2+5=0');
>> double(x)
Bibliography
[1] Ramin S Esfandiari. Numerical methods for engineers and scientists using
MATLAB
®. Crc Press, 2017.
[2] Kiusalaas Jaan. Numerical methods in engineering with matlab, 2009.
[3] Tao Pang. An introduction to computational physics, 1999.
[4] Chris Woodford and Chris Phillips. Numerical methods with worked examples:
Matlab edition. Springer Science & Business Media, 2011.