Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Numerical Computation MTH375

Lab Report-04

Student Name Kumail Haider

Registration FA20-BEE-088
Number

Class/Section 7TH- B

Instructor’s Name DR. Iftikhar Ahmad

1
Fixed Point Iteration Method
Introduction:
The Fixed-Point Iteration method is a numerical analysis technique employed to approximate
solutions for algebraic and transcendental equations. It operates on the principle of iteratively
refining a sequence of approximations until a fixed point is reached, ultimately converging
towards the solution.

The Method:
1. Initialization: Start with an initial guess xo.
2. Iteration: Use the iterative formula xn+1=g(xn), where g(x) is a function such that g
(solution)=solutiong(solution)=solution.
3. Convergence: Repeat the iteration until xn+1 is sufficiently close to xn, indicating
convergence.

2
Advantages:
• Simplicity: The method is open and straightforward, making it easy to implement.
• Applicability: Suitable for finding real roots of non-linear equations.
• Convergence under Conditions: Ensures convergence to the root under certain
conditions.

Disadvantages:
• Slow Convergence: The method may converge slowly, especially for certain types of
functions .
• Dependency on Initial Guess: Convergence heavily depends on the choice of the initial
guess.
• Not Universally Applicable: Some functions may not converge using this method.

3
Question: Find the solution of the following nonlinear equation by using
Fixed Point Iteration Method

Code for Fixed Point Iteration Method:


import math
from tabulate import tabulate

def f(x):
return x**3-x**2 +7*x - 9

def g(x):
return 1/math.sqrt(1+x)

def fixedPointIteration(x0, e, N):


data = []
header = ['Iteration', 'x1', 'f(x1)']

print('\n\n** FIXED POINT ITERATION **')


step = 1
flag = 1
condition = True

while condition:
x1 = g(x0)
data.append([step, x1, f(x1)])
x0 = x1

step += 1

if step > N:
flag = 0
break

condition = abs(f(x1)) > e

if flag == 1:

4
print(tabulate(data, headers=header, tablefmt="grid"))
print('\nRequired root is: %0.8f' % x1)
else:
print('\nNot Convergent.')

# Input Section
x0 = float(input('Enter Guess: '))
e = float(input('Tolerable Error: '))
N = int(input('Maximum Step: '))

# Starting Fixed Point Iteration Method


fixedPointIteration(x0, e, N)

Output:
Enter Guess: 0
Tolerable Error: 3
Maximum Step: 5

** FIXED POINT ITERATION **


+-------------+------+---------+
| Iteration | x1 | f(x1) |
+=============+======+=========+
| 1 | 1 | -2 |
+-------------+------+---------+

Required root is: 1.00000000

5
Plot:

Conclusion of Regula Falsi Method


The Fixed-Point Iteration Method is a numerical technique used to approximate solutions to
algebraic and transcendental equations. It involves iteratively applying a function to an initial
guess until convergence is achieved. Through repeated substitutions, the method seeks a fixed
point where the function value equals the point itself. This process provides an effective
approach for approximating roots or fixed points of functions, aiding in solving equations in
various fields such as mathematics and engineering. It is a valuable tool in numerical analysis
for its simplicity and systematic approach to root approximation.

You might also like