C1_W2_Assignment exercise 4 problem

Hello everyone, could you please help me in exercise 4? I really dont know what’s the problem here

def augmented_to_ref(A, b):
### START CODE HERE ###

``````# stack horizontally matrix A and vector b, which needs to be reshaped as a vector (4, 1)
b = np.reshape(b, (4, 1))
A_system = np.hstack((A, b)).astype('float64')

# swap row 0 and row 1 of matrix A_system (remember that indexing in NumPy array starts from 0)
A_ref = SwapRows(A_system, 0, 1)

# multiply row 0 of the new matrix A_ref by -2 and add it to the row 1
A_ref = AddRows(A_ref, 0, 1, -2)

# add row 0 of the new matrix A_ref to the row 2, replacing row 2
A_ref = AddRows(A_ref, 0, 2, 1)

# multiply row 0 of the new matrix A_ref by -1 and add it to the row 3
A_ref = AddRows(A_ref, 0, 3, -1)

# add row 2 of the new matrix A_ref to the row 3, replacing row 3
A_ref = AddRows(A_ref, 2, 3, 1)

# swap row 1 and 3 of the new matrix A_ref
A_ref = SwapRows(A_ref, 1, 3)

# add row 2 of the new matrix A_ref to the row 3, replacing row 3
A_ref = AddRows(A_ref, 2, 3, 1)

return A_ref
``````

A_ref = augmented_to_ref(A, b)

print(A_ref)

END CODE HERE

I awlays end up with the following matrix

[[ 1. 2. -1. -1. 3.]
[ 0. 1. 4. 3. 22.]
[ 0. 4. 1. 1. 17.]
[ 0. -1. 4. 4. 17.]

problem1:
If you are facing problem with float values in out put matrix then solve this while creating array of A and b we mentioned dype=float change it into dtype=int

problem2:
we are facing problem with execution then continue your work by adding this remaining lines of code
# multiply row 1 of the new matrix A_ref by -4 and add it to the row 2
``````# add row 1 of the new matrix A_ref to the row 3, replacing row 3