Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Bisection Method

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

BISECTION METHOD

The bisection technique is a numerical approach to determining a function's root. It is a


straightforward and reliable method that works by repeatedly splitting an interval in half and
picking the subinterval containing the function's root. The bisection approach presupposes that
the function is continuous and that the interval has just one root.

The bisection approach is as follows:

1. Choose an interval [a, b] such that the signs of f(a) and f(b) are opposite. This assures that
at least one root of the function exists in the interval.
2. Determine the midpoint c = (a + b) / 2.
3. Determine the function's midpoint, f (c).
4. If f(c) equals zero, then c is the function's root, and we're done.
5. If the signs of f(c) and f(a) are opposite, the root must be in the interval [a, c]. Step 2 is to
set b = c.
6. If the signs of f(c) and f(b) are opposite, the root must be in the interval [c, b]. Step 2 is to
set a = c.
7. Repeat steps 2–6 until you get the required degree of precision.

The bisection technique ensures convergence to a functioning root if the function is continuous
and has a root in the interval [a, b]. It may, however, converge slowly, particularly if the starting
interval is large or the function includes a relatively flat area around the root.

Example:

If we are looking for the root of the function f(x) = x^3 - 5x^2 + 3x + 7 in the interval [1, 3].
Here's how to use the bisection method in MATLAB.
Figure 1:Bisection Method

In this code, we define the function f(x) in MATLAB using an anonymous function. In addition,
we set the interval [a, b] to [1, 3] and the required degree of precision to 1e-6.

After that, we establish some variables and begin a loop that uses the bisection approach until the
necessary degree of precision is reached or the interval gets too tiny. We check if the root is in
the left or right subinterval in each iteration and update the interval accordingly. We also
compute the midpoint and function value at the midpoint and update the variables.

Discussion: This indicates that the bisection technique identified a root of the function f(x) = x3
- 5x2 + 3x + 7 within a tolerance of 1e-6 in 21 iterations, and the solution is 2.210756.
NEWTONS RHAPSONS METHOD
The Newton method, commonly known as the Newton-Raphson method, is a numerical
approach to determining the roots of a differentiable function. The approach begins with an
educated guess for the root and iteratively improves the estimate by locating the intersection of
the tangent line of the function at the current estimate and the x-axis. This procedure is continued
until the necessary degree of precision is reached. The Newton-Raphson technique is a strong
tool for locating the roots of complicated functions, but it might fail to converge or converge to
the incorrect root if certain requirements are not satisfied. As a result, it is critical to carefully
select the starting guess and test the algorithm's convergence.

The steps of Newton's approach are as follows:

1. Choose an initial guess x 0 for the function f's root (x).


2. Determine the slope of the tangent line to f(x) at x 0, denoted by f'(x 0).
3. Determine the tangent line's x-intercept by setting the equation of the tangent line to zero
and solving for x. This is the next root estimate, x 1.
4. Repeat steps 2 and 3 until the required degree of precision is obtained, using the new
estimate x 1 as the starting point.

The general formula for the Newton-Raphson method is:

x_n+1 = x_n - f(x_n) / f'(x_n)

where:

1. x_n is the current guess for the root

2. x_n+1 is the next guess for the root

3. f(x_n) is the value of the function at the current guess

4. f'(x_n) is the derivative of the function at the current guess

Example: In this code, we create the function f(x) and its derivative f'(x) using anonymous
functions in MATLAB to solve for the root of the function f(x) = x^3 - 2x - 5, using an initial
guess of x0 = 2 and a tolerance of tol = 1e-6. We also specify x 0 as the beginning guess and 1e-
6 as the acceptable degree of accuracy.
Figure 2:Newtons-Rhapson Method

We then begin a loop that uses Newton's approach to obtain the appropriate degree of precision.
We generate the new estimate for the root in each iteration by subtracting the function value
divided by the derivative from the previous estimate. We also update the variables and increase
the number of iterations.

Discussion: This code should converge at the root x = 2.094551, after 3 iterations.
FALSE POSITION METHOD
The regular falsi technique, commonly known as the false position method, is a numerical
approach to determining the roots of a function. It is an iterative process that begins with two
guesses, one on each side of the root, and then determines the point where the line connecting the
two guesses crosses the x-axis. This location is then utilized as a fresh guess, and the procedure
is continued until the necessary degree of precision is obtained.

The false position technique is similar to the bisection method, but it is more efficient for non-
strictly monotonic functions. Nonetheless, if the function has a flat region near the root, it can
still converge slowly.

The stages for the fake position approach are as follows:

1. Choose two initial estimates, a and b, so that the signs of f(a) and f(b) are opposite.

2. Determine the slope of the line joining (a, f(a)) and (b, f(b)), provided by:

3. m = (f(b) - f(a)) / (b - a)

4. Determine the line's x-intercept, which is provided by:

5. c = a minus f(a) * (b minus a) / (f(b) minus f(a).

6. Examine f(c) to see if it has the same sign as f(a) or f(b) (b). If it has the same sign as f(a), set
a = c. If it has the same sign as f(b), set b = c. If f(c) is very near to zero, stop iterating and return
c as the root.

7. Repeat steps 2-4 until you get the required degree of precision.

It should be noted that if the function is continuous and has a root between the first estimations,
the false position approach assures convergence. However, if the function has a flat region
around the root, it may converge very slowly. In reality, if the function is known to be
differentiable, it is frequently a good idea to employ alternative approaches, such as Newton's
method or the secant method.

Example: If we wish to use the false position approach to determine the root of the function f(x)
= x^3 - 2x - 5. We'll start with a = 1 and b = 3 as the first estimates.
The MATLAB code is as follows:

Figure 3:False Position Method

Discussion: This means that the root of the function f(x) = x^3 - 2x - 5 is approximately
2.094557.
FIXED POINT ITERATION METHOD
Nonlinear equations of form f(x) = x, where f is a continuous function, are solved numerically
using the fixed position technique. The process generates a series of numbers x1, x2, x3,...,
iteratively, using the iteration formula: xn+1 = g. (xn).

In order to use the fixed position approach, the initial equation f(x) = x must be changed to the
equivalent form x = g(x), where g(x) is a function that converts x to a new value. The selection
of this function, g(x), ensures that the iterative process xn+1 = g(xn) converges to a fixed point,
which is a value of x such that g(x) = x. There must be a solution to the initial equation f(x) = x if
a fixed point is present.

Nonlinear equations of form f(x) = x, where f is a continuous function, may also be solved
numerically using the fixed position approach. Below are the stages that make up the fixed
position approach of numerical analysis:

1. A new equation of the form x = g(x), where g(x) = f(x) + x, should be used.
2. Choose a starting point for x, represented by x0.
3. Use the iteration formula: xn+1 = g to produce a series of numbers x1, x2, x3.. (xn).
4. Till a stopping requirement is satisfied, keep iterating. This might be until the values of
xn are sufficiently close to a fixed point of g, a specified number of repetitions, or a
maximum error tolerance.
5. Examine how the series of numbers x1, x2, x3,... behave as n rises to see whether the
approach converges. It is likely that the fixed point at which the sequence converges to a
fixed value of g is a solution to the initial equation f(x) = x.
6. The final value of xn can be used as a rough solution to the equation f(x) = x if the
procedure converges.

The fixed position approach of numerical analysis may be used to estimate the solution of
nonlinear equations by following these steps. Be aware that alternative choices of g(x) for a
given equation f(x) = x result in varying rates of convergence, and that the method's convergence
depends on the choice of g(x).

Example: Here is a code for the fixed position method, find the fixed point of y = cos(x).
Figure 4:Fixed Position Method

Discussion: The fixed point of the function y = cos may be found using this MATLAB version
of the fixed-point technique (x). The function requests input from the user for an initial estimate,
n iterations, and tol tolerance. The fixed-point iteration formula for the method is thus p = g(p0),
where g(x) is the function being utilized to identify the fixed point. Until the absolute difference
between p and p0 is smaller than the tolerance, the while loop iterates n times, whichever occurs
first. The code outputs an approximation of the answer p and exits the loop if the tolerance
requirement is satisfied. The loop terminates and no solution is printed by the code if the
tolerance condition is not satisfied after n iterations. Notice that the answer produced by the code
is quite near to the correct value since the fixed point of y = cos(x) is actually around p =
0.73908513321516... The precision of the outcome is determined by the input values for p0, n,
and tol as well as by the function g's behavior (x).
Conclusion: The bisection technique in MATLAB is simple to construct by utilizing a while
loop to repeat until the root is identified within a particular tolerance level. The approach simply
requires an initial estimation of the root and the interval to search inside. The fake position
technique in MATLAB may be done using a while loop identical to the bisection approach, but
with an additional step to compute the slope of the line joining the interval's ends. The Newton-
Raphson technique in MATLAB may be implemented using a loop that iteratively updates the
initial guess using the function and its derivative until the root is located within a certain
tolerance threshold. The approach used to discover the roots of a function in MATLAB is
determined by the function's nature and the desired precision level. The bisection technique is a
simple and robust approach that will always converge, although it is slow. Although the fake
position approach is quicker and more efficient, it may not converge. The Newton-Raphson
approach is the most economical and fastest to convergence, although it may fail for specific
functions and needs knowledge of the derivative. To guarantee that the approach converges
rapidly and properly, it is critical to select an acceptable method and start guessing. Finding the
fixed point of a given function is done numerically iteratively using the fixed-point approach.
The approach is based on the notion that a function is repeatedly applied to an initial guess until
convergence is reached. In general, the MATLAB fixed-point approach is an effective tool for
solving equations when an explicit solution is not feasible. In order to get accurate results, it's
crucial to pick a good starting guess and select a sensible tolerance limit.

You might also like