0% found this document useful (0 votes)
11 views6 pages

Lab 04 NC

This lab report applies the fixed point iteration method to find the solution of a nonlinear equation. The method iteratively applies a function g(x) to an initial guess x0 until the value of x converges. The student implemented code to perform fixed point iteration, tested it on the equation f(x)=x3-x2+7x-9, and found the solution to be 1 with an initial guess of 0 and tolerable error of 3 over 5 iterations. The conclusion discusses that fixed point iteration is a numerical technique for approximating solutions to equations by iteratively finding a fixed point where the function equals the input value.

Uploaded by

haiderkomail113
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Lab 04 NC

This lab report applies the fixed point iteration method to find the solution of a nonlinear equation. The method iteratively applies a function g(x) to an initial guess x0 until the value of x converges. The student implemented code to perform fixed point iteration, tested it on the equation f(x)=x3-x2+7x-9, and found the solution to be 1 with an initial guess of 0 and tolerable error of 3 over 5 iterations. The conclusion discusses that fixed point iteration is a numerical technique for approximating solutions to equations by iteratively finding a fixed point where the function equals the input value.

Uploaded by

haiderkomail113
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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