Scalar Multiplication of Vector using NumPy | Linear Algebra using Python

Linear Algebra using Python | Scalar Multiplication of Vector using NumPy: Here, we are going to learn how to find scalar multiplication of vector using numpy in Python?
Submitted by Anuj Singh, on May 21, 2020

Prerequisite: Defining Vector using Numpy

To read about the Scalar Multiplication of Vector, visit: Scalar Multiplication of Vector

Here, we will implement the python program to find the Scalar Multiplication of Vector using NumPy.

Python code to find scalar multiplication of vector using NumPy

# Linear Algebra Learning Sequence
# Scalar Multiplication of Vector using NumPy

import numpy as np

# Use of np.array() to define a vector
V1 = np.array([[14],[23],[32]])

# Scalar Multiplication with c =2
print("The Vector V1 = ", V1)
print("The Vector 2xV = ", 2*V1)

Output:

The Vector V1 =  [[14]
 [23]
 [32]]
The Vector 2xV =  [[28]
 [46]
 [64]]






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.