Norm of the Vector | Linear Algebra using Python

Linear Algebra using Python | Norm of the Vector: Here, we are going to learn about the norm of the vector and its implementation in Python.
Submitted by Anuj Singh, on June 09, 2020

Prerequisite:

Here, we are going to learn how to find the norm of a vector using an inbuilt function in numpy library?

Python code for norm of the vector

# Linear Algebra Learning Sequence
# Outer Product Property I

import numpy as np

a = np.array([2, 4, 8, 7, 7, 9, -6])
b = np.array([2, 3, 1, 7, 8])

#outer product in both order
ma = np.linalg.norm(a)
mb = np.linalg.norm(b)

print('A : ', a)
print('B : ', b)
print('\n\nNorm of A : ', ma)
print('\n\nNorm of B : ', mb)

Output:

A :  [ 2  4  8  7  7  9 -6]
B :  [2 3 1 7 8]


Norm of A :  17.291616465790582


Norm of B :  11.269427669584644


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.