Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python – scipy.linalg.det
The scipy.linalg package contains a set of different functionalities that are used for Linear Algebra. One of them is the det() function. This function is used to find the determinant of a two-dimensional matrix.
Syntax
scipy.linalg.det(x)
Where x is a square matrix.
Example 1
Let us consider the following example −
# Importing the required libraries
from scipy import linalg
import numpy as np
# Initialize the matrix A
A = np.array([[8, 5], [3, 4]])
print("Input Matrix :
", A)
# Find the determinant of matrix X
x = linalg.det(A)
print("Determinant Value of A:", x)
Output
It will generate the following output −
Input Matrix : [[8 5] [3 4]] Determinant Value of A: 17.0
Example 2
Let us consider the following example −
# Importing the required libraries
from scipy import linalg
import numpy as np
# Initializing the matrix M
M = np.arange(6, 10).reshape(2, 2)
print("Input Matrix :
", M)
# Finding the determinant of matrix X
x = linalg.det(M)
print("Determinant Value of M:", x)
Output
The above program will generate the following output −
Input Matrix : [[6 7] [8 9]] Determinant Value of M: -2.0000000000000053
Advertisements