v Calculate The Determinant Of A Matrix - Machine Learning

Calculate The Determinant Of A Matrix

Preliminaries

# Load library
import numpy as np

Create Matrix

# Create matrix
matrix = np.array([[1, 2, 3],
                   [4, 5, 6],
                   [7, 8, 9]])

Calculate Determinant

# Return determinant of matrix
np.linalg.det(matrix)
-9.5161973539299405e-16