Small CLI tool to solve, factorise and plot quadratic equations.
This repository includes demo.py — a self-contained, minimal demo of the CLI so you can try features without installing the package.
- Quick, standalone interactive demo for parsing, solving, factorising and graphing quadratic equations.
- Run directly from the repository root; no
pip installrequired.
- Python 3.8+
- Dependencies:
- numpy
- matplotlib
Install dependencies (recommended in a virtual environment):
python3 -m pip install requirements.txtFrom the project root:
python3 demo.py- Interactive menu offering:
- Solve — parse equations and compute roots
- Graph — plot equations with annotated real roots (matplotlib)
- Solve + Graph — compute then plot
- Factorise — print factorised forms when possible
- Exit — quit the demo
- Input methods:
- File input: path to a text file with one equation per line (format:
ax^2 + bx + c, omit= 0). Lines starting with#are ignored. - Manual input: enter equations line-by-line; finish with a blank line.
- File input: path to a text file with one equation per line (format:
- Parsing supports shorthand coefficients:
""or"+"→ 1,"-"→ -1. - Outputs numeric roots and rational approximations (fractions) where applicable.
2x^2 + 5x - 3
-x^2 + 4x + 7
x^2 - 2x + 1
- Run
demo.pydirectly for quick testing and development — no packaging or installation needed. - For working with the packaged CLI (
equationsolver/equasolve), prefer refactoring package modules to use relative imports and then install in editable mode:
python -m pip install -e .- If matplotlib windows do not appear on Linux, ensure your DISPLAY/X configuration is correct or run in an environment that supports graphics.
- Entry points when installed (via
setup.py):equationsolver,equasolve - See
/docsfor installation, API and contribution details.
- GPLv3 (see LICENSE.md)