Skip to content

Conversation

@alwenpy
Copy link

@alwenpy alwenpy commented Oct 2, 2023

added a python script that finds inverse of a matrix

@AvTe
Copy link

AvTe commented Oct 18, 2023

`import numpy as np

Define your matrix

matrix = np.array([[1, 2], [3, 4]])

Calculate the matrix inverse

try:
inverse_matrix = np.linalg.inv(matrix)
print("Matrix Inverse:")
print(inverse_matrix)
except np.linalg.LinAlgError:
print("Matrix is singular; it does not have an inverse.")
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants