A = np.array([[1,2,2],[2,-1,2],[3,1,1],[1,1,-1]])
b = [[10],[5],[10],[3]]
show("A is: ", A)
Q,R = np.linalg.qr(A)
show("Q is: ", Q)
show("R is: ", R)
right_hand_side = np.dot(Q.T,b)
x = var('x')
show(R,x, ' = ', right_hand_side)
show (x,' = ',np.linalg.lstsq(R,right_hand_side)[0])
show ('2-norm',' = ',np.linalg.lstsq(R,right_hand_side)[1])
show ('rank',' = ',np.linalg.lstsq(R,right_hand_side)[2])