Create a flowchart based on the code below. _____ def mat_operations(K,J): if (K.shape != J.shape): print('The shape of both matrices are not the same. You will not able to perform operations') elif...


Create a flowchart based on the code below.
_____
def mat_operations(K,J):
if (K.shape != J.shape):
print('The shape of both matrices are not the same. You will not able to perform operations')
elif (K.shape == J.shape):
print('The matrices are viable.')
else:
print('The matrix is empty')


K = np.array([
[2,8,7],
[-2,4,6],
[6,8,6]
])
J = np.array([
[3,3,3],
[2,4,2],
[5,6,6]
])
L = np.array([
[7,-3,13],
[0,9,-2],
[-5,1,8],
[-10, 0, 1],
])
M = np.array([
[2,-5,-11,0],
[-9,4,6,13],
[4,7,12,-2],
])
N = np.array([
[1,4,5,12],
[-5,8,9,0],
[-6,7,11,19]
])


ksum = K + J
print('The sum of the given matrices: \n', ksum)
mat_operations(K,J)


kdiff = K - J
print('The difference of the given matrices: \n', kdiff)
mat_operations(K,J)


kmul = np.multiply(K,J)
print('The element-wise multiplication of the given matrices: \n', kmul)
mat_operations(K,J)


kdiv = np.divide(K,J)
print('The element-wise division of the given matrices: \n', kdiv)
mat_operations(K,J)





Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here