This is a Python-based program that allows users to perform various matrix operations using the NumPy library. The program offers a simple menu-driven interface where users can select different operations to perform on matrices.
The program supports the following matrix operations:
- Addition
- Subtraction
- Multiplication
- Scalar Multiplication
- Transpose
- Determinant
- Inverse
- Rank
- Trace
- Eigenvalues and Eigenvectors
- Solving Linear Equations
- Python 3.x
- NumPy Library (You can install it via
pip install numpy)
-
Start the program:
- Run the Python script.
-
Select an operation:
- The program will display a menu of available matrix operations.
- Enter the number corresponding to the operation you want to perform.
-
Enter the matrix dimensions:
- For most operations, you will be asked to input the dimensions of the matrices (rows and columns).
- You will then input the matrix elements, one row at a time, separated by spaces.
-
Perform the operation:
- The program will compute and display the result of the selected matrix operation.
-
Repeat or Exit:
- After completing an operation, you can choose to perform another one or exit the program.
- Enter the dimensions of two matrices.
- Enter the elements of both matrices.
- The program will output the result of the addition of the two matrices.
- If solving a system of linear equations, input the matrix for the coefficients and the right-hand side vector.
- Addition: Adds two matrices.
- Subtraction: Subtracts the second matrix from the first.
- Multiplication: Multiplies two matrices.
- Scalar Multiplication: Multiplies a matrix by a scalar.
- Transpose: Transposes a matrix.
- Determinant: Computes the determinant of a matrix.
- Inverse: Computes the inverse of a matrix.
- Rank: Computes the rank of a matrix.
- Trace: Computes the trace of a matrix.
- Eigenvalues & Eigenvectors: Computes eigenvalues and eigenvectors of a matrix.
- Solve Linear Equations: Solves a system of linear equations using matrix equations.
- Choose the operation: 1 (Addition)
- Enter the dimensions for two 2x2 matrices.
- Input the matrix elements.
- The program will return the sum of the two matrices.
- The program checks for common input errors, such as mismatched matrix dimensions, and will prompt you to enter correct values.
- For matrix inversion and other operations that may not be possible (e.g., singular matrices), the program will handle errors appropriately.
This project is open-source and available for modification and redistribution under the MIT License.
Contributions are welcome! If you have any improvements or bug fixes, please feel free to fork the repository and submit a pull request.
For any questions or feedback, please contact the project maintainer at henokapril@gmail.com .