0% found this document useful (0 votes)
20 views

Flow Chart (Week 3)

The document describes a process for solving systems of linear equations using Gaussian elimination. It defines variables to represent the number of unknowns, the coefficient matrix, and the solution vector. It then walks through the steps of Gaussian elimination which include initializing the matrix, performing row reduction, and back-substituting to solve for the unknown variables.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Flow Chart (Week 3)

The document describes a process for solving systems of linear equations using Gaussian elimination. It defines variables to represent the number of unknowns, the coefficient matrix, and the solution vector. It then walks through the steps of Gaussian elimination which include initializing the matrix, performing row reduction, and back-substituting to solve for the unknown variables.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

START

i<n

NO OF UNKNOWN

i<n

j<n+1

aij

j<n

aij=0

j>i+1

K<n+1

a[j,k]= a(j,k)-a[j][i]

print a(j,k)
NO

YES
NO

YES

STOP

NO
NO

YES
a(i,k)=
x(i)=
print
print(x)
K<n+1
j>=i+1
STOP
aii=0
a(i,n)/a(i,i)
i<n
a(i,k)-a(i,j)
a(i,k)
Continued…….

# -*- coding: utf-8 -*-

"""

Created on Thu Sep 2 23:15:57 2021

@author:

"""
import numpy

def Gauss ():

n=int(input("Enter the number of unknows to be computed"))

a=numpy.zeros((n,n+1))

x=numpy.zeros(n)

for i in range (n):

for j in range (n+1):

a[i][j]=float(input('a[ '+str(i)+' ][ '+str(j)+' ]='))

print(a)

for i in range (0,n):

if a[i][j]==0.0:

print("Dividing by zero")

break

for j in range (i+1,n):

R=(a[j][i]/a[i][i])

for k in range (0,n+1):

a[j][k]=a[j][k]-R*a[i][k]

print(a)

for i in range (0,n):

if a[i][i]==0.0:

print("Dividing by zero")

break

for j in range (i+1,n):

R=(a[i][j]/a[j][j])

for k in range (0,n+1):


a[i][k]=a[i][k]-R*a[j][k]

print(a)

for i in range (0,n):

x[i]=a[i][n]/a[i][i]

print(x)

You might also like