×

Python Tutorial

Python Basics

Python I/O

Python Operators

Python Conditions & Controls

Python Functions

Python Strings

Python Modules

Python Lists

Python OOPs

Python Arrays

Python Dictionary

Python Sets

Python Tuples

Python Exception Handling

Python NumPy

Python Pandas

Python File Handling

Python WebSocket

Python GUI Programming

Python Image Processing

Python Miscellaneous

Python Practice

Python Programs

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]
Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

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