Question: class Row_Reduced(): def reduced_row_echelon_form(self,A,m,n): self.A= A rc = m cc = n x = 0 for j in range(rc): if x >= cc: return self.A

class Row_Reduced():

def reduced_row_echelon_form(self,A,m,n):

self.A= A

rc = m

cc = n

x = 0

for j in range(rc):

if x >= cc:

return self.A

i = j

while self.A[i][x] == 0:

i += 1

if i == rc:

i = j

x += 1

if cc == x:

return self.A

temp=self.A[i]

self.A[i]=self.A[j]

self.A[j]=temp

v = self.A[j][x]

temp=[]

for sum in self.A[j]:

temp.append(sum / float(v))

self.A[j] = temp

for i in range(rc):

if i == j:

pass

else:

v = self.A[i][x]

temp=[]

for w0, w1 in zip(self.A[j], self.A[i]):

temp.append(w1-v*w0)

self.A[i] = temp

x += 1

def Pivots_N_Display(self):

for i in range(m):

self.A[i].append(0.0)

pivots=[]

self.c_pivots=[]

for i in range(m):

for j in range(n):

if self.A[i][j]!=0:

pivots.append([i,j])

self.c_pivots.append(j)

break

print(" The Pivot Positions Are: ", end="")

for i in pivots:

print (i,end=" ")

print()

print(" RREF Form Of The Matrix: ")

for i in self.A:

for j in range(n+1):

print(i[j], end=" ")

print()

def Col_Matrix(self):

self.c_A=[]

for i in range(n+1):

p0 = []

for j in range(m):

p1 = self.A[j][i]

p0.append(p1)

self.c_A.append(p0)

def Free_Col(self):

self.Free_Columns=[]

for i in range(n):

if i not in self.c_pivots:

self.Free_Columns.append(i)

def Parametric(self):

if self.Free_Columns==[]:

print(" There Are Only Trivial Solutions ")

else:

prt=""

q0 = [0]*n

prt += str(q0)

for i in range(len(self.c_A)-1):

if i in self.Free_Columns:

q0=[0]*n

k=0

for j in range(n):

if j==i:

q0[j]=1

elif j in self.Free_Columns:

q0[j]=0

elif j>i:

break

else:

q0[j]=self.c_A[i][k] * -1

k+=1

prt+="+"+"x"+str(i+1)+"*"+str(q0)

print(" The Solution In Parametric Form Is:")

print(prt," ")

A = []

m = int(input(" Enter The Number Of Rows Of The Matrix: "))

n = int(input("Enter The Number Of Columns Of The Matrix: "))

print(" Enter The Entries Of Rows Of The Matrix: ")

for i in range(m):

A.append(list(map(float, input().split())))

FR=Row_Reduced()

FR.reduced_row_echelon_form(A, m, n)

FR.Pivots_N_Display()

FR.Col_Matrix()

FR.Free_Col()

FR.Parametric()

Explain def reduced_row_echelon_form in detail

also explain Parametric in detail, line by line

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!