A full-stack project that analyzes and solves polynomial equations using a FastAPI backend and a simple interactive frontend.
-
✅ Accepts polynomial input in two formats:
- Polynomial string (e.g.,
x^2 - 5x + 6) - Coefficient list (e.g.,
[1, -5, 6])
- Polynomial string (e.g.,
-
✅ Detects:
- Coefficients
- Degree
- Polynomial type (linear, quadratic, cubic, etc.)
-
✅ Computes:
- Real roots
- Complex roots (with real & imaginary parts)
-
✅ Handles user-friendly input:
- Supports
^and converts to** - Supports
5x→ converts to5*x
- Supports
-
✅ Clean frontend UI for easy interaction
- Backend: FastAPI
- Numerical Computation: NumPy
- Symbolic Parsing: SymPy
- Frontend: HTML, CSS, JavaScript
poly-api/
│
├── main.py
├── solver/
│ ├── __init__.py
│ └── polynomial.py
│
├── index.html
├── requirements.txt
└── README.md
git clone <your-repo-link>
cd poly-api
python -m venv venv
- Windows:
.\venv\Scripts\Activate.ps1
- Mac/Linux:
source venv/bin/activate
pip install -r requirements.txt
python -m uvicorn main:app --reload
Server will run at:
http://127.0.0.1:8000
http://127.0.0.1:8000/docs
Simply open:
index.html
in your browser.
Analyzes polynomial structure.
{
"polynomial": "x^2 - 5x + 6"
}
{
"coefficients": [1, -5, 6],
"degree": 2,
"type": "quadratic"
}
Solves polynomial and returns roots.
{
"polynomial": "x^2 - 5x + 6"
}
{
"coefficients": [1, -5, 6],
"degree": 2,
"type": "quadratic",
"roots": [2.0, 3.0]
}
- Invalid polynomial string
- Missing input
- Leading zeros in coefficients
- Constant polynomials
- Complex roots
- REST API design
- Input preprocessing & normalization
- Numerical vs symbolic computation
- Floating-point precision handling
- Graph visualization of polynomial
- Deployment (Render / Railway)
- Enhanced UI/UX
- Authentication (JWT)
Himanshu Gupta B.E. Computer Science Engineering Chandigarh University
This project demonstrates practical backend development using FastAPI combined with mathematical computation and a simple frontend interface.