mirror of
https://github.com/Sosokker/Calculator-for-Matrix-and-Algebra.git
synced 2025-12-19 05:04:06 +01:00
Add guide menu
This commit is contained in:
parent
f2ca66fd43
commit
8eccc253d1
59
main.py
59
main.py
@ -6,8 +6,59 @@ from file_read_write import *
|
|||||||
from nessesary.equation.processing import change_side, poly_expand, simplify
|
from nessesary.equation.processing import change_side, poly_expand, simplify
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
|
def guide():
|
||||||
|
while True:
|
||||||
|
print("All of the command will be saved in history.json file.")
|
||||||
|
print("====================== Command List ======================")
|
||||||
|
print("1) solve[equation]: Solve equation and Polynomial")
|
||||||
|
print("2) poly[str or list]: Solve Polynomial")
|
||||||
|
print("3) Matrix[nested list]: Show all of that matrix property")
|
||||||
|
print("4) det[equation]: Find Det")
|
||||||
|
print("5) inverse[equation]: Find inverse matrix")
|
||||||
|
print("6) tranpose[equation]: show the tranpose matrix")
|
||||||
|
print("7) simplify[expression]: simplify the given expression")
|
||||||
|
print("8) history: view history from history.json")
|
||||||
|
print("9) clear: clear history.json")
|
||||||
|
print("10) delete: delete history.json")
|
||||||
|
print("11) guide: Open Guide file")
|
||||||
|
print("12) q,quit: quit the program")
|
||||||
|
|
||||||
|
print("========================== Guide ==========================")
|
||||||
|
print("To use this program. type in the command and expression in form of")
|
||||||
|
print("that command.")
|
||||||
|
print("==========Syntax=========")
|
||||||
|
print("""
|
||||||
|
| operator | meaning |
|
||||||
|
|:-------------:|:---------:|
|
||||||
|
| + | add |
|
||||||
|
| - | substract |
|
||||||
|
| * or adjacant | multiply |
|
||||||
|
| / | Division |
|
||||||
|
| ^ | Power |
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
print("==========Example=========")
|
||||||
|
print("[1]: solve[(2x-1)^2 = 0]")
|
||||||
|
print("Input: (2x-1)^2=0")
|
||||||
|
print("=========================")
|
||||||
|
print("Solution to (2x-1)^2=0")
|
||||||
|
print("Answer #1: x = -0.5 | x = -1/2")
|
||||||
|
print("=========================")
|
||||||
|
u_input = input("Type q to quit the help menu[q or quit]: ")
|
||||||
|
try:
|
||||||
|
if "q" in u_input.lower():
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
print("Calculator-for-Matrix-and-Algebra")
|
print("Calculator-for-Matrix-and-Algebra")
|
||||||
print("===================================")
|
print("===================================")
|
||||||
|
print("Type 'Guide' or 'guide' to open guide menu")
|
||||||
|
print("===================================")
|
||||||
|
print("Type 'Quit' or 'q' to quit the program")
|
||||||
|
print("===================================")
|
||||||
line_count = 1
|
line_count = 1
|
||||||
while True:
|
while True:
|
||||||
command = input(f"[{line_count}]: ")
|
command = input(f"[{line_count}]: ")
|
||||||
@ -38,6 +89,10 @@ while True:
|
|||||||
read_history()
|
read_history()
|
||||||
line_count += 1
|
line_count += 1
|
||||||
continue
|
continue
|
||||||
|
if "guide" in command:
|
||||||
|
guide()
|
||||||
|
line_count += 1
|
||||||
|
continue
|
||||||
todo.lower()
|
todo.lower()
|
||||||
except:
|
except:
|
||||||
print("Invaid input. Please enter the input expression again.")
|
print("Invaid input. Please enter the input expression again.")
|
||||||
@ -83,10 +138,10 @@ while True:
|
|||||||
collected_answer.append(ans)
|
collected_answer.append(ans)
|
||||||
counting += 1
|
counting += 1
|
||||||
print("="*(21+len(poly.to_str())))
|
print("="*(21+len(poly.to_str())))
|
||||||
write_command(todo, poly.to_str(), collected_answer)
|
write_command(todo, str(poly), collected_answer)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Can't find solution to this expression.(Program can only find solution up too 2nd degree polynomial)")
|
print("Can't find solution to this expression.(Program can only find solution up too 2nd degree polynomial)")
|
||||||
write_command(todo, poly.to_str(), "")
|
write_command(todo, str(poly), "")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user