🛠️ToolsShed

Calcolatore di Matrici

Somma, moltiplica, trasponi e calcola il determinante di matrici 2×2 e 3×3.

Matrice A

Matrice B

Domande Frequenti

Implementazione del Codice

import numpy as np

A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])

# Addition
print("A + B =\n", A + B)

# Multiplication (dot product)
print("A @ B =\n", A @ B)

# Determinant
print("det(A) =", np.linalg.det(A))   # -2.0

# Inverse (exists only if det ≠ 0)
print("A^-1 =\n", np.linalg.inv(A))

# Transpose
print("A^T =\n", A.T)

# Eigenvalues and eigenvectors
vals, vecs = np.linalg.eig(A)
print("Eigenvalues:", vals)
print("Eigenvectors:\n", vecs)

# Solve linear system Ax = b
b = np.array([1, 2])
x = np.linalg.solve(A, b)
print("Solution x:", x)  # A @ x == b

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.