Awesome-Python-Scripts/Algebra-Solver/Algebra-Solver.py

16 lines
265 B
Python
Raw Normal View History

2018-10-04 15:57:34 +00:00
#!/usr/bin/python3
from sympy import *
import sys
def solver(x):
sympy_eq = sympify("Eq(" + x.replace("=", ",") + ")")
result = solve(sympy_eq)
return result[0]
def main(x):
X = solver(x)
print("X = " + str(X))
if __name__ == "__main__":
main(sys.argv[1])