diff --git a/Algebra-Solver/Algebra-Solver.py b/Algebra-Solver/Algebra-Solver.py new file mode 100644 index 0000000..dcbd0e0 --- /dev/null +++ b/Algebra-Solver/Algebra-Solver.py @@ -0,0 +1,16 @@ +#!/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]) \ No newline at end of file diff --git a/Algebra-Solver/README.MD b/Algebra-Solver/README.MD new file mode 100644 index 0000000..8360b10 --- /dev/null +++ b/Algebra-Solver/README.MD @@ -0,0 +1,16 @@ +# Python Algebra Solver +This python script will demonstrate how to solve a very simple algebra using sympy module + +## Requirement + +Python 3.xx or Python 2.xx +Sympy +```bash +pip install sympy +``` + +#Usage +Call python following with the simple algebra problem +```bash +$ python Solver.py "5 = X - 2" +```