You are on page 1of 12

Bisection Method

Introduction:
The bisection method is a root-finding technique used to
find the roots of a continuous function. It works by repeatedly bisecting
the interval defined by two initial values with opposite signs and then
selecting the subinterval in which the function changes sign, thus
containing a root.
This process is continued until a root is found within a specified tolerance.
The method is relatively slow but very simple and robust, making it useful
for obtaining a rough approximation to a solution, which can then be used
as a starting point for more rapidly converging methods. The bisection
method is also known as the interval halving method, the binary search
method, or the dichotomy method.
Algorithm:
1. Start with a continuous function \( f(x) \) and an interval \([a, b]\) such that \( f(a) \) and
\( f(b) \) have opposite signs.
2. Calculate the midpoint \( c = \frac{{a + b}}{2} \).
3. Evaluate the function at the midpoint, \( f(c) \).
4. If \( f(c) = 0 \), the root is found and the process stops. Otherwise, if \( f(a) \) and \( f(c)
\) have opposite signs, the root lies between \( a \) and \( c \); else the root lies between \(
c \) and \( b \).
5. Repeat steps 2-4 until the interval is sufficiently small or the function value at the
midpoint is sufficiently close to zero.
6. The root is the final midpoint obtained.
7. Stop
C-Program:
Output:

Conclusion

The bisection method provides a simple and effective way to


find the roots of a real-valued function within a specified interval. The
iterative nature of the algorithm allows for successive refinement of the
interval until the desired level of accuracy is achieved. While the method
may not converge rapidly in some cases, it is robust and guarantees
convergence to a solution.
In this lab, we implemented the bisection method in C programming
language using a simple example function. This example serves as a
foundation for understanding and applying the bisection method to more
complex equations in various fields such as physics, engineering, and
finance. The bisection method continues to be a valuable tool in
numerical analysis for solving equations where other methods may not be
as practical or efficient.
Newton-Raphson method
Introduction:
The Newton-Raphson method is an iterative numerical
technique used for finding roots of real-valued functions. It is particularly
effective for functions with continuous derivatives. The method is based
on linear approximation and convergence towards the root. Newton-
Raphson is widely employed in engineering, physics, and various
scientific disciplines due to its efficiency and rapid convergence.

Algorithm:
1. Define the function and its derivative.
2. Initialize the maximum number of iterations and variables.
3. Prompt the user to enter the initial guess and the error precision.
4. Inside the while loop, calculate the function value and its derivative at the
current point.
5. Update the current point using the Newton-Raphson formula and calculate the
relative error.
6. If the relative error is less than the specified error precision, output the root
and break the loop.
7. Update the current point, check for the maximum number of iterations, and
repeat until the desired precision is achieved or the maximum iterations are
reached.
8. stop
C-Program:
Output:

Conclusion:

The Newton-Raphson method is a powerful technique for finding the roots of real-
valued functions. It offers fast convergence and ease of implementation, making it
a valuable tool in various fields. However, it is important to be mindful of its
limitations, such as the sensitivity to the initial guess and the complexity of the
function's derivative. When used appropriately, the Newton-Raphson method can
provide accurate solutions to a wide range of equations.
False Position Method:

Introduction:
The False Position Method, also known as the
Regular False method, is a numerical technique used to find the root of a
nonlinear equation. It is an iterative method that refines the root estimate
based on the intermediate values of the function at two endpoints of an
interval. This method combines aspects of both the Bisection Method and
the Secant Method.
The fundamental principle of the False Position Method involves
maintaining an interval where the root is expected to lie and updating this
interval based on the signs of the function values at the endpoints. By
iteratively narrowing down the interval, the method converges towards
the true root.
Algorithm:
1. Start
2. Choose two initial guesses, X0 and X1, such that f(X0) and f(X1) have
opposite signs.
3. Calculate the next approximation, X2, using the formula:
X2 = X1 – f(X1).(X1 – X0)
f(X1) – f(X0)
4. Update the interval: If f(X2) and f(X0) have opposite signs, set X1=X2 ;
otherwise, set X0 = X2.
5. Repeat the process until the desired level of accuracy is achieved or a
predetermined number of iterations is reached.
6. stop
C-Program:
Output:

Conclusion:

The False Position Method provides a reliable approach for


approximating roots of nonlinear equations. Its convergence and accuracy
make it a valuable tool in numerical analysis. However, caution must be
exercised in selecting initial guesses to ensure the convergence of the
method. The C-program presented here demonstrates the practical
implementation of the False Position Method, offering a versatile solution
for finding roots in various mathematical contexts.
Fixed-Point Iteration Method

Introduction:
The Fixed-point iteration is a numerical technique used
to find the root of a given function. The method relies on transforming
the original equation into a fixed-point form, where the solution
corresponds to a fixed point. The process involves iteratively updating an
initial guess until convergence is achieved.

Algorithm:

a. Start
b. Choose an initial Guess (X0).
c. Define a function g(X) such that g(X) = X represents the fixed-point
equation.
d. Update the guess iteratively using the formula: Xn + 1 = g(Xn).
e. Repeat step c until convergence is reached or a specified
number of iterations is completed.
f. Stop
C-Program:

Output:
Conclusion

The fixed-point iteration method provides an iterative approach to find


the root of a given function. Through transforming the original equation
into a fixed-point form and iteratively updating guesses, the method
converges to a solution. Care must be taken in the choice of the initial
guess and the function g(x) to ensure convergence. The provided C
program demonstrates the implementation of the fixed-point iteration
method.

You might also like