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

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.