mirror of
https://github.com/Sosokker/Calculator-for-Matrix-and-Algebra.git
synced 2025-12-18 12:44:05 +01:00
Initial commit
This commit is contained in:
parent
ba1f7bac71
commit
2d71d41d05
45
main.py
Normal file
45
main.py
Normal file
@ -0,0 +1,45 @@
|
||||
from nessesary.matrix import Matrix
|
||||
from file_read_write import *
|
||||
import ast
|
||||
|
||||
print("Algebraic And Matrix Solving tools.")
|
||||
print("===================================")
|
||||
print("===============Guide===============")
|
||||
|
||||
line_count = 1
|
||||
while True:
|
||||
command = input(f"[{line_count}]: ")
|
||||
|
||||
brac_index = command.find("[")
|
||||
if brac_index != -1:
|
||||
todo = command[:brac_index]
|
||||
expr = command[brac_index+1:-1]
|
||||
|
||||
else:
|
||||
if command.lower() in ["q", "quit", "quits"]:
|
||||
break
|
||||
elif command == "delete history":
|
||||
delete()
|
||||
|
||||
if "solve" in todo.lower():
|
||||
pass
|
||||
|
||||
elif "matrix" in todo.lower():
|
||||
val = ast.literal_eval(expr)
|
||||
m1 = Matrix(val)
|
||||
print(f"Input Matrix: {m1}")
|
||||
try:
|
||||
print(f"Determinant: {m1.determinant()}")
|
||||
except:
|
||||
print(f"No determinant for {m1.row}x{m1.column} Matrix")
|
||||
t_matrix = m1.tranpose()
|
||||
print(f"Tranpose Matrix: {t_matrix}")
|
||||
|
||||
elif "det" in todo.lower():
|
||||
pass
|
||||
|
||||
if brac_index != -1:
|
||||
save_dict = {todo:expr}
|
||||
read_write_command(save_dict)
|
||||
|
||||
line_count += 1
|
||||
Loading…
Reference in New Issue
Block a user