Python – scipy.linalg.sinm()


The sinm() function scipy.linalg package is used to compute the sine of an input matrix. This routine uses expm to compute the matrix exponentials.

Syntax

scipy.linalg.sinm(x)

where x is the inputer array.

Example 1

Let us consider the following example −

# Import the required libraries from scipy
from scipy import linalg
import numpy as np

# Define the input array
X = np.array([[110, 12], [79, 23]])
print("Input Matrix, X:\n", X)

# Calculate the Sine of the matrix
n = linalg.sinm(X)

# Display the Sine
print("Sine of X: \n", n)

Output

It will generate the following output −

Input Matrix, X:
 [[110 12]
 [ 79 23]]
Sine of X:
 [[ 0.41972171 -0.02196579]
 [-0.14460811 0.57897368]]

Example 2

Let us take another example −

# Import the required libraries
from scipy import linalg
import numpy as np

# Define the input array
p = np.array([[87 , 15] , [48 , 12]])
q = linalg.inv(p)
print("Input Matrix:\n", q)

# Calculate the Sine
n = linalg.sinm(q)

# Display the Sine of matrix
print("Sine of Q: \n", n)

Output

It will generate the following output −

Input Matrix:
 [[ 0.03703704 -0.0462963 ]
 [-0.14814815 0.26851852]]
Sine of Q:
 [[ 0.03663868 -0.04560274]
 [-0.14592875 0.26465236]]

Updated on: 24-Dec-2021

148 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements