Merge pull request #34 from frankxayachack/algebra-solver

Added Algebra Solver
This commit is contained in:
Kaushlendra Pratap 2018-10-05 12:55:35 +05:30 committed by GitHub
commit 8fd8ec502f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"
```