Added Algebra Solver

This commit is contained in:
frankxayachack 2018-10-04 22:57:34 +07:00
parent f2a4a5be6b
commit f33440837b
2 changed files with 32 additions and 0 deletions

View File

@ -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])

16
Algebra-Solver/README.MD Normal file
View File

@ -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"
```