Instagram
youtube
Facebook
Twitter

Compute the Determinant of a NumPy Array

   Compute the Determinant of a NumPy Array
     
     Short Description of the Program:

     This program calculates the determinant of a square NumPy array using the np.linalg.det() function.
     
      Explanation:

  • np.array()
    Creates a 2x2 square matrix which is needed to compute the determinant.

     
  • np.linalg.det(array)
    Computes the determinant of the given matrix. The determinant gives information about the matrix, such as whether it is invertible.

     
  • print()
    Displays the original matrix and the calculated determinant.

     

Program:

import numpy as np

array = np.array([[4, 6], [3, 8]])

determinant = np.linalg.det(array)

print("Original Array:\n", array)

print("\nDeterminant of the Array:", determinant)