The quadratic-equation-solver
is a robust Python script designed to solve quadratic equations, handling both real and complex roots. It incorporates comprehensive error handling and presents results clearly, including a graphical visualization of the equation. The code is structured for maintainability and testability, following best practices for professional software development.
To use this script, you'll need Python installed on your system along with the matplotlib
and numpy
libraries.
- Python 3.x
- matplotlib
- numpy
- Clone the repository:
git clone https://github.com/kik369/quadratic-equation-solver.git
- Navigate to the cloned directory:
cd quadratic-equation-solver
- (Optional) Create and activate a virtual environment:
python3 -m venv .venv # Create a virtual environment (Use python -m venv .venv on Windows) source .venv/bin/activate # Activate the virtual environment (Use .venv\Scripts\activate on Windows)
- Install the required packages:
pip install -r requirements.txt
Run the script by passing the coefficients of the quadratic equation as command-line arguments:
python quadratic.py <a> <b> <c>
Here are some example outputs showing the graph of the quadratic equation and its solutions: