- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Finding determinant of a square matrix using SciPy library
The determinant of a matrix, denoted by |A|, is a scalar value that can be calculated from a square matrix. With the help of the determinant of a matrix, we can find the inverse of a matrix and other things that are useful in the systems of linear equations, calculus, etc. The function named scipy.linalg.det() calculates the determinant of a square matrix.
Let’s understand it with the below given examples −
Example
Calculating determinant of 2 by 2 matrix
#Importing the scipy package import scipy #Importing the numpy package import numpy as np #Declaring the numpy array (Square Matrix) X = np.array([[5,1],[8,4]]) #Passing the values to scipy.linalg.det() function M = scipy.linalg.det(X) #Printing the result print('Determinant of
{}
is {}'.format(X,M))
Output
Determinant of [[5 1] [8 4]] is 12.0
Example
Calculating determinant of 3 by 3 matrix
import scipy import numpy as np Y = np.array([[1,2,9],[5,4,3],[1,5,3]]) M = scipy.linalg.det(Y) print('Determinant of
{}
is {}'.format(Y,M))
Output
Determinant of [[1 2 9] [5 4 3] [1 5 3]] is 162.0
- Related Articles
- Finding inverse of a square matrix using SciPy library
- PyTorch – How to compute the determinant of a square matrix?
- Finding square root of a number without using library functions - JavaScript
- How can SciPy be used to calculate the determinant value of a matrix in Python?
- How to find the Eigenvalues and Eigenvectors of a square matrix using SciPy?
- Determinant of a Matrix in C++?
- Determinant of a Matrix in C++ Program
- C++ Program to Compute Determinant of a Matrix
- How to solve a circulant matrix equation using Python SciPy?
- How to implement ‘cubic’ 1-D interpolation using SciPy library?
- Comparing ‘cubic’ and ‘linear’ 1-D interpolation using SciPy library
- How to solve triangular matrix equations using Python SciPy?
- Python Program to find out the determinant of a given special matrix
- Implementing K-means clustering of Diabetes dataset with SciPy library
- How to solve Hermitian positive-banded matrix equation using Python SciPy?

Advertisements