2023 2024 CMP305 Lecture 4 Numerical Methods I Solving Equations
2023 2024 CMP305 Lecture 4 Numerical Methods I Solving Equations
1
Introduction
•Root finding is the process of determining the values of a variable that satisfy a given equation. Consider the
general form of an equation:
•f(x)=0
•where $f(x)$ is a continuous function. Solving for $x$ involves finding values of $x$ such that $f(x)$ equals
zero.
•4.1.1 Bisection Method
3
4.1.1 Bisection Method
•The bisection method is a simple but robust technique for finding roots. It is based on the intermediate value
theorem and is effective for continuous functions where you can identify an interval [a, b] such that f(a) and
f(b) have opposite signs.
1. Start with an interval [a, b] where f(a) and f(b) have opposite signs.
2. Compute the midpoint c = {a + b}/2.
3. Evaluate f(c).
4. If f(c) is close enough to zero (i.e., within a specified tolerance), consider c as the root and stop.
5. If not, update the interval: If f(a).f(c) < 0, set b = c; otherwise, set a = c.
6. Repeat steps 2-5 until the desired accuracy is achieved.
•The bisection method converges linearly, approximately doubling the number of correct digits with each
iteration.
• Bisection Method
4
4.1.2 Newton-Raphson Method
• The Newton-Raphson method, also known as the Newton method, is an iterative technique for finding
approximate roots of a real-valued function. Given an initial guess $x_0$, it refines the estimate using the
formula:
• Newton-Raphson Method
5
4.1.3 Fixed-Point Iteration
•Fixed-point iteration transforms the root-finding problem into an equivalent form:
•x=g(x)
•Here, g(x) is a continuous function, and finding a root of this equation is equivalent to finding a fixed point of
g. The iteration scheme is:
•This method can be used to find roots of functions by constructing an appropriate g(x) function.
6
4.1.4 Convergence and Error Analysis
•The convergence of a root-finding method is crucial. Convergence refers to how
quickly the method approaches the true root with each iteration. Key factors
influencing convergence include the choice of method, initial guess, and the
properties of the function being solved.
•Error analysis is essential to estimate the accuracy of the computed root. Methods
like the bisection method and Newton-Raphson method involve tracking the error
and setting convergence criteria based on a desired tolerance.
•In practice, the choice of root-finding method depends on the nature of the
problem, the properties of the function, and the computational resources available.
7
4.2 Applications
•Root finding is a fundamental step in various computational tasks, including:
Equation Solving: Finding solutions to equations in various scientific and engineering applications.
Optimization: Optimizing functions often involves finding roots of the derivative or gradient.
Numerical Analysis: Root-finding methods are building blocks for solving differential equations and linear
algebra problems.
Physics and Engineering: Applications include finding equilibrium points, solving circuit equations, and
analyzing mechanical systems.
8
Assignment
• Write Python code for Bisection method