Gauss-Jordan Method for Linear Systems | Numerical Methods Lab
Numerical Methods - Gauss-Jordan Method

Lab 3: Gauss-Jordan Method for Systems of Linear Equations

Lab 3: Solution of Systems of Linear Equations using Gauss-Jordan Method

Experiment Information

Experiment: Solution of Systems of Linear equations using Gauss-Jordan method

Course Code: Numerical Methods

Description: Complete lab report covering theory, algorithm, Python implementation and analysis of Gauss-Jordan elimination method

Complete Lab Report PDF

1. Theory of Gauss-Jordan Elimination Method

1.1 Mathematical formulation of the method

1.2 Comparison with Gaussian elimination

1.3 Advantages of reduced row echelon form

2. Algorithm

2.1 Step-by-step elimination procedure

2.2 Pivoting strategies

2.3 Computational complexity analysis

3. Implementation

3.1 Python code with numpy

3.2 Input/output specifications

3.3 Handling special cases

4. Observations

4.1 Data recording table

4.2 Sample calculations

4.3 Verification of results

5. Results

5.1 Solution accuracy

5.2 Error analysis

5.3 Comparison with other methods

6. Discussion

6.1 Advantages and limitations

6.2 Numerical stability considerations

6.3 Applications in engineering problems

Python Implementation of Gauss-Jordan Method

gauss_jordan.py
import numpy as np

n = int(input("No. of Unknowns:"))
A = np.zeros((n, n+1), dtype=float)

print("Enter the elements row-wise:")
for i in range(n):
    rowData = input(f"Row{i+1}:").split()
    if len(rowData) != (n+1):
        raise Exception("Error in row and column")
    A[i] = np.array(rowData, dtype=float)

m = A.shape[0]
n = A.shape[1]

if n != m + 1:
    raise Exception("error")

for j in range(m):
    if abs(A[j, j]) < 5e-8:
        raise Exception("Solution is unavailable")
    for i in range(m):
        if i != j:
            A[i] = A[i] - A[i, j]/A[j, j] * A[j]

x = np.zeros(m, dtype=float)
for i in range(m):
    x[i] = A[i, m]/A[i, i]
    print(f"x[{i + 1}] = {x[i]}")
            
×

Disclaimer

The educational materials provided on this website are intended as supplementary resources to support your learning journey. These lab reports are sample documents designed to help students understand proper formatting and content organization.

We have made every effort to ensure the accuracy of the content. However, we recommend students to perform their own experiments and prepare original reports. These samples should be used as references only.

We respect intellectual property rights. If you believe any content should be credited differently or removed, please don't hesitate to contact us. We're happy to make appropriate corrections or give proper attribution.

Leave a Comment

Scroll to Top