Skip to content

added a python script that finds inverse of a matrix#1

Open
alwenpy wants to merge 1 commit into
mattryanmtl:masterfrom
alwenpy:alwenpy
Open

added a python script that finds inverse of a matrix#1
alwenpy wants to merge 1 commit into
mattryanmtl:masterfrom
alwenpy:alwenpy

Conversation

@alwenpy

@alwenpy alwenpy commented Oct 2, 2023

Copy link
Copy Markdown

added a python script that finds inverse of a matrix

@AvTe

AvTe commented Oct 18, 2023

Copy link
Copy Markdown

`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