Related Articles

Related Articles

numpy.linalg.det() Method in Python
  • Last Updated : 10 Aug, 2020

In NumPy, we can compute the determinant of the given square array with the help of numpy.linalg.det(). It will take the given square array as a parameter and return the determinant of that.

Syntax: numpy.linalg.det()

Parameter: An square array.

Return: The deteminant of that square array.

Example 1:



Python

filter_none

edit
close

play_arrow

link
brightness_4
code

import numpy as np
from numpy import linalg as LA
  
  
array1 = np.array([[1, 2], [3, 4]])
  
# Original 2-d array
print(array1)
  
# Determinant of the said 2-D array
print(np.linalg.det(array1))

chevron_right


Output:

[[1 2]
 [3 4]]
-2.0000000000000004

Example 2:

Python

filter_none

edit
close

play_arrow

link
brightness_4
code

import numpy as np
from numpy import linalg as LA
  
  
array1 = np.array([[1, 2, 3], [3, 4, 1], [3, 2, 1]])
  
# Original 2-d array
print(array1)
  
# Determinant of the said 2-D array
print(np.linalg.det(array1))

chevron_right


Output:

[[1 2 3]
 [3 4 1]
 [3 2 1]]
-15.999999999999998

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :