Calling Row of a Matrix | Linear Algebra using Python

Linear Algebra using Python | Calling Row of a Matrix: Here, we are going to learn how to call rows of a matrix in Python?
Submitted by Anuj Singh, on May 14, 2020

Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. Matrix is the key to linear algebra. All the linear algebra revolves around matrices. Whenever we have to go for row operations, then we have to call our relevant row.

The following code shows how to call a whole row of a matrix.

Python code for calling row of a matrix

# Linear Algebra Learning Sequence
# Calling row of a matrix

import numpy as np

# Use of np.array() to define a matrix
V = np.array([[1,2,3],[23,3,5],[33,68,87]])

row = 3

# Printing the 3rd row
print("---The Matrix V1---\n",V)
print("The Row 3 = ",V[row - 1])

Output:

---The Matrix V1---
 [[ 1  2  3]
 [23  3  5]
 [33 68 87]]
The Row 3 =  [33 68 87]






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.