Q:

Write a NumPy program to find a matrix or vector norm

0

Write a NumPy program to find a matrix or vector norm.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
v = np.arange(7)
result = np.linalg.norm(v)
print("Vector norm:")
print(result)
m = np.matrix('1, 2; 3, 4') 
result1 = np.linalg.norm(m)
print("Matrix norm:")
print(result1)

Sample Output:

Vector norm:
9.53939201417
Matrix norm:
5.47722557505

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now