Printing sin value of vector/matrix elements using numpy.sin() | Linear Algebra using Python

Linear Algebra using Python | numpy.sin(): Here, we are going to learn how to print sin value of vector/matrix elements using numpy.sin() in Python?
Submitted by Anuj Singh, on May 23, 2020

Prerequisite:

Numpy is the library of function that helps to construct or manipulate matrices and vectors. The function numpy.sin(x) is a function used for generating a matrix/vector.variable with the Sine value of b x (as sin(x)) .

Syntax:

    numpy.sin(x)

Input parameter(s):

  • x – could be a matrix or vector or a variable.

Return value:

A Matrix or vector or a variable of the same dimensions as input x with sin(x) values (between -1 and 1) at each entry.

Applications:

  1. Machine Learning
  2. Neural Network
  3. Geometry
  4. Physics Problems

Python code to print sin value of vector/matrix elements

# Linear Algebra Learning Sequence
# Printing sin value of vector/matrix elements 
# using numpy.sin()
import numpy as np

# Use of np.array() to define an Vector
V = np.array([323,623,823])
print("The Vector A : ",V)

VV = np.array([[3,63,78],[315,32,42]])
print("\nThe Vector B : \n",VV)

pro = V.dot(VV.T)

print("\nProduct of two vectors : ", pro)
    
print("\nSin(AB) : ", np.sin(pro))
print("\nSin(A) : ", np.sin(V))
print("\nSin(B) : \n", np.sin(VV))

Output:

The Vector A :  [323 623 823]

The Vector B : 
 [[  3  63  78]
 [315  32  42]]

Product of two vectors :  [104412 156247]

Sin(AB) :  [-0.92003035  0.11040078]

Sin(A) :  [ 0.55140153  0.82185218 -0.0971219 ]

Sin(B) : 
 [[ 0.14112001  0.1673557   0.51397846]
 [ 0.74513326  0.55142668 -0.91652155]]





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.