Adding Dimension to the Vector | Linear Algebra using Python

Linear Algebra using Python: In this article, we will learn about adding dimension to the Vector, python implementation of it.
Submitted by Anuj Singh, on May 12, 2020

Prerequisite: Linear Algebra | Defining a Vector

Vector dimensions are also an important aspect of linear algebra. We can add two vectors only and only if both the vectors are in the same dimensional space.

In the python code, we will add dimensions to the vector. If a vector is in 4-dimensional space and we want to further extend our vector in 7-dimensional space, that is we are adding a 3-dimensional component to our initial vector.

Python code for Adding Dimension to the Vector

# Vectors in Linear Algebra
a = [3, 5, -5, 8]
b = [0, 0, 0]

print("Vector a = ", a)

# This is a 4-dimensional vector
print("Vector a after dimensional addition = ", a + b)
# This is now a 7-dimensional vector 
# in which the 5th, 6th and 7th component 
# are 0 the overall magnitude or length 
# of the vector is same

Output

Vector a =  [3, 5, -5, 8]
Vector a after dimensional addition =  [3, 5, -5, 8, 0, 0, 0]






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.