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!

Load comments ↻





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