import numpy
from numpy.linalg import norm
v = numpy.array([1, 2, -3])
max_norm = norm(v, ord=numpy.inf)
print("Vector v: \n", v)
print("The max norm of the vector v: ", max_norm)
Here, v is a vector. We are using the norm() function from numpy.linalg to calculate the max norm of the vector. The argument “ord=numpy.inf” indicates that we want to calculate the max norm of the vector.
The output of the above program will be:
Vector v: [ 1 2 -3] The max norm of the vector v: 3.0








































0 Comments