A package that solves and graphs quadratic equations
Project description
Quadratic Solver
A powerful and easy-to-use Command Line Interface (CLI) application for solving and visualizing quadratic equations. This tool computes key properties of quadratic functions and provides a graphical representation of the curve.
🚀 Features
-
Solve quadratic equations of the form: ax² + bx + c = 0
-
Compute:
- ✅ Real or complex roots
- ✅ Discriminant
- ✅ Vertex (turning point)
- ✅ Axis of symmetry
- ✅ Ordered pairs (for plotting)
- ✅ Nature of roots (distinct, repeated, or complex)
-
📈 Graph the quadratic function directly from the CLI
📦 Installation
Install via pip:
pip install quadratic-solver
🛠️ Usage
Run the CLI tool from your terminal:
quadratic-solver
You will be prompted to input the coefficients:
Enter coefficient a: 1
Enter coefficient b: -3
Enter coefficient c: 2
📊 Example Output
Quadratic Equation: 1x² - 3x + 2 = 0
Discriminant: 1
Roots: x₁ = 2, x₂ = 1
Nature of Roots: Real and Distinct
Vertex: (1.5, -0.25)
Axis of Symmetry: x = 1.5
Sample Points:
(0, 2)
(1, 0)
(2, 0)
(3, 2)
A graph window will also appear displaying the parabola.
📈 Graphing
The application automatically generates a plot of the quadratic function, highlighting:
- The roots
- The vertex
- The curve shape (concave up or down)
🧠 How It Works
The app uses standard quadratic formula logic:
x = (-b ± √(b² - 4ac)) / (2a)
-
If the discriminant is:
- > 0 → Two real roots
- = 0 → One repeated root
- < 0 → Two complex roots
Graphing is handled programmatically using Python plotting libraries.
🧪 Requirements
-
Python 3.10+
-
Required dependencies (installed automatically):
- matplotlib
- numpy
📁 Project Structure
quadratic_solver/
│── quadratic_model.py
│── run.py
│── solve_and_graph.py
🤝 Contributing
Contributions are welcome!
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
📜 License
This project is licensed under the MIT License.
💡 Future Improvements
- Export graph as image file
- Batch processing of multiple equations
- Interactive mode with command flags
👨💻 Author
Built with ❤️ by Uchenna Adubasim
⭐ Support
If you find this project useful, consider giving it a star on GitHub!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quadratic_solver-1.0.1.tar.gz.
File metadata
- Download URL: quadratic_solver-1.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
205ed688626ad9748fb8f26870f55c9d2ab845c36de115a0b3efc5413841b49b
|
|
| MD5 |
916b3d5e906ece86f38e8529f71bec13
|
|
| BLAKE2b-256 |
40adf81f281f46fff5552127235b35795e7a5e6c1f30db850f7934ce637b8cdf
|
File details
Details for the file quadratic_solver-1.0.1-py3-none-any.whl.
File metadata
- Download URL: quadratic_solver-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f95168ff62e561d0ff80b3a9b6fa3ff2db80d2d3006b901173aadaeed7add6fe
|
|
| MD5 |
b80e6d98d072f1986ea0279e460c59f3
|
|
| BLAKE2b-256 |
d0a63244265a0843cd1338ec8f5bbea9b8f8d278868d2989ef85a5f9848efe4d
|