More Matrix Functions

Function Name Definition
scipy.linalg.sqrtm(A, disp, blocksize) Finds the square root of the matrix.
scipy.linalg.expm(A) Computes the matrix exponential using Pade approximation.
scipy.linalg.sinm(A) Computes the sine of the matrix.
scipy.linalg.cosm(A) Computes the cosine of the matrix.
scipy.linalg.tanm(A) Computes the tangent of the matrix.

Example:

Python




# Importing the required libraries
from scipy import linalg
import numpy as np
  
# Initializing the matrix 
x = np.array([[16 , 4] , [100 , 25]])
  
# Calculate and print the matrix 
# square root
r = linalg.sqrtm(x)
print(r)
print("\n")
  
# Calculate and print the matrix 
# exponential
e = linalg.expm(x)
print(e)
print("\n")
  
# Calculate and print the matrix
# sine
s = linalg.sinm(x)
print(s)
print("\n")
  
# Calculate and print the matrix 
# cosine
c = linalg.cosm(x)
print(c)
print("\n")
  
# Calculate and print the matrix 
# tangent
t = linalg.tanm(x)
print(t)


Output:



SciPy Linear Algebra – SciPy Linalg

The SciPy package includes the features of the NumPy package in Python. It uses NumPy arrays as the fundamental data structure. It has all the features included in the linear algebra of the NumPy module and some extended functionality. It consists of a linalg submodule, and there is an overlap in the functionality provided by the SciPy and NumPy submodules.

Let’s discuss some methods provided by the module and its functionality with some examples.

Similar Reads

Solving the linear equations

The linalg.solve function is used to solve the given linear equations. It is used to evaluate the equations automatically and find the values of the unknown variables....

Calculating the Inverse of a Matrix

...

Calculating the Pseudo Inverse of a Matrix

The scipy.linalg.inv is used to find the inverse of a matrix....

Finding the Determinant of a Matrix

...

Singular Value Decomposition

To evaluate the (Moore-Penrose) pseudo-inverse of a matrix, scipy.linalg.pinv is used....

Eigenvalues and EigenVectors

...

Calculating the norm

The determinant of a square matrix is a value derived arithmetically from the coefficients of the matrix. In the linalg module, we use the linalg.det() function to find the determinant of a matrix....

More Matrix Functions

...